markdown description

Judy Ngai 9 年 前
コミット
5ae16f3f55
共有1 個のファイルを変更した55 個の追加72 個の削除を含む
  1. 55 72
      app/models/agents/aftership_agent.rb

+ 55 - 72
app/models/agents/aftership_agent.rb

@@ -28,79 +28,62 @@ module Agents
28 28
     MD
29 29
 
30 30
     event_description <<-MD
31
-      A typical tracking event has 3 objects (attributes, tracking, and checkpoint) and it looks like this
32
-    {
33
-        "meta": {
34
-            "code": 200
35
-        },
36
-        "data": {
37
-            "page": 1,
38
-            "limit": 100,
39
-            "count": 3,
40
-            "keyword": "",
41
-            "slug": "",
42
-            "origin": [],
43
-            "destination": [],
44
-            "tag": "",
45
-            "fields": "",
46
-            "created_at_min": "2014-03-27T07:36:14+00:00",
47
-            "created_at_max": "2014-06-25T07:36:14+00:00",
48
-            "trackings": [
49
-                {
50
-                    "id": "53aa7b5c415a670000000021",
51
-                    "created_at": "2014-06-25T07:33:48+00:00",
52
-                    "updated_at": "2014-06-25T07:33:55+00:00",
53
-                    "tracking_number": "123456789",
54
-                    "tracking_account_number": null,
55
-                    "tracking_postal_code": null,
56
-                    "tracking_ship_date": null,
57
-                    "slug": "dhl",
58
-                    "active": false,
59
-                    "custom_fields": {
60
-                        "product_price": "USD19.99",
61
-                        "product_name": "iPhone Case"
62
-                    },
63
-                    "customer_name": null,
64
-                    "destination_country_iso3": null,
65
-                    "emails": [
66
-                        "email@yourdomain.com",
67
-                        "another_email@yourdomain.com"
68
-                    ],
69
-                    "expected_delivery": null,
70
-                    "note": null,
71
-                    "order_id": "ID 1234",
72
-                    "order_id_path": "http://www.aftership.com/order_id=1234",
73
-                    "origin_country_iso3": null,
74
-                    "shipment_package_count": 0,
75
-                    "shipment_type": null,
76
-                    "signed_by": "raul",
77
-                    "smses": [],
78
-                    "source": "api",
79
-                    "tag": "Delivered",
80
-                    "title": "Title Name",
81
-                    "tracked_count": 1,
82
-                    "unique_token": "xy_fej9Llg",
83
-                    "checkpoints": [
84
-                        {
85
-                            "slug": "dhl",
86
-                            "city": null,
87
-                            "created_at": "2014-06-25T07:33:53+00:00",
88
-                            "country_name": "VALENCIA - SPAIN",
89
-                            "message": "Awaiting collection by recipient as requested",
90
-                            "country_iso3": null,
91
-                            "tag": "InTransit",
92
-                            "checkpoint_time": "2014-05-12T12:02:00",
93
-                            "coordinates": [],
94
-                            "state": null,
95
-                            "zip": null
96
-                        },
97
-                        ...
98
-                    ]
31
+      A typical tracking event have 2 important objects (tracking, and checkpoint) and the tracking/checkpoint looks like this.
32
+
33
+          "trackings": [
34
+            {
35
+                "id": "53aa7b5c415a670000000021",
36
+                "created_at": "2014-06-25T07:33:48+00:00",
37
+                "updated_at": "2014-06-25T07:33:55+00:00",
38
+                "tracking_number": "123456789",
39
+                "tracking_account_number": null,
40
+                "tracking_postal_code": null,
41
+                "tracking_ship_date": null,
42
+                "slug": "dhl",
43
+                "active": false,
44
+                "custom_fields": {
45
+                    "product_price": "USD19.99",
46
+                    "product_name": "iPhone Case"
99 47
                 },
100
-                ...
101
-            ]
102
-        }
103
-    }
48
+                "customer_name": null,
49
+                "destination_country_iso3": null,
50
+                "emails": [
51
+                    "email@yourdomain.com",
52
+                    "another_email@yourdomain.com"
53
+                ],
54
+                "expected_delivery": null,
55
+                "note": null,
56
+                "order_id": "ID 1234",
57
+                "order_id_path": "http://www.aftership.com/order_id=1234",
58
+                "origin_country_iso3": null,
59
+                "shipment_package_count": 0,
60
+                "shipment_type": null,
61
+                "signed_by": "raul",
62
+                "smses": [],
63
+                "source": "api",
64
+                "tag": "Delivered",
65
+                "title": "Title Name",
66
+                "tracked_count": 1,
67
+                "unique_token": "xy_fej9Llg",
68
+                "checkpoints": [
69
+                    {
70
+                        "slug": "dhl",
71
+                        "city": null,
72
+                        "created_at": "2014-06-25T07:33:53+00:00",
73
+                        "country_name": "VALENCIA - SPAIN",
74
+                        "message": "Awaiting collection by recipient as requested",
75
+                        "country_iso3": null,
76
+                        "tag": "InTransit",
77
+                        "checkpoint_time": "2014-05-12T12:02:00",
78
+                        "coordinates": [],
79
+                        "state": null,
80
+                        "zip": null
81
+                    },
82
+                    ...
83
+                ]
84
+            },
85
+            ...
86
+        ]
104 87
     MD
105 88
 
106 89
     def default_options