dhl_ecommerce_api 0.1.14 → 0.1.15
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
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ddc6328d0bd244a84d7aee00a96890d1d7003d227fc46357312f7f7bba3da896
|
4
|
+
data.tar.gz: 3d0359ea889a9e13099995118cb3a8b16f5d5f169ca4133e09c4a1690d0f70e2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 19111a620dab055825fec90fad626d3ec902712b2a8b58b494cd1130501b6fb315f252c724200bd20402139605f011353909984bdfe2a9dbdf20c57358667b6d
|
7
|
+
data.tar.gz: e8399ea8631e95c336c9c86abf7c608be5013b5ea1d51219e7561c47a05bc4af409c4b013512500522b2b4418fe935a63e1e231785bd6dc0458747d8ee485fab
|
data/Gemfile.lock
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
dhl_ecommerce_api (0.1.
|
4
|
+
dhl_ecommerce_api (0.1.14)
|
5
5
|
activeresource (>= 4.1.0, < 6.0.0)
|
6
6
|
|
7
7
|
GEM
|
8
8
|
remote: https://rubygems.org/
|
9
9
|
specs:
|
10
|
-
activemodel (6.1.
|
11
|
-
activesupport (= 6.1.
|
10
|
+
activemodel (6.1.5)
|
11
|
+
activesupport (= 6.1.5)
|
12
12
|
activemodel-serializers-xml (1.0.2)
|
13
13
|
activemodel (> 5.x)
|
14
14
|
activesupport (> 5.x)
|
@@ -17,7 +17,7 @@ GEM
|
|
17
17
|
activemodel (>= 5.0, < 7)
|
18
18
|
activemodel-serializers-xml (~> 1.0)
|
19
19
|
activesupport (>= 5.0, < 7)
|
20
|
-
activesupport (6.1.
|
20
|
+
activesupport (6.1.5)
|
21
21
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
22
22
|
i18n (>= 1.6, < 2)
|
23
23
|
minitest (>= 5.1)
|
@@ -0,0 +1,15 @@
|
|
1
|
+
module DHLEcommerceAPI
|
2
|
+
# Component item
|
3
|
+
class Shipment::ShipmentItem < Base
|
4
|
+
self.element_name = ""
|
5
|
+
|
6
|
+
def initialize(attributes = {}, persisted = false)
|
7
|
+
status = attributes["response_status"]
|
8
|
+
if status.present? && status["code"] != "200"
|
9
|
+
error_messages = status["message_details"].map{|err| err["message_detail"]}
|
10
|
+
handle_errors(status["code"], error_messages)
|
11
|
+
end
|
12
|
+
super
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
@@ -27,16 +27,21 @@ module DHLEcommerceAPI
|
|
27
27
|
if code == "200"
|
28
28
|
@persisted = true
|
29
29
|
elsif code == "204"
|
30
|
-
# handle partial success
|
31
30
|
@persisted = false
|
32
31
|
else
|
33
32
|
error_messages = response_status["messageDetails"].map{|err| err["messageDetail"]}
|
34
33
|
handle_errors(code, error_messages)
|
35
34
|
@persisted = false
|
36
35
|
end
|
37
|
-
|
36
|
+
|
37
|
+
# service level
|
38
38
|
new_attributes = attributes.merge({response: JSON.parse(response.body)})
|
39
|
-
|
39
|
+
|
40
|
+
# object level
|
41
|
+
new_attributes["shipmentItems"] = new_attributes["shipmentItems"].map do |item|
|
42
|
+
item.attributes.merge(bd["shipmentItems"].find{|i| i["shipmentID"] == item.shipmentID})
|
43
|
+
end
|
44
|
+
|
40
45
|
load(new_attributes, true, @persisted)
|
41
46
|
end
|
42
47
|
end
|
@@ -94,7 +99,7 @@ shipment_with_pickup_params = {
|
|
94
99
|
},
|
95
100
|
"shipmentItems": [
|
96
101
|
{
|
97
|
-
"shipmentID": "
|
102
|
+
"shipmentID": "MYPTC0090",
|
98
103
|
"packageDesc": "Laptop Sleeve",
|
99
104
|
"totalWeight": 500,
|
100
105
|
"totalWeightUOM": "G",
|
@@ -138,6 +143,50 @@ shipment_with_pickup_params = {
|
|
138
143
|
"email": "hello@example.com"
|
139
144
|
}
|
140
145
|
},
|
146
|
+
{
|
147
|
+
"shipmentID": "MYPTC0089",
|
148
|
+
"totalWeight": 500,
|
149
|
+
"totalWeightUOM": "G",
|
150
|
+
"dimensionUOM": "CM",
|
151
|
+
"height": nil,
|
152
|
+
"length": nil,
|
153
|
+
"width": nil,
|
154
|
+
"productCode": "PDO",
|
155
|
+
"codValue": nil,
|
156
|
+
"insuranceValue": nil,
|
157
|
+
"totalValue": 300,
|
158
|
+
"currency": "MYR",
|
159
|
+
"remarks": nil,
|
160
|
+
"isRoutingInfoRequired": "Y",
|
161
|
+
"consigneeAddress": {
|
162
|
+
"companyName": "Sleeve Company",
|
163
|
+
"name": "Sleeve Sdn Bhd",
|
164
|
+
"address1": "No. 3, Jalan Bangsar, Kampung Haji Abdullah Hukum",
|
165
|
+
"address2": nil,
|
166
|
+
"address3": nil,
|
167
|
+
"city": "Kuala Lumpur",
|
168
|
+
"state": "Kuala Lumpur",
|
169
|
+
"district": nil,
|
170
|
+
"country": "MY",
|
171
|
+
"postCode": "59200",
|
172
|
+
"phone": "0169822645",
|
173
|
+
"email": nil
|
174
|
+
},
|
175
|
+
"returnMode": "03",
|
176
|
+
"returnAddress": {
|
177
|
+
"companyName": "Pickup From Company",
|
178
|
+
"name": "Pickup From Name",
|
179
|
+
"address1": "Holistic Pharmacy PostCo, 55, Jalan Landak",
|
180
|
+
"address2": "",
|
181
|
+
"address3": "",
|
182
|
+
"city": " Kuala Lumpur",
|
183
|
+
"state": " Kuala Lumpur",
|
184
|
+
"postCode": "55100",
|
185
|
+
"country": "MY",
|
186
|
+
"phone": "0123456789",
|
187
|
+
"email": "hello@example.com"
|
188
|
+
}
|
189
|
+
},
|
141
190
|
]
|
142
191
|
}
|
143
192
|
=end
|
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.15
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Er Whey
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-03-
|
11
|
+
date: 2022-03-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activeresource
|
@@ -141,6 +141,7 @@ files:
|
|
141
141
|
- lib/dhl_ecommerce_api/resources/event.rb
|
142
142
|
- lib/dhl_ecommerce_api/resources/pickup.rb
|
143
143
|
- lib/dhl_ecommerce_api/resources/shipment.rb
|
144
|
+
- lib/dhl_ecommerce_api/resources/shipment/shipment_item.rb
|
144
145
|
- lib/dhl_ecommerce_api/resources/tracking.rb
|
145
146
|
- lib/dhl_ecommerce_api/version.rb
|
146
147
|
- sig/dhl_ecommerce_api.rbs
|