dhl_ecommerce_api 0.1.13 → 0.1.14
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/connection.rb +0 -1
- data/lib/dhl_ecommerce_api/resources/base.rb +2 -27
- data/lib/dhl_ecommerce_api/resources/pickup.rb +41 -38
- data/lib/dhl_ecommerce_api/resources/shipment.rb +90 -62
- data/lib/dhl_ecommerce_api/resources/tracking.rb +24 -29
- data/lib/dhl_ecommerce_api/version.rb +1 -1
- data/lib/dhl_ecommerce_api.rb +2 -8
- metadata +1 -6
- data/lib/dhl_ecommerce_api/resources/pickup/handover_item.rb +0 -12
- data/lib/dhl_ecommerce_api/resources/shipment/shipment_item/consignee_address.rb +0 -6
- data/lib/dhl_ecommerce_api/resources/shipment/shipment_item.rb +0 -48
- data/lib/dhl_ecommerce_api/resources/shipment_with_dropoff.rb +0 -52
- data/lib/dhl_ecommerce_api/resources/shipment_with_pickup.rb +0 -93
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 492758b132e6441215e38216c105c1241ee0584dcc68d8f21e71ed8d2eaec015
|
4
|
+
data.tar.gz: 648a87f2e040b5f8eb54d844f7aff3a8dc326e70add5371df22c04c6edc2b0ea
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4a1feb6c352bffaa41d7c85d6480771587e43d6d9ea80a923e470814e9f9ff1c46313059ef0eda5690d3c818f0295b83ad315e3429e24cfad21aa7aaf755f858
|
7
|
+
data.tar.gz: 7141c9a7f54c3496c89c8bf33fda2a0a53b90dac2214bf8844850ea4538096a1f1eb22cb52d283495239b39b13b991b3a2f64651e8930c6102f05dcd09cc583d
|
data/Gemfile.lock
CHANGED
@@ -5,45 +5,20 @@ module DHLEcommerceAPI
|
|
5
5
|
self.include_format_in_path = false
|
6
6
|
self.connection_class = Connection
|
7
7
|
|
8
|
-
# by default convert to lowerCamelcase before sending request
|
9
|
-
def to_json(options = {})
|
10
|
-
attributes.as_json
|
11
|
-
.deep_transform_keys { |k| k.to_s.camelize(:lower) }
|
12
|
-
.to_json(include_root_in_json ? { root: self.class.element_name }.merge(options) : options)
|
13
|
-
end
|
14
|
-
|
15
|
-
# by default convert to snake_case when initializing
|
16
|
-
def load(attributes, remove_root = false, persisted = false)
|
17
|
-
# convert loaded attributes to underscore, then symbolize
|
18
|
-
attributes.deep_transform_keys! { |k| k.to_s.underscore.to_sym }
|
19
|
-
|
20
|
-
# merge default_attrs(symbols) with incoming attributes
|
21
|
-
if defined?(self.class::DEFAULT_ATTRIBUTES)
|
22
|
-
attributes = self.class::DEFAULT_ATTRIBUTES.merge(attributes)
|
23
|
-
end
|
24
|
-
super
|
25
|
-
end
|
26
|
-
|
27
8
|
def attributes_with_account_ids
|
28
9
|
account_ids.merge(attributes)
|
29
10
|
end
|
30
11
|
|
31
12
|
def account_ids
|
32
13
|
{
|
33
|
-
|
34
|
-
|
14
|
+
"pickupAccountId": DHLEcommerceAPI.config.pickup_account_id,
|
15
|
+
"soldToAccountId": DHLEcommerceAPI.config.sold_to_account_id,
|
35
16
|
}
|
36
17
|
end
|
37
18
|
|
38
19
|
def handle_errors(code, error_messages)
|
39
20
|
errors.add(:base, "#{code} - #{error_messages.join(", ")}")
|
40
21
|
end
|
41
|
-
|
42
|
-
# Since request_data isnt the same as object attributes.
|
43
|
-
# We have to write our own method to format the request data
|
44
|
-
def formatted_request_data(request_data)
|
45
|
-
request_data.as_json.deep_transform_keys {|key| custom_key_format(key)}
|
46
|
-
end
|
47
22
|
|
48
23
|
# custom keys that arent following lowerCamel convention
|
49
24
|
def custom_key_format(key)
|
@@ -9,7 +9,8 @@ module DHLEcommerceAPI
|
|
9
9
|
|
10
10
|
def create
|
11
11
|
run_callbacks :create do
|
12
|
-
connection.post(collection_path,
|
12
|
+
connection.post(collection_path, pickup_request.to_json, self.class.headers).tap do |response|
|
13
|
+
self.id = id_from_response(response)
|
13
14
|
load_attributes_from_response(response)
|
14
15
|
end
|
15
16
|
end
|
@@ -35,56 +36,58 @@ module DHLEcommerceAPI
|
|
35
36
|
@persisted = false
|
36
37
|
end
|
37
38
|
|
38
|
-
new_attributes = attributes.merge(
|
39
|
+
new_attributes = attributes.merge({response: JSON.parse(response.body)})
|
40
|
+
|
39
41
|
load(new_attributes, true, @persisted)
|
40
42
|
end
|
41
43
|
end
|
42
44
|
|
43
45
|
def pickup_request
|
44
46
|
{
|
45
|
-
|
46
|
-
hdr: headers,
|
47
|
-
bd: attributes_with_account_ids
|
47
|
+
"pickupRequest": {
|
48
|
+
"hdr": headers,
|
49
|
+
"bd": attributes_with_account_ids
|
48
50
|
}
|
49
51
|
}
|
50
52
|
end
|
51
53
|
|
52
54
|
def headers
|
53
55
|
{
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
56
|
+
"messageType": "PICKUP",
|
57
|
+
"messageDateTime": DateTime.now.to_s,
|
58
|
+
"accessToken": DHLEcommerceAPI::Authentication.get_token,
|
59
|
+
"messageVersion": "1.2"
|
58
60
|
}
|
59
61
|
end
|
60
62
|
end
|
61
63
|
end
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
64
|
+
=begin
|
65
|
+
pickup_params = {
|
66
|
+
"handoverItems": [
|
67
|
+
{
|
68
|
+
"pickupDate": "2022-03-17",
|
69
|
+
"pickupStartTime": "09:00",
|
70
|
+
"pickupEndTime": "18:00",
|
71
|
+
"shipmentType": "1",
|
72
|
+
"notificationEmail": nil,
|
73
|
+
"shipperDetails": {
|
74
|
+
"company": "PostCo",
|
75
|
+
"name": "PostCo",
|
76
|
+
"emailID": nil,
|
77
|
+
"phoneNumber": "0169822645",
|
78
|
+
"addressLine1": "no 26 jalan 31/123, petaling jaya",
|
79
|
+
"addressLine2": nil,
|
80
|
+
"addressLine3": nil,
|
81
|
+
"city": "Kuala Lumpur",
|
82
|
+
"state": "Kuala Lumpur",
|
83
|
+
"postalCode": "57000",
|
84
|
+
"country": "MY",
|
85
|
+
},
|
86
|
+
"shipments": {
|
87
|
+
"quantity": 1,
|
88
|
+
"totalWeight": 100
|
89
|
+
}
|
90
|
+
}
|
91
|
+
]
|
92
|
+
}
|
93
|
+
=end
|
@@ -5,13 +5,11 @@ module DHLEcommerceAPI
|
|
5
5
|
|
6
6
|
self.prefix = "/rest/v3/Shipment"
|
7
7
|
self.element_name = ""
|
8
|
-
|
9
|
-
validates_presence_of :handover_method
|
10
8
|
|
11
9
|
def create
|
12
10
|
run_callbacks :create do
|
13
|
-
|
14
|
-
|
11
|
+
connection.post(collection_path, manifest_request.to_json, self.class.headers).tap do |response|
|
12
|
+
self.id = id_from_response(response)
|
15
13
|
load_attributes_from_response(response)
|
16
14
|
end
|
17
15
|
end
|
@@ -37,82 +35,112 @@ module DHLEcommerceAPI
|
|
37
35
|
@persisted = false
|
38
36
|
end
|
39
37
|
|
40
|
-
new_attributes = attributes.merge(
|
38
|
+
new_attributes = attributes.merge({response: JSON.parse(response.body)})
|
39
|
+
|
41
40
|
load(new_attributes, true, @persisted)
|
42
41
|
end
|
43
42
|
end
|
44
43
|
|
45
44
|
def manifest_request
|
46
45
|
{
|
47
|
-
|
48
|
-
hdr: headers,
|
49
|
-
bd: attributes_with_account_ids
|
46
|
+
"manifestRequest": {
|
47
|
+
"hdr": headers,
|
48
|
+
"bd": attributes_with_account_ids
|
50
49
|
}
|
51
50
|
}
|
52
51
|
end
|
53
52
|
|
54
53
|
def headers
|
55
54
|
{
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
55
|
+
"messageType": "SHIPMENT",
|
56
|
+
"messageDateTime": DateTime.now.to_s,
|
57
|
+
"accessToken": DHLEcommerceAPI::Authentication.get_token,
|
58
|
+
"messageVersion": "1.0"
|
60
59
|
}
|
61
60
|
end
|
62
61
|
end
|
63
62
|
end
|
64
63
|
|
65
64
|
# Examples:
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
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
|
-
|
65
|
+
=begin
|
66
|
+
shipment_with_pickup_params = {
|
67
|
+
"handoverMethod": 2,
|
68
|
+
"pickupDateTime": DateTime.now.to_s,
|
69
|
+
"pickupAddress": {
|
70
|
+
"companyName": "Pickup From Company",
|
71
|
+
"name": "Pickup From Name",
|
72
|
+
"address1": "Holistic Pharmacy PostCo, 55, Jalan Landak",
|
73
|
+
"address2": "",
|
74
|
+
"address3": "",
|
75
|
+
"city": " Kuala Lumpur",
|
76
|
+
"state": " Kuala Lumpur",
|
77
|
+
"postCode": "55100",
|
78
|
+
"country": "MY",
|
79
|
+
"phone": "0123456789",
|
80
|
+
"email": "hello@example.com"
|
81
|
+
},
|
82
|
+
"shipperAddress": {
|
83
|
+
"companyName": "Pickup From Company",
|
84
|
+
"name": "Pickup From Name",
|
85
|
+
"address1": "Holistic Pharmacy PostCo, 55, Jalan Landak",
|
86
|
+
"address2": "",
|
87
|
+
"address3": "",
|
88
|
+
"city": " Kuala Lumpur",
|
89
|
+
"state": " Kuala Lumpur",
|
90
|
+
"postCode": "55100",
|
91
|
+
"country": "MY",
|
92
|
+
"phone": "0123456789",
|
93
|
+
"email": "hello@example.com"
|
94
|
+
},
|
95
|
+
"shipmentItems": [
|
96
|
+
{
|
97
|
+
"shipmentID": "MYPTC0083",
|
98
|
+
"packageDesc": "Laptop Sleeve",
|
99
|
+
"totalWeight": 500,
|
100
|
+
"totalWeightUOM": "G",
|
101
|
+
"dimensionUOM": "CM",
|
102
|
+
"height": nil,
|
103
|
+
"length": nil,
|
104
|
+
"width": nil,
|
105
|
+
"productCode": "PDO",
|
106
|
+
"codValue": nil,
|
107
|
+
"insuranceValue": nil,
|
108
|
+
"totalValue": 300,
|
109
|
+
"currency": "MYR",
|
110
|
+
"remarks": nil,
|
111
|
+
"isRoutingInfoRequired": "Y",
|
112
|
+
"consigneeAddress": {
|
113
|
+
"companyName": "Sleeve Company",
|
114
|
+
"name": "Sleeve Sdn Bhd",
|
115
|
+
"address1": "No. 3, Jalan Bangsar, Kampung Haji Abdullah Hukum",
|
116
|
+
"address2": nil,
|
117
|
+
"address3": nil,
|
118
|
+
"city": "Kuala Lumpur",
|
119
|
+
"state": "Kuala Lumpur",
|
120
|
+
"district": nil,
|
121
|
+
"country": "MY",
|
122
|
+
"postCode": "59200",
|
123
|
+
"phone": "0169822645",
|
124
|
+
"email": nil
|
125
|
+
},
|
126
|
+
"returnMode": "03",
|
127
|
+
"returnAddress": {
|
128
|
+
"companyName": "Pickup From Company",
|
129
|
+
"name": "Pickup From Name",
|
130
|
+
"address1": "Holistic Pharmacy PostCo, 55, Jalan Landak",
|
131
|
+
"address2": "",
|
132
|
+
"address3": "",
|
133
|
+
"city": " Kuala Lumpur",
|
134
|
+
"state": " Kuala Lumpur",
|
135
|
+
"postCode": "55100",
|
136
|
+
"country": "MY",
|
137
|
+
"phone": "0123456789",
|
138
|
+
"email": "hello@example.com"
|
139
|
+
}
|
140
|
+
},
|
141
|
+
]
|
142
|
+
}
|
143
|
+
=end
|
116
144
|
|
117
145
|
# shipment_with_dropoff_params = {
|
118
146
|
# "handover_method" => 1,
|
@@ -1,12 +1,5 @@
|
|
1
1
|
module DHLEcommerceAPI
|
2
2
|
class Tracking < Base
|
3
|
-
# example_tracking_params = {
|
4
|
-
# "e_pod_required": "Y",
|
5
|
-
# "trackingReferenceNumber": [
|
6
|
-
# "MYPTC00012", "MYPTC00013"
|
7
|
-
# ]
|
8
|
-
# }
|
9
|
-
|
10
3
|
self.prefix = "/rest/v3/Tracking"
|
11
4
|
self.element_name = ""
|
12
5
|
|
@@ -17,16 +10,17 @@ module DHLEcommerceAPI
|
|
17
10
|
|
18
11
|
def self.find(arguments)
|
19
12
|
tracking = self.new({
|
20
|
-
|
21
|
-
|
13
|
+
"ePODRequired": "Y",
|
14
|
+
"trackingReferenceNumber": arguments.is_a?(Array) ? arguments : [arguments]
|
22
15
|
})
|
23
16
|
tracking.save
|
17
|
+
|
24
18
|
return tracking.shipment_items.presence || []
|
25
19
|
end
|
26
20
|
|
27
21
|
def create
|
28
22
|
run_callbacks :create do
|
29
|
-
connection.post(collection_path,
|
23
|
+
connection.post(collection_path, request_data.to_json, self.class.headers).tap do |response|
|
30
24
|
load_attributes_from_response(response)
|
31
25
|
end
|
32
26
|
end
|
@@ -52,37 +46,38 @@ module DHLEcommerceAPI
|
|
52
46
|
@persisted = false
|
53
47
|
end
|
54
48
|
|
55
|
-
new_attributes = attributes.merge(
|
49
|
+
new_attributes = attributes.merge({response: JSON.parse(response.body)})
|
50
|
+
new_attributes = new_attributes.merge({shipment_items: bd["shipmentItems"]})
|
51
|
+
|
56
52
|
load(new_attributes, true, @persisted)
|
57
53
|
end
|
58
54
|
end
|
59
55
|
|
60
56
|
def request_data
|
61
57
|
{
|
62
|
-
|
63
|
-
hdr: headers,
|
64
|
-
bd: attributes.except("response_status") # dont send responseStatus
|
58
|
+
"trackItemRequest": {
|
59
|
+
"hdr": headers,
|
60
|
+
"bd": attributes.except("response_status") # dont send responseStatus
|
65
61
|
}
|
66
62
|
}
|
67
63
|
end
|
68
64
|
|
69
65
|
def headers
|
70
66
|
{
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
67
|
+
"messageType": "TRACKITEM",
|
68
|
+
"messageDateTime": DateTime.now.to_s,
|
69
|
+
"accessToken": DHLEcommerceAPI::Authentication.get_token,
|
70
|
+
"messageVersion": "1.0"
|
75
71
|
}
|
76
72
|
end
|
77
|
-
|
78
|
-
|
79
|
-
# Since request_data isnt the same as object attributes.
|
80
|
-
# We have to write our own method to format the request data
|
81
|
-
def formatted_request_data(request_data)
|
82
|
-
request_data.as_json
|
83
|
-
.deep_transform_keys do |key|
|
84
|
-
custom_key_format(key) # method from Base
|
85
|
-
end.to_json
|
86
|
-
end
|
87
73
|
end
|
88
|
-
end
|
74
|
+
end
|
75
|
+
|
76
|
+
=begin
|
77
|
+
example_tracking_params = {
|
78
|
+
"ePODRequired": "Y",
|
79
|
+
"trackingReferenceNumber": [
|
80
|
+
"MYPTC00012", "MYPTC00013"
|
81
|
+
]
|
82
|
+
}
|
83
|
+
=end
|
data/lib/dhl_ecommerce_api.rb
CHANGED
@@ -9,16 +9,10 @@ module DHLEcommerceAPI
|
|
9
9
|
require "dhl_ecommerce_api/connection"
|
10
10
|
|
11
11
|
require "dhl_ecommerce_api/resources/base"
|
12
|
+
|
12
13
|
require "dhl_ecommerce_api/resources/authentication"
|
13
14
|
|
14
|
-
require "dhl_ecommerce_api/resources/shipment"
|
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"
|
20
|
-
|
15
|
+
require "dhl_ecommerce_api/resources/shipment"
|
21
16
|
require "dhl_ecommerce_api/resources/pickup"
|
22
|
-
|
23
17
|
require "dhl_ecommerce_api/resources/tracking"
|
24
18
|
end
|
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.14
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Er Whey
|
@@ -140,12 +140,7 @@ files:
|
|
140
140
|
- lib/dhl_ecommerce_api/resources/base.rb
|
141
141
|
- lib/dhl_ecommerce_api/resources/event.rb
|
142
142
|
- lib/dhl_ecommerce_api/resources/pickup.rb
|
143
|
-
- lib/dhl_ecommerce_api/resources/pickup/handover_item.rb
|
144
143
|
- lib/dhl_ecommerce_api/resources/shipment.rb
|
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
|
149
144
|
- lib/dhl_ecommerce_api/resources/tracking.rb
|
150
145
|
- lib/dhl_ecommerce_api/version.rb
|
151
146
|
- sig/dhl_ecommerce_api.rbs
|
@@ -1,12 +0,0 @@
|
|
1
|
-
module DHLEcommerceAPI
|
2
|
-
class Pickup::HandoverItem < Base
|
3
|
-
def initialize(attributes = {}, persisted = false)
|
4
|
-
status = attributes["response_status"]
|
5
|
-
if status.present? && status["code"] != "200"
|
6
|
-
error_messages = status["message_details"].map{|err| err["message_detail"]}
|
7
|
-
handle_errors(status["code"], error_messages)
|
8
|
-
end
|
9
|
-
super
|
10
|
-
end
|
11
|
-
end
|
12
|
-
end
|
@@ -1,48 +0,0 @@
|
|
1
|
-
module DHLEcommerceAPI
|
2
|
-
# Component item
|
3
|
-
class Shipment::ShipmentItem < Base
|
4
|
-
self.element_name = ""
|
5
|
-
|
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
|
-
}
|
38
|
-
|
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
|
@@ -1,52 +0,0 @@
|
|
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,93 +0,0 @@
|
|
1
|
-
module DHLEcommerceAPI
|
2
|
-
class ShipmentWithPickup < Shipment
|
3
|
-
# This is a coupled shipment + pickup request.
|
4
|
-
|
5
|
-
self.element_name = ""
|
6
|
-
|
7
|
-
DEFAULT_ATTRIBUTES = {
|
8
|
-
handover_method: 2,
|
9
|
-
pickup_date_time: nil,
|
10
|
-
pickup_address: {
|
11
|
-
company_name: "",
|
12
|
-
name: "",
|
13
|
-
address1: "",
|
14
|
-
address2: nil,
|
15
|
-
address3: nil,
|
16
|
-
city: "",
|
17
|
-
state: "",
|
18
|
-
post_code: "",
|
19
|
-
country: "MY",
|
20
|
-
phone: "",
|
21
|
-
email: nil
|
22
|
-
},
|
23
|
-
shipment_items: []
|
24
|
-
}
|
25
|
-
end
|
26
|
-
end
|
27
|
-
|
28
|
-
=begin
|
29
|
-
params = {
|
30
|
-
"handoverMethod": 2,
|
31
|
-
"pickupDateTime": DateTime.now.to_s,
|
32
|
-
"pickupAddress": {
|
33
|
-
"companyName": "Pickup From Company",
|
34
|
-
"name": "Pickup From Name",
|
35
|
-
"address1": "Holistic Pharmacy PostCo, 55, Jalan Landak",
|
36
|
-
"address2": "",
|
37
|
-
"address3": "",
|
38
|
-
"city": " Kuala Lumpur",
|
39
|
-
"state": " Kuala Lumpur",
|
40
|
-
"postCode": "55100",
|
41
|
-
"country": "MY",
|
42
|
-
"phone": "0169822645",
|
43
|
-
"email": "erwhey@postco.co"
|
44
|
-
},
|
45
|
-
"shipmentItems": [
|
46
|
-
{
|
47
|
-
"shipmentID": "MYPTC0087",
|
48
|
-
"packageDesc": "Laptop Sleeve",
|
49
|
-
"totalWeight": 500,
|
50
|
-
"totalWeightUOM": "G",
|
51
|
-
"dimensionUOM": "CM",
|
52
|
-
"height": nil,
|
53
|
-
"length": nil,
|
54
|
-
"width": nil,
|
55
|
-
"productCode": "PDO",
|
56
|
-
"codValue": nil,
|
57
|
-
"insuranceValue": nil,
|
58
|
-
"totalValue": 300,
|
59
|
-
"currency": "MYR",
|
60
|
-
"remarks": nil,
|
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
|
-
},
|
76
|
-
"consigneeAddress": {
|
77
|
-
"companyName": "Sleeve Company",
|
78
|
-
"name": "Sleeve Sdn Bhd",
|
79
|
-
"address1": "No. 3, Jalan Bangsar, Kampung Haji Abdullah Hukum",
|
80
|
-
"address2": nil,
|
81
|
-
"address3": nil,
|
82
|
-
"city": "Kuala Lumpur",
|
83
|
-
"state": "Kuala Lumpur",
|
84
|
-
"district": nil,
|
85
|
-
"country": "MY",
|
86
|
-
"postCode": "59200",
|
87
|
-
"phone": "0169822645",
|
88
|
-
"email": nil
|
89
|
-
}
|
90
|
-
},
|
91
|
-
]
|
92
|
-
}.deep_transform_keys!{ |key| key.to_s.underscore }
|
93
|
-
=end
|