dhl_ecommerce_api 0.1.6 → 0.1.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/lib/dhl_ecommerce_api/resources/base.rb +0 -1
- data/lib/dhl_ecommerce_api/resources/shipment/pickup.rb +50 -50
- data/lib/dhl_ecommerce_api/resources/shipment/shipment_item/consignee_address.rb +5 -0
- data/lib/dhl_ecommerce_api/resources/shipment/shipment_item.rb +45 -51
- data/lib/dhl_ecommerce_api/version.rb +1 -1
- data/lib/dhl_ecommerce_api.rb +2 -1
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1611a50fc49c9a322a7949f3080512e79d727d34d99ca75f4d6370f8bbdeef15
|
4
|
+
data.tar.gz: 7dcf5b35eac8835be58e2baa8a6f93ee8c901c7ca94e3427156442ca8db758f1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6119191eddd500affe3c2a7a5cc724082fa93e003f34c89649b26169f36380775cea1c270be92994a5709d24d42c3c00919e00f3f13c30c2cdd4f8cca1f8293c
|
7
|
+
data.tar.gz: da6911749451b9951d1c8b07aa0cd44f05a1a6dd2290fbe9904202c45d408ce502dff9a6756e7712838c2d68dce70344aa7e485cb8a10a83c91057e6f78450a9
|
data/Gemfile.lock
CHANGED
@@ -25,53 +25,53 @@ module DHLEcommerceAPI
|
|
25
25
|
end
|
26
26
|
end
|
27
27
|
|
28
|
-
shipment_with_pickup_params = {
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
}
|
28
|
+
# shipment_with_pickup_params = {
|
29
|
+
# "handoverMethod": 2,
|
30
|
+
# "pickupDateTime": DateTime.now.to_s,
|
31
|
+
# "pickupAddress": {
|
32
|
+
# "companyName": "Pickup From Company",
|
33
|
+
# "name": "Pickup From Name",
|
34
|
+
# "address1": "Holistic Pharmacy PostCo, 55, Jalan Landak",
|
35
|
+
# "address2": "",
|
36
|
+
# "address3": "",
|
37
|
+
# "city": " Kuala Lumpur",
|
38
|
+
# "state": " Kuala Lumpur",
|
39
|
+
# "postCode": "55100",
|
40
|
+
# "country": "MY",
|
41
|
+
# "phone": "0169822645",
|
42
|
+
# "email": "erwhey@postco.co"
|
43
|
+
# },
|
44
|
+
# "shipmentItems": [
|
45
|
+
# {
|
46
|
+
# "shipmentID": "MYPTC0087",
|
47
|
+
# "packageDesc": "Laptop Sleeve",
|
48
|
+
# "totalWeight": 500,
|
49
|
+
# "totalWeightUOM": "G",
|
50
|
+
# "dimensionUOM": "CM",
|
51
|
+
# "height": nil,
|
52
|
+
# "length": nil,
|
53
|
+
# "width": nil,
|
54
|
+
# "productCode": "PDO",
|
55
|
+
# "codValue": nil,
|
56
|
+
# "insuranceValue": nil,
|
57
|
+
# "totalValue": 300,
|
58
|
+
# "currency": "MYR",
|
59
|
+
# "remarks": nil,
|
60
|
+
# "isRoutingInfoRequired": "Y",
|
61
|
+
# "consigneeAddress": {
|
62
|
+
# "companyName": "Sleeve Company",
|
63
|
+
# "name": "Sleeve Sdn Bhd",
|
64
|
+
# "address1": "No. 3, Jalan Bangsar, Kampung Haji Abdullah Hukum",
|
65
|
+
# "address2": nil,
|
66
|
+
# "address3": nil,
|
67
|
+
# "city": "Kuala Lumpur",
|
68
|
+
# "state": "Kuala Lumpur",
|
69
|
+
# "district": nil,
|
70
|
+
# "country": "MY",
|
71
|
+
# "postCode": "59200",
|
72
|
+
# "phone": "0169822645",
|
73
|
+
# "email": nil
|
74
|
+
# }
|
75
|
+
# },
|
76
|
+
# ]
|
77
|
+
# }
|
@@ -1,52 +1,46 @@
|
|
1
|
-
|
2
|
-
#
|
3
|
-
|
4
|
-
#
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
1
|
+
module DHLEcommerceAPI
|
2
|
+
# Component item
|
3
|
+
class Shipment::ShipmentItem < Base
|
4
|
+
# add some validations?
|
5
|
+
DEFAULT_ATTRIBUTES = {
|
6
|
+
shipment_id: nil,
|
7
|
+
package_desc: "",
|
8
|
+
total_weight: nil,
|
9
|
+
total_weight_uom: "G",
|
10
|
+
dimension_uom: "CM",
|
11
|
+
height: nil,
|
12
|
+
length: nil,
|
13
|
+
width: nil,
|
14
|
+
product_code: "PDO",
|
15
|
+
cod_value: nil,
|
16
|
+
insurance_value: nil,
|
17
|
+
total_value: 300,
|
18
|
+
currency: "MYR",
|
19
|
+
remarks: nil,
|
20
|
+
is_routing_info_required: "Y",
|
21
|
+
consignee_address: {
|
22
|
+
company_name: "",
|
23
|
+
name: "",
|
24
|
+
address1: "",
|
25
|
+
address2: nil,
|
26
|
+
address3: nil,
|
27
|
+
city: "",
|
28
|
+
state: "",
|
29
|
+
district: nil,
|
30
|
+
country: "MY",
|
31
|
+
post_code: "",
|
32
|
+
phone: "",
|
33
|
+
email: nil
|
34
|
+
}
|
35
|
+
}
|
36
36
|
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
# attributes.as_json
|
48
|
-
# .deep_transform_keys { |k| k.to_s.camelize(:lower) }
|
49
|
-
# .to_json(include_root_in_json ? { root: self.class.element_name }.merge(options) : options)
|
50
|
-
# end
|
51
|
-
# end
|
52
|
-
# end
|
37
|
+
def initialize(attributes = {}, persisted = false)
|
38
|
+
status = attributes["response_status"]
|
39
|
+
if status.present? && status["code"] != "200"
|
40
|
+
error_messages = status["message_details"].map{|err| err["message_detail"]}
|
41
|
+
handle_errors(status["code"], error_messages)
|
42
|
+
end
|
43
|
+
super
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
data/lib/dhl_ecommerce_api.rb
CHANGED
@@ -14,7 +14,8 @@ module DHLEcommerceAPI
|
|
14
14
|
require "dhl_ecommerce_api/resources/shipment"
|
15
15
|
require "dhl_ecommerce_api/resources/shipment/pickup"
|
16
16
|
require "dhl_ecommerce_api/resources/shipment/dropoff"
|
17
|
-
|
17
|
+
require "dhl_ecommerce_api/resources/shipment/shipment_item"
|
18
|
+
require "dhl_ecommerce_api/resources/shipment/shipment_item/consignee_address"
|
18
19
|
|
19
20
|
require "dhl_ecommerce_api/resources/pickup"
|
20
21
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
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.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Er Whey
|
@@ -145,6 +145,7 @@ files:
|
|
145
145
|
- lib/dhl_ecommerce_api/resources/shipment/dropoff.rb
|
146
146
|
- lib/dhl_ecommerce_api/resources/shipment/pickup.rb
|
147
147
|
- lib/dhl_ecommerce_api/resources/shipment/shipment_item.rb
|
148
|
+
- lib/dhl_ecommerce_api/resources/shipment/shipment_item/consignee_address.rb
|
148
149
|
- lib/dhl_ecommerce_api/resources/tracking.rb
|
149
150
|
- lib/dhl_ecommerce_api/version.rb
|
150
151
|
- sig/dhl_ecommerce_api.rbs
|