Skip to content

Instantly share code, notes, and snippets.

@bufordtaylor
Last active August 29, 2015 14:14
Show Gist options
  • Save bufordtaylor/d2e8042255e71af64f31 to your computer and use it in GitHub Desktop.
Save bufordtaylor/d2e8042255e71af64f31 to your computer and use it in GitHub Desktop.

#1. Deep link

Deep linking is the easiest integration (because there is the least chance of technical failure), but it requires that the user has both the Open and the Shortcut apps.

It is as simple as letting the user click on a URL like the one as follows:

    shortcutapp://event/12345/menu

In the AndroidManifest.xml

    <activity android:name="co.uk.shortcutapp.shortcut.MenuActivity"
               android:label="@string/title_shortcutapp" >
         <intent-filter android:label="@string/filter_title_viewshortcutapp">
             <action android:name="android.intent.action.VIEW" />
             <data android:scheme="https"
                   android:host="shortcutapp.com"
                   android:pathPrefix="/shortcutapp" />
             <category android:name="android.intent.category.DEFAULT" />
             <category android:name="android.intent.category.BROWSABLE" />
         </intent-filter>
     </activity>

#2. Full API

We need to speak more if you wanted to go this route.

There are 2 main calls:

  • The inventory call which returns a result like this:

      [inventories: (
              {
              "age_restricted" = 0;
              available = 1;
              category = Merchandise;
              concessions =         (
                              {
                      id = 1;
                  }
              );
              "created_at" = "2014-10-29T19:11:21.761+00:00";
              description = "";
              "hard_purchase_limit" = 0;
              id = 501;
              "image_url" = "<null>";
              name = "Hotdog";
              "options_categories" =         (
                              {
                      id = 474;
                      "max_selections" = 1;
                      "min_selections" = 1;
                      name = Size;
                      options =                 (
                                              {
                              id = 660;
                              "integer_price" = 100;
                              "is_default" = 0;
                              name = "Footlong";
                              position = 1;
                          },
                                              {
                              id = 778;
                              "integer_price" = 50;
                              "is_default" = 0;
                              name = "Regular";
                              position = 2;
                          },
                                              {
                              id = 779;
                              "integer_price" = 25;
                              "is_default" = 1;
                              name = "Kids";
                              position = 3;
                          }
                      );
                      position = 1;
                  }
              );
              position = 1;
              quantity = "<null>";
              "soft_purchase_limit" = 0;
              "sub_category" = "T-Shirts";
              "sub_sub_category" = Other;
              "updated_at" = "2014-11-10T04:02:42.730+00:00";
          }
          ), concessions: (
              {
              description = "";
              id = 20;
              location = "Section 110 - Next to Frank's hotdog stand";
              name = Shortcut;
          }
      )]
    
  • The order call where you would need to provide the appropriate information so we can process the order

      (["order": {
          "client_calculated_total" = 1000;
          "delivery_choice" = pickup;
          "event_id" = 577;
          "integer_tip" = 0;
          "order_items_attributes" =     (
                      {
                  "inventory_id" = 511;
                  "options_attributes" =             (
                                      {
                          "inventory_option_id" = 670;
                      },
                                      {
                          "inventory_option_id" = 671;
                      }
                  );
                  quantity = 1;
              }
          );
      }, "stripe_token": token])
    

You would receive a 200 response. Since your event is using location, it would be more complicated than this example. If this is the route you think would be best, I can write up a proper documentation.

This path might result in a there be dragons situation.

#3. SDKs.

You would end up with an integrated webview experience optimized for mobile and touch events. Similar to http://shortcutapp.com/events/583-mk-dons/menu (when viewed in a mobile browser)

Nearly as easy as deep linking, the experience would be quite good for the consumer.

iOS SDK example

    // iOS example: Install the Shortcut SDK with pod
    
    override func viewDidLoad() {
      super.viewDidLoad()
      let shortcut = ShortcutApp.initWithEvent("12345", completion: completionBlock)
      shortcut.setMainColor("#fff")
      shortcut.setSecondaryColor("#000")
      navigationController?.pushViewController(shortcut, animated: true)
    }

Android SDK example

    // Android example: in build.gradle
    
    dependencies {
      ...
      compile 'com.shortcutapp.android:example-package'
    }
    
    // in activity
    
    ShortcutApp shortcutApp = new ShortcutApp("12345", {
      @Override void
      onCompletion()
      {
          // your code
      }
    });
    shortcutApp.setMainColor("#fff");
    shortcutApp.setSecondaryColor("#000");
    shortcutApp.show();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment