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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 894fe3942cd1b2e5e908d8e0a4a644e47ad32339d35947b9e320663fab0e8332
4
- data.tar.gz: 48c07a18b59aad9a537b1b7e54395e8dda48c70cf547eec800a28577db0e5774
3
+ metadata.gz: 492758b132e6441215e38216c105c1241ee0584dcc68d8f21e71ed8d2eaec015
4
+ data.tar.gz: 648a87f2e040b5f8eb54d844f7aff3a8dc326e70add5371df22c04c6edc2b0ea
5
5
  SHA512:
6
- metadata.gz: edeaad255cdebe539487991812a8a3017f94a1f5300e2a2a939016387b6e360fc17e5c3f47baa1e7f9edc9dbe453d0a7b0f58d2fe766bae5fe3372cf521e900a
7
- data.tar.gz: 44f21615352723faff79ec7cfe2adfdd31fc6f11fc7e12f9381f1f88cfcfdaa229ff3d477f15e0d044eafcaab18838d727bbc2e484a06a4a5b0d4dd3e510c6a4
6
+ metadata.gz: 4a1feb6c352bffaa41d7c85d6480771587e43d6d9ea80a923e470814e9f9ff1c46313059ef0eda5690d3c818f0295b83ad315e3429e24cfad21aa7aaf755f858
7
+ data.tar.gz: 7141c9a7f54c3496c89c8bf33fda2a0a53b90dac2214bf8844850ea4538096a1f1eb22cb52d283495239b39b13b991b3a2f64651e8930c6102f05dcd09cc583d
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- dhl_ecommerce_api (0.1.7)
4
+ dhl_ecommerce_api (0.1.13)
5
5
  activeresource (>= 4.1.0, < 6.0.0)
6
6
 
7
7
  GEM
@@ -5,7 +5,6 @@ module DHLEcommerceAPI
5
5
  payload[:method] = method
6
6
  payload[:request_uri] = "#{site.scheme}://#{site.host}:#{site.port}#{path}"
7
7
  payload[:result] = http.send(method, path, *arguments)
8
- # debug outgoing request here if needed
9
8
  end
10
9
 
11
10
  handle_response(result)
@@ -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
- pickup_account_id: DHLEcommerceAPI.config.pickup_account_id,
34
- sold_to_account_id: DHLEcommerceAPI.config.sold_to_account_id,
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, formatted_request_data(pickup_request), self.class.headers).tap do |response|
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(bd)
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
- pickup_request: {
46
- hdr: headers,
47
- bd: attributes_with_account_ids.deep_transform_keys {|key| key.to_s.underscore.to_sym }
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
- message_type: "PICKUP",
55
- message_date_time: DateTime.now.to_s,
56
- access_token: DHLEcommerceAPI::Authentication.get_token,
57
- message_version: "1.2"
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
- # example_pickup_params = {
64
- # "handover_items": [
65
- # {
66
- # "pickup_date": "2022-03-09",
67
- # "pickup_start_time": "09:00",
68
- # "pickup_end_time": "18:00",
69
- # "shipment_type": "1",
70
- # "notification_email": nil,
71
- # "shipper_details": {
72
- # "company": "PostCo",
73
- # "name": "PostCo",
74
- # "email_id": nil,
75
- # "phone_number": "0169822645",
76
- # "address_line_1": "no 26 jalan 31/123, petaling jaya",
77
- # "address_line_2": nil,
78
- # "address_line_3": nil,
79
- # "city": "Kuala Lumpur",
80
- # "state": "Kuala Lumpur",
81
- # "postal_code": "57000",
82
- # "country": "MY",
83
- # },
84
- # "shipments": {
85
- # "quantity": 1,
86
- # "totalWeight": 100
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
- data = formatted_request_data(manifest_request).deep_transform_keys{|key| custom_key_format(key)}
14
- connection.post(collection_path, data.to_json, self.class.headers).tap do |response|
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(bd)
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
- manifest_request: {
48
- hdr: headers,
49
- bd: attributes_with_account_ids.deep_transform_keys {|key| key.to_s.underscore.to_sym }
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
- message_type: "SHIPMENT",
57
- message_date_time: DateTime.now.to_s,
58
- access_token: DHLEcommerceAPI::Authentication.get_token,
59
- message_version: "1.0"
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
- # 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
- # "shipmentItems": [
83
- # {
84
- # "shipmentID": "MYPTC0083",
85
- # "packageDesc": "Laptop Sleeve",
86
- # "totalWeight": 500,
87
- # "totalWeightUOM": "G",
88
- # "dimensionUOM": "CM",
89
- # "height": nil,
90
- # "length": nil,
91
- # "width": nil,
92
- # "productCode": "PDO",
93
- # "codValue": nil,
94
- # "insuranceValue": nil,
95
- # "totalValue": 300,
96
- # "currency": "MYR",
97
- # "remarks": nil,
98
- # "isRoutingInfoRequired": "Y",
99
- # "consigneeAddress": {
100
- # "companyName": "Sleeve Company",
101
- # "name": "Sleeve Sdn Bhd",
102
- # "address1": "No. 3, Jalan Bangsar, Kampung Haji Abdullah Hukum",
103
- # "address2": nil,
104
- # "address3": nil,
105
- # "city": "Kuala Lumpur",
106
- # "state": "Kuala Lumpur",
107
- # "district": nil,
108
- # "country": "MY",
109
- # "postCode": "59200",
110
- # "phone": "0169822645",
111
- # "email": nil
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
- e_pod_required: "Y",
21
- tracking_reference_number: arguments.is_a?(Array) ? arguments : [arguments]
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, formatted_request_data(request_data), self.class.headers).tap do |response|
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(bd)
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
- track_item_request: {
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
- message_type: "TRACKITEM",
72
- message_date_time: DateTime.now.to_s,
73
- access_token: DHLEcommerceAPI::Authentication.get_token,
74
- message_version: "1.0"
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
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module DHLEcommerceAPI
4
- VERSION = "0.1.13"
4
+ VERSION = "0.1.14"
5
5
  end
@@ -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.13
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,6 +0,0 @@
1
- module DHLEcommerceAPI
2
- # Component item
3
- class Shipment::ShipmentItem::ConsigneeAddress < Base
4
- self.element_name = ""
5
- end
6
- 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