dhl_ecommerce_api 0.1.5 → 0.1.8
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/Gemfile.lock +1 -1
- data/lib/dhl_ecommerce_api/resources/base.rb +0 -1
- data/lib/dhl_ecommerce_api/resources/event.rb +0 -1
- data/lib/dhl_ecommerce_api/resources/shipment/shipment_item/consignee_address.rb +6 -0
- data/lib/dhl_ecommerce_api/resources/shipment/shipment_item.rb +46 -50
- data/lib/dhl_ecommerce_api/resources/shipment.rb +0 -2
- data/lib/dhl_ecommerce_api/resources/shipment_with_dropoff.rb +52 -0
- data/lib/dhl_ecommerce_api/resources/{shipment/pickup.rb → shipment_with_pickup.rb} +19 -3
- data/lib/dhl_ecommerce_api/version.rb +1 -1
- data/lib/dhl_ecommerce_api.rb +5 -3
- metadata +5 -4
- data/lib/dhl_ecommerce_api/resources/shipment/dropoff.rb +0 -50
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2c631b27d8fbe5337fb63e73caf9a577ab9be717d56f72b0d726d004439e954a
|
4
|
+
data.tar.gz: 5fd628b9b8339e5f0baeb0e36f2f59f97ee72b110e7dc7a94100b7fac18c3287
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 22ab3ba491f789331432b8466a74679188537236682fb16c864712539a4f5e046f149ae52974751b76919859f49e6cbfb8c720a3a060b825026b00ef23ad6c3a
|
7
|
+
data.tar.gz: df9c0a8d9d63bb8570f30d296ca24e0602f6500c18bfe68dd6a888ee0dc3c04accdf7b3a209411c1bff3a490deca73432804aab98506e73069659129e5e81cf8
|
data/Gemfile.lock
CHANGED
@@ -1,52 +1,48 @@
|
|
1
|
-
|
2
|
-
#
|
3
|
-
|
4
|
-
|
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
|
-
# }
|
1
|
+
module DHLEcommerceAPI
|
2
|
+
# Component item
|
3
|
+
class Shipment::ShipmentItem < Base
|
4
|
+
self.element_name = ""
|
36
5
|
|
37
|
-
#
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
6
|
+
# add some validations?
|
7
|
+
DEFAULT_ATTRIBUTES = {
|
8
|
+
shipment_id: nil,
|
9
|
+
package_desc: "",
|
10
|
+
total_weight: nil,
|
11
|
+
total_weight_uom: "G",
|
12
|
+
dimension_uom: "CM",
|
13
|
+
height: nil,
|
14
|
+
length: nil,
|
15
|
+
width: nil,
|
16
|
+
product_code: "PDO",
|
17
|
+
cod_value: nil,
|
18
|
+
insurance_value: nil,
|
19
|
+
total_value: 300,
|
20
|
+
currency: "MYR",
|
21
|
+
remarks: nil,
|
22
|
+
is_routing_info_required: "Y",
|
23
|
+
consignee_address: {
|
24
|
+
company_name: "",
|
25
|
+
name: "",
|
26
|
+
address1: "",
|
27
|
+
address2: nil,
|
28
|
+
address3: nil,
|
29
|
+
city: "",
|
30
|
+
state: "",
|
31
|
+
district: nil,
|
32
|
+
country: "MY",
|
33
|
+
post_code: "",
|
34
|
+
phone: "",
|
35
|
+
email: nil
|
36
|
+
}
|
37
|
+
}
|
45
38
|
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
39
|
+
def initialize(attributes = {}, persisted = false)
|
40
|
+
status = attributes["response_status"]
|
41
|
+
if status.present? && status["code"] != "200"
|
42
|
+
error_messages = status["message_details"].map{|err| err["message_detail"]}
|
43
|
+
handle_errors(status["code"], error_messages)
|
44
|
+
end
|
45
|
+
super
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
@@ -0,0 +1,52 @@
|
|
1
|
+
module DHLEcommerceAPI
|
2
|
+
class ShipmentWithDropoff < Shipment
|
3
|
+
# This creates a Shipment ONLY.
|
4
|
+
# DHL will expect the item to be dropped off at one of their locations.
|
5
|
+
# Used in conjunction with the Pickup class.
|
6
|
+
|
7
|
+
self.element_name = ""
|
8
|
+
|
9
|
+
DEFAULT_ATTRIBUTES = {
|
10
|
+
handover_method: 1,
|
11
|
+
shipment_items: []
|
12
|
+
}
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
=begin
|
17
|
+
shipment_with_dropoff_params = {
|
18
|
+
"shipment_items" => [
|
19
|
+
{
|
20
|
+
"consignee_address" => {
|
21
|
+
"company_name" => "Test",
|
22
|
+
"name" => "Test1",
|
23
|
+
"address1" => "NO 3 JALAN PPU 1",
|
24
|
+
"address2" => "TAMAN PERINDUSTRIAN PUCHONG UTAMA",
|
25
|
+
"address3" => nil,
|
26
|
+
"city" => "PUCHONG",
|
27
|
+
"state" => "SELANGOR",
|
28
|
+
"district" => nil,
|
29
|
+
"country" => "MY",
|
30
|
+
"post_code" => "57000",
|
31
|
+
"phone" => "0123456798",
|
32
|
+
"email" => nil
|
33
|
+
},
|
34
|
+
"shipment_id" => "MYPTC000103",
|
35
|
+
"package_desc" => "Bread Materials",
|
36
|
+
"total_weight" => 2000,
|
37
|
+
"total_weight_uom" => "G",
|
38
|
+
"dimension_uom" => "CM",
|
39
|
+
"height" => nil,
|
40
|
+
"length" => nil,
|
41
|
+
"width" => nil,
|
42
|
+
"product_code" => "PDO",
|
43
|
+
"cod_value" => nil,
|
44
|
+
"insurance_value" => nil,
|
45
|
+
"total_value" => 300,
|
46
|
+
"currency" => "MYR",
|
47
|
+
"remarks" => nil,
|
48
|
+
"is_routing_info_required" => "Y"
|
49
|
+
}
|
50
|
+
],
|
51
|
+
}
|
52
|
+
=end
|
@@ -1,5 +1,5 @@
|
|
1
1
|
module DHLEcommerceAPI
|
2
|
-
class
|
2
|
+
class ShipmentWithPickup < Shipment
|
3
3
|
# This is a coupled shipment + pickup request.
|
4
4
|
|
5
5
|
self.element_name = ""
|
@@ -25,7 +25,8 @@ module DHLEcommerceAPI
|
|
25
25
|
end
|
26
26
|
end
|
27
27
|
|
28
|
-
|
28
|
+
=begin
|
29
|
+
params = {
|
29
30
|
"handoverMethod": 2,
|
30
31
|
"pickupDateTime": DateTime.now.to_s,
|
31
32
|
"pickupAddress": {
|
@@ -58,6 +59,20 @@ shipment_with_pickup_params = {
|
|
58
59
|
"currency": "MYR",
|
59
60
|
"remarks": nil,
|
60
61
|
"isRoutingInfoRequired": "Y",
|
62
|
+
"returnMode": 3,
|
63
|
+
"returnAddress": {
|
64
|
+
"companyName": "Pickup From Company",
|
65
|
+
"name": "Pickup From Name",
|
66
|
+
"address1": "Holistic Pharmacy PostCo, 55, Jalan Landak",
|
67
|
+
"address2": "",
|
68
|
+
"address3": "",
|
69
|
+
"city": " Kuala Lumpur",
|
70
|
+
"state": " Kuala Lumpur",
|
71
|
+
"postCode": "55100",
|
72
|
+
"country": "MY",
|
73
|
+
"phone": "0169822645",
|
74
|
+
"email": "erwhey@postco.co"
|
75
|
+
},
|
61
76
|
"consigneeAddress": {
|
62
77
|
"companyName": "Sleeve Company",
|
63
78
|
"name": "Sleeve Sdn Bhd",
|
@@ -74,4 +89,5 @@ shipment_with_pickup_params = {
|
|
74
89
|
}
|
75
90
|
},
|
76
91
|
]
|
77
|
-
}
|
92
|
+
}.deep_transform_keys!{ |key| key.to_s.underscore }
|
93
|
+
=end
|
data/lib/dhl_ecommerce_api.rb
CHANGED
@@ -12,9 +12,11 @@ module DHLEcommerceAPI
|
|
12
12
|
require "dhl_ecommerce_api/resources/authentication"
|
13
13
|
|
14
14
|
require "dhl_ecommerce_api/resources/shipment"
|
15
|
-
require "dhl_ecommerce_api/resources/
|
16
|
-
require "dhl_ecommerce_api/resources/
|
17
|
-
|
15
|
+
require "dhl_ecommerce_api/resources/shipment_with_pickup"
|
16
|
+
require "dhl_ecommerce_api/resources/shipment_with_dropoff"
|
17
|
+
|
18
|
+
require "dhl_ecommerce_api/resources/shipment/shipment_item"
|
19
|
+
require "dhl_ecommerce_api/resources/shipment/shipment_item/consignee_address"
|
18
20
|
|
19
21
|
require "dhl_ecommerce_api/resources/pickup"
|
20
22
|
|
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.8
|
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-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activeresource
|
@@ -142,9 +142,10 @@ files:
|
|
142
142
|
- lib/dhl_ecommerce_api/resources/pickup.rb
|
143
143
|
- lib/dhl_ecommerce_api/resources/pickup/handover_item.rb
|
144
144
|
- lib/dhl_ecommerce_api/resources/shipment.rb
|
145
|
-
- lib/dhl_ecommerce_api/resources/shipment/dropoff.rb
|
146
|
-
- lib/dhl_ecommerce_api/resources/shipment/pickup.rb
|
147
145
|
- lib/dhl_ecommerce_api/resources/shipment/shipment_item.rb
|
146
|
+
- lib/dhl_ecommerce_api/resources/shipment/shipment_item/consignee_address.rb
|
147
|
+
- lib/dhl_ecommerce_api/resources/shipment_with_dropoff.rb
|
148
|
+
- lib/dhl_ecommerce_api/resources/shipment_with_pickup.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
|
@@ -1,50 +0,0 @@
|
|
1
|
-
module DHLEcommerceAPI
|
2
|
-
class Shipment::Dropoff < Shipment
|
3
|
-
# This creates a Shipment ONLY.
|
4
|
-
# DHL will expect the item to be dropped off at one of their locations.
|
5
|
-
# Used in conjunction with the Pickup class.
|
6
|
-
|
7
|
-
self.element_name = ""
|
8
|
-
|
9
|
-
DEFAULT_ATTRIBUTES = {
|
10
|
-
handover_method: 1,
|
11
|
-
shipment_items: []
|
12
|
-
}
|
13
|
-
end
|
14
|
-
end
|
15
|
-
|
16
|
-
# shipment_with_dropoff_params = {
|
17
|
-
# "shipment_items" => [
|
18
|
-
# {
|
19
|
-
# "consignee_address" => {
|
20
|
-
# "company_name" => "Test",
|
21
|
-
# "name" => "Test1",
|
22
|
-
# "address1" => "NO 3 JALAN PPU 1",
|
23
|
-
# "address2" => "TAMAN PERINDUSTRIAN PUCHONG UTAMA",
|
24
|
-
# "address3" => nil,
|
25
|
-
# "city" => "PUCHONG",
|
26
|
-
# "state" => "SELANGOR",
|
27
|
-
# "district" => nil,
|
28
|
-
# "country" => "MY",
|
29
|
-
# "post_code" => "57000",
|
30
|
-
# "phone" => "0123456798",
|
31
|
-
# "email" => nil
|
32
|
-
# },
|
33
|
-
# "shipment_id" => "MYPTC000103",
|
34
|
-
# "package_desc" => "Bread Materials",
|
35
|
-
# "total_weight" => 2000,
|
36
|
-
# "total_weight_uom" => "G",
|
37
|
-
# "dimension_uom" => "CM",
|
38
|
-
# "height" => nil,
|
39
|
-
# "length" => nil,
|
40
|
-
# "width" => nil,
|
41
|
-
# "product_code" => "PDO",
|
42
|
-
# "cod_value" => nil,
|
43
|
-
# "insurance_value" => nil,
|
44
|
-
# "total_value" => 300,
|
45
|
-
# "currency" => "MYR",
|
46
|
-
# "remarks" => nil,
|
47
|
-
# "is_routing_info_required" => "Y"
|
48
|
-
# }
|
49
|
-
# ],
|
50
|
-
# }
|