dhl_ecommerce_api 0.1.18 → 0.1.19
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/dhl_ecommerce_api/resources/shipment.rb +136 -136
- data/lib/dhl_ecommerce_api/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b7e23ebf6bf6ec39245a0f2628cfaf038be41a3e698cc3b1ba17926dc335e796
|
4
|
+
data.tar.gz: 14eba9b87ad576b262cb7b319d2f788fe9c90584ec6801c8499f6b1b8056246f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 12d49caaff1ac181ad597d41dbd497fc56c2644ebd5101b9d2f44fc27a157b4aef8394b9edf46efca0099f150e92dc85f9cae315c9811b7329cb3822e70c0735
|
7
|
+
data.tar.gz: df2e813b339bd2a9574d57c5f9dd89f70e5a82c84ae58585873000d3327847b52857478efafcd90c08bb761328334284e63247d3bb95d74f58c05d85a1daa320
|
@@ -17,9 +17,9 @@ module DHLEcommerceAPI
|
|
17
17
|
|
18
18
|
def load_attributes_from_response(response)
|
19
19
|
if response_code_allows_body?(response.code.to_i) &&
|
20
|
-
|
21
|
-
|
22
|
-
|
20
|
+
(response["Content-Length"].nil? || response["Content-Length"] != "0") &&
|
21
|
+
!response.body.nil? && response.body.strip.size > 0
|
22
|
+
|
23
23
|
bd = self.class.format.decode(response.body)["bd"]
|
24
24
|
response_status = bd["responseStatus"]
|
25
25
|
code = response_status["code"]
|
@@ -29,17 +29,19 @@ module DHLEcommerceAPI
|
|
29
29
|
elsif code == "204"
|
30
30
|
@persisted = false
|
31
31
|
else
|
32
|
-
error_messages = response_status["messageDetails"].map{|err| err["messageDetail"]}
|
32
|
+
error_messages = response_status["messageDetails"].map { |err| err["messageDetail"] }
|
33
33
|
handle_errors(code, error_messages)
|
34
34
|
@persisted = false
|
35
35
|
end
|
36
|
-
|
36
|
+
|
37
37
|
# service level
|
38
|
-
new_attributes = attributes.merge({response: JSON.parse(response.body)})
|
38
|
+
new_attributes = attributes.merge({ response: JSON.parse(response.body) })
|
39
39
|
|
40
40
|
# object level
|
41
|
-
|
42
|
-
|
41
|
+
if bd["shipmentItems"].present?
|
42
|
+
new_attributes["shipmentItems"] = new_attributes["shipmentItems"].map do |item|
|
43
|
+
item.attributes.merge(bd["shipmentItems"].find { |i| i["shipmentID"] == item.shipmentID })
|
44
|
+
end
|
43
45
|
end
|
44
46
|
|
45
47
|
load(new_attributes, true, @persisted)
|
@@ -54,7 +56,7 @@ module DHLEcommerceAPI
|
|
54
56
|
}
|
55
57
|
}
|
56
58
|
end
|
57
|
-
|
59
|
+
|
58
60
|
def headers
|
59
61
|
{
|
60
62
|
"messageType": "SHIPMENT",
|
@@ -67,135 +69,133 @@ module DHLEcommerceAPI
|
|
67
69
|
end
|
68
70
|
|
69
71
|
# Examples:
|
70
|
-
=
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
}
|
192
|
-
=end
|
72
|
+
# shipment_with_pickup_params = {
|
73
|
+
# "handoverMethod": 2,
|
74
|
+
# "pickupDateTime": DateTime.now.to_s,
|
75
|
+
# "pickupAddress": {
|
76
|
+
# "companyName": "Pickup From Company",
|
77
|
+
# "name": "Pickup From Name",
|
78
|
+
# "address1": "Holistic Pharmacy PostCo, 55, Jalan Landak",
|
79
|
+
# "address2": "",
|
80
|
+
# "address3": "",
|
81
|
+
# "city": " Kuala Lumpur",
|
82
|
+
# "state": " Kuala Lumpur",
|
83
|
+
# "postCode": "55100",
|
84
|
+
# "country": "MY",
|
85
|
+
# "phone": "0123456789",
|
86
|
+
# "email": "hello@example.com"
|
87
|
+
# },
|
88
|
+
# "shipperAddress": {
|
89
|
+
# "companyName": "Pickup From Company",
|
90
|
+
# "name": "Pickup From Name",
|
91
|
+
# "address1": "Holistic Pharmacy PostCo, 55, Jalan Landak",
|
92
|
+
# "address2": "",
|
93
|
+
# "address3": "",
|
94
|
+
# "city": " Kuala Lumpur",
|
95
|
+
# "state": " Kuala Lumpur",
|
96
|
+
# "postCode": "55100",
|
97
|
+
# "country": "MY",
|
98
|
+
# "phone": "0123456789",
|
99
|
+
# "email": "hello@example.com"
|
100
|
+
# },
|
101
|
+
# "shipmentItems": [
|
102
|
+
# {
|
103
|
+
# "shipmentID": "MYPTC0090",
|
104
|
+
# "packageDesc": "Laptop Sleeve",
|
105
|
+
# "totalWeight": 500,
|
106
|
+
# "totalWeightUOM": "G",
|
107
|
+
# "dimensionUOM": "CM",
|
108
|
+
# "height": nil,
|
109
|
+
# "length": nil,
|
110
|
+
# "width": nil,
|
111
|
+
# "productCode": "PDO",
|
112
|
+
# "codValue": nil,
|
113
|
+
# "insuranceValue": nil,
|
114
|
+
# "totalValue": 300,
|
115
|
+
# "currency": "MYR",
|
116
|
+
# "remarks": nil,
|
117
|
+
# "isRoutingInfoRequired": "Y",
|
118
|
+
# "consigneeAddress": {
|
119
|
+
# "companyName": "Sleeve Company",
|
120
|
+
# "name": "Sleeve Sdn Bhd",
|
121
|
+
# "address1": "No. 3, Jalan Bangsar, Kampung Haji Abdullah Hukum",
|
122
|
+
# "address2": nil,
|
123
|
+
# "address3": nil,
|
124
|
+
# "city": "Kuala Lumpur",
|
125
|
+
# "state": "Kuala Lumpur",
|
126
|
+
# "district": nil,
|
127
|
+
# "country": "MY",
|
128
|
+
# "postCode": "59200",
|
129
|
+
# "phone": "0169822645",
|
130
|
+
# "email": nil
|
131
|
+
# },
|
132
|
+
# "returnMode": "03",
|
133
|
+
# "returnAddress": {
|
134
|
+
# "companyName": "Pickup From Company",
|
135
|
+
# "name": "Pickup From Name",
|
136
|
+
# "address1": "Holistic Pharmacy PostCo, 55, Jalan Landak",
|
137
|
+
# "address2": "",
|
138
|
+
# "address3": "",
|
139
|
+
# "city": " Kuala Lumpur",
|
140
|
+
# "state": " Kuala Lumpur",
|
141
|
+
# "postCode": "55100",
|
142
|
+
# "country": "MY",
|
143
|
+
# "phone": "0123456789",
|
144
|
+
# "email": "hello@example.com"
|
145
|
+
# }
|
146
|
+
# },
|
147
|
+
# {
|
148
|
+
# "shipmentID": "MYPTC0089",
|
149
|
+
# "totalWeight": 500,
|
150
|
+
# "totalWeightUOM": "G",
|
151
|
+
# "dimensionUOM": "CM",
|
152
|
+
# "height": nil,
|
153
|
+
# "length": nil,
|
154
|
+
# "width": nil,
|
155
|
+
# "productCode": "PDO",
|
156
|
+
# "codValue": nil,
|
157
|
+
# "insuranceValue": nil,
|
158
|
+
# "totalValue": 300,
|
159
|
+
# "currency": "MYR",
|
160
|
+
# "remarks": nil,
|
161
|
+
# "isRoutingInfoRequired": "Y",
|
162
|
+
# "consigneeAddress": {
|
163
|
+
# "companyName": "Sleeve Company",
|
164
|
+
# "name": "Sleeve Sdn Bhd",
|
165
|
+
# "address1": "No. 3, Jalan Bangsar, Kampung Haji Abdullah Hukum",
|
166
|
+
# "address2": nil,
|
167
|
+
# "address3": nil,
|
168
|
+
# "city": "Kuala Lumpur",
|
169
|
+
# "state": "Kuala Lumpur",
|
170
|
+
# "district": nil,
|
171
|
+
# "country": "MY",
|
172
|
+
# "postCode": "59200",
|
173
|
+
# "phone": "0169822645",
|
174
|
+
# "email": nil
|
175
|
+
# },
|
176
|
+
# "returnMode": "03",
|
177
|
+
# "returnAddress": {
|
178
|
+
# "companyName": "Pickup From Company",
|
179
|
+
# "name": "Pickup From Name",
|
180
|
+
# "address1": "Holistic Pharmacy PostCo, 55, Jalan Landak",
|
181
|
+
# "address2": "",
|
182
|
+
# "address3": "",
|
183
|
+
# "city": " Kuala Lumpur",
|
184
|
+
# "state": " Kuala Lumpur",
|
185
|
+
# "postCode": "55100",
|
186
|
+
# "country": "MY",
|
187
|
+
# "phone": "0123456789",
|
188
|
+
# "email": "hello@example.com"
|
189
|
+
# }
|
190
|
+
# },
|
191
|
+
# ]
|
192
|
+
# }
|
193
193
|
|
194
194
|
# shipment_with_dropoff_params = {
|
195
195
|
# "handover_method" => 1,
|
196
196
|
# "shipment_items" => [
|
197
|
-
# {
|
198
|
-
# "consignee_address" => {
|
197
|
+
# {
|
198
|
+
# "consignee_address" => {
|
199
199
|
# "company_name" => "Test",
|
200
200
|
# "name" => "Test1",
|
201
201
|
# "address1" => "NO 3 JALAN PPU 1",
|
@@ -207,7 +207,7 @@ shipment_with_pickup_params = {
|
|
207
207
|
# "country" => "MY",
|
208
208
|
# "post_code" => "57000",
|
209
209
|
# "phone" => "0123456798",
|
210
|
-
# "email" => nil
|
210
|
+
# "email" => nil
|
211
211
|
# },
|
212
212
|
# "shipment_id" => "MYPTC000102",
|
213
213
|
# "package_desc" => "Bread Materials",
|
@@ -223,7 +223,7 @@ shipment_with_pickup_params = {
|
|
223
223
|
# "total_value" => 300,
|
224
224
|
# "currency" => "MYR",
|
225
225
|
# "remarks" => nil,
|
226
|
-
# "is_routing_info_required" => "Y"
|
226
|
+
# "is_routing_info_required" => "Y"
|
227
227
|
# }
|
228
228
|
# ],
|
229
229
|
# }
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dhl_ecommerce_api
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.19
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Er Whey
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2024-03-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activeresource
|
@@ -169,7 +169,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
169
169
|
- !ruby/object:Gem::Version
|
170
170
|
version: '0'
|
171
171
|
requirements: []
|
172
|
-
rubygems_version: 3.
|
172
|
+
rubygems_version: 3.2.33
|
173
173
|
signing_key:
|
174
174
|
specification_version: 4
|
175
175
|
summary: Unofficial Ruby object based DHL eCommerce API wrapper.
|