dhl_ecommerce_api 0.1.6 → 0.1.9

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: 3c46dd0f19e8135cece977f02bf78ea9f93e9d174977f5f70588001c76f81973
4
- data.tar.gz: eb69521ee70c73cf460cacb743fc2e31cb9e957e5acc94d81af9c016b20781ba
3
+ metadata.gz: 571e37c9ef69611b1303b950b5ff333d61602131078074680bc92b48ebdfd29a
4
+ data.tar.gz: 8810514c60c15cf4e1fca79e9d619ff19df7932dfb313c195c0e9d66d77a80ee
5
5
  SHA512:
6
- metadata.gz: 9f3828dfd64123a9992d4b89b1cc3494dfefaf8792e885bae497a881d44981a4aa1f3343b7f3a66c48f6d4f45fba429e37c19304e7e8c82c30abab510ad480e8
7
- data.tar.gz: 52f6fa06f6ae6b416b05ec1daebb2d6a1ed3219e33089c8a48dc32bc54083f5b17ba337bfc18206b3c0b501fd898a5e89dda92b985c152ff881c41675fa67b03
6
+ metadata.gz: '080882853eae5f18c8c63e3891be5cd3d77560156b687a26240e6101ce925e1354076b128388bdc271ae4784056d2289d530ed765ba19b3b179f6d9538a7e59b'
7
+ data.tar.gz: 74a83c87ac5302cfb1ee1362ceda51bbbff51338042d777cf2a69a911871fc406e96b19a39e52a8c5d8c6d8070bc5840b32fff10caa35b299750183995a8af4a
data/.tool-versions ADDED
@@ -0,0 +1 @@
1
+ ruby 2.5.8
data/Gemfile.lock CHANGED
@@ -1,14 +1,14 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- dhl_ecommerce_api (0.1.4)
4
+ dhl_ecommerce_api (0.1.8)
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.4.6)
11
- activesupport (= 6.1.4.6)
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.4.6)
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)
@@ -64,7 +64,7 @@ GEM
64
64
  nenv (~> 0.1)
65
65
  shellany (~> 0.0)
66
66
  parallel (1.21.0)
67
- parser (3.1.0.0)
67
+ parser (3.1.1.0)
68
68
  ast (~> 2.4.1)
69
69
  pry (0.14.1)
70
70
  coderay (~> 1.1)
@@ -90,25 +90,21 @@ GEM
90
90
  diff-lcs (>= 1.2.0, < 2.0)
91
91
  rspec-support (~> 3.11.0)
92
92
  rspec-support (3.11.0)
93
- rubocop (1.25.1)
93
+ rubocop (1.26.0)
94
94
  parallel (~> 1.10)
95
95
  parser (>= 3.1.0.0)
96
96
  rainbow (>= 2.2.2, < 4.0)
97
97
  regexp_parser (>= 1.8, < 3.0)
98
98
  rexml
99
- rubocop-ast (>= 1.15.1, < 2.0)
99
+ rubocop-ast (>= 1.16.0, < 2.0)
100
100
  ruby-progressbar (~> 1.7)
101
101
  unicode-display_width (>= 1.4.0, < 3.0)
102
- rubocop-ast (1.15.2)
103
- parser (>= 3.0.1.1)
104
- rubocop-performance (1.13.2)
105
- rubocop (>= 1.7.0, < 2.0)
106
- rubocop-ast (>= 0.4.0)
102
+ rubocop-ast (1.16.0)
103
+ parser (>= 3.1.1.0)
107
104
  ruby-progressbar (1.11.0)
108
105
  shellany (0.0.1)
109
- standard (1.7.2)
110
- rubocop (= 1.25.1)
111
- rubocop-performance (= 1.13.2)
106
+ standard (0.0.36)
107
+ rubocop (>= 0.63)
112
108
  thor (1.2.1)
113
109
  tzinfo (2.0.4)
114
110
  concurrent-ruby (~> 1.0)
@@ -120,7 +116,7 @@ GEM
120
116
  zeitwerk (2.5.4)
121
117
 
122
118
  PLATFORMS
123
- arm64-darwin-21
119
+ -darwin-21
124
120
 
125
121
  DEPENDENCIES
126
122
  dhl_ecommerce_api!
@@ -5,18 +5,11 @@ 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
8
  # by default convert to snake_case when initializing
16
9
  def load(attributes, remove_root = false, persisted = false)
17
10
  # convert loaded attributes to underscore, then symbolize
18
11
  attributes.deep_transform_keys! { |k| k.to_s.underscore.to_sym }
19
-
12
+
20
13
  # merge default_attrs(symbols) with incoming attributes
21
14
  if defined?(self.class::DEFAULT_ATTRIBUTES)
22
15
  attributes = self.class::DEFAULT_ATTRIBUTES.merge(attributes)
@@ -24,7 +17,6 @@ module DHLEcommerceAPI
24
17
  super
25
18
  end
26
19
 
27
-
28
20
  def attributes_with_account_ids
29
21
  account_ids.merge(attributes)
30
22
  end
@@ -44,7 +36,7 @@ module DHLEcommerceAPI
44
36
  # We have to write our own method to format the request data
45
37
  def formatted_request_data(request_data)
46
38
  request_data.as_json
47
- .deep_transform_keys {|key| custom_key_format(key)}.to_json
39
+ .deep_transform_keys {|key| custom_key_format(key)}
48
40
  end
49
41
 
50
42
  # custom keys that arent following lowerCamel convention
@@ -76,5 +68,13 @@ module DHLEcommerceAPI
76
68
  key.to_s.camelize(:lower)
77
69
  end
78
70
  end
71
+
72
+ # catchall overwrite default to_json method for anything that inherits from Base.
73
+ # Not used by anything so far.
74
+ def to_json(options = {})
75
+ attributes.as_json
76
+ .deep_transform_keys { |k| custom_key_format(k) }
77
+ .to_json(include_root_in_json ? { root: self.class.element_name }.merge(options) : options)
78
+ end
79
79
  end
80
80
  end
@@ -18,7 +18,6 @@ module DHLEcommerceAPI
18
18
  end
19
19
 
20
20
  def status_slug
21
- binding.pry
22
21
  STATUS_CODES[status.to_sym]
23
22
  end
24
23
  end
@@ -1,52 +1,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
- # }
1
+ module DHLEcommerceAPI
2
+ # Component item
3
+ class Shipment::ShipmentItem < Base
4
+ self.element_name = ""
36
5
 
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
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
+ }
45
25
 
46
- # def to_json(options = {})
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
26
+ def initialize(attributes = {}, persisted = false)
27
+ status = attributes["response_status"]
28
+ if status.present? && status["code"] != "200"
29
+ error_messages = status["message_details"].map{|err| err["message_detail"]}
30
+ handle_errors(status["code"], error_messages)
31
+ end
32
+ super
33
+ end
34
+ end
35
+ end
@@ -46,7 +46,7 @@ module DHLEcommerceAPI
46
46
  {
47
47
  manifest_request: {
48
48
  hdr: headers,
49
- bd: attributes_with_account_ids.deep_transform_keys {|key| key.to_s.underscore.to_sym }
49
+ bd: attributes_with_account_ids
50
50
  }
51
51
  }
52
52
  end
@@ -61,10 +61,126 @@ module DHLEcommerceAPI
61
61
  end
62
62
  end
63
63
  end
64
-
64
+ =begin
65
65
  # Examples:
66
+ shipment_with_pickup_params = {
67
+ "handoverMethod": 2,
68
+ "shipperAddress": {
69
+ "companyName": "Pickup From Company",
70
+ "name": "Pickup From Name",
71
+ "address1": "Holistic Pharmacy PostCo, 55, Jalan Landak",
72
+ "address2": "",
73
+ "address3": "",
74
+ "city": " Kuala Lumpur",
75
+ "state": " Kuala Lumpur",
76
+ "postCode": "55100",
77
+ "country": "MY",
78
+ "phone": "0123456789",
79
+ "email": "hello@example.com"
80
+ },
81
+ "pickupDateTime": DateTime.now.to_s,
82
+ "pickupAddress": {
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": "MYPTC0085",
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
+ },
127
+ ]
128
+ }.deep_transform_keys {|key| key.to_s.underscore }
129
+
130
+ shipment_with_dropoff_params = {
131
+ "handover_method" => 1,
132
+ "shipment_items" => [
133
+ {
134
+ "consignee_address" => {
135
+ "company_name" => "Test",
136
+ "name" => "Test1",
137
+ "address1" => "NO 3 JALAN PPU 1",
138
+ "address2" => "TAMAN PERINDUSTRIAN PUCHONG UTAMA",
139
+ "address3" => nil,
140
+ "city" => "PUCHONG",
141
+ "state" => "SELANGOR",
142
+ "district" => nil,
143
+ "country" => "MY",
144
+ "post_code" => "57000",
145
+ "phone" => "0123456798",
146
+ "email" => nil
147
+ },
148
+ "shipment_id" => "MYPTC000102",
149
+ "package_desc" => "Bread Materials",
150
+ "total_weight" => 2000,
151
+ "total_weight_uom" => "G",
152
+ "dimension_uom" => "CM",
153
+ "height" => nil,
154
+ "length" => nil,
155
+ "width" => nil,
156
+ "product_code" => "PDO",
157
+ "cod_value" => nil,
158
+ "insurance_value" => nil,
159
+ "total_value" => 300,
160
+ "currency" => "MYR",
161
+ "remarks" => nil,
162
+ "is_routing_info_required" => "Y"
163
+ }
164
+ ],
165
+ }
166
+ =end
167
+
168
+
66
169
  # shipment_with_pickup_params = {
67
170
  # "handoverMethod": 2,
171
+ # "shipperAddress": {
172
+ # "companyName": "Pickup From Company",
173
+ # "name": "Pickup From Name",
174
+ # "address1": "Holistic Pharmacy PostCo, 55, Jalan Landak",
175
+ # "address2": "",
176
+ # "address3": "",
177
+ # "city": " Kuala Lumpur",
178
+ # "state": " Kuala Lumpur",
179
+ # "postCode": "55100",
180
+ # "country": "MY",
181
+ # "phone": "0123456789",
182
+ # "email": "hello@example.com"
183
+ # },
68
184
  # "pickupDateTime": DateTime.now.to_s,
69
185
  # "pickupAddress": {
70
186
  # "companyName": "Pickup From Company",
@@ -81,7 +197,7 @@ end
81
197
  # },
82
198
  # "shipmentItems": [
83
199
  # {
84
- # "shipmentID": "MYPTC0083",
200
+ # "shipmentID": "MYPTC0085",
85
201
  # "packageDesc": "Laptop Sleeve",
86
202
  # "totalWeight": 500,
87
203
  # "totalWeightUOM": "G",
@@ -112,41 +228,4 @@ end
112
228
  # }
113
229
  # },
114
230
  # ]
115
- # }
116
-
117
- # shipment_with_dropoff_params = {
118
- # "handover_method" => 1,
119
- # "shipment_items" => [
120
- # {
121
- # "consignee_address" => {
122
- # "company_name" => "Test",
123
- # "name" => "Test1",
124
- # "address1" => "NO 3 JALAN PPU 1",
125
- # "address2" => "TAMAN PERINDUSTRIAN PUCHONG UTAMA",
126
- # "address3" => nil,
127
- # "city" => "PUCHONG",
128
- # "state" => "SELANGOR",
129
- # "district" => nil,
130
- # "country" => "MY",
131
- # "post_code" => "57000",
132
- # "phone" => "0123456798",
133
- # "email" => nil
134
- # },
135
- # "shipment_id" => "MYPTC000102",
136
- # "package_desc" => "Bread Materials",
137
- # "total_weight" => 2000,
138
- # "total_weight_uom" => "G",
139
- # "dimension_uom" => "CM",
140
- # "height" => nil,
141
- # "length" => nil,
142
- # "width" => nil,
143
- # "product_code" => "PDO",
144
- # "cod_value" => nil,
145
- # "insurance_value" => nil,
146
- # "total_value" => 300,
147
- # "currency" => "MYR",
148
- # "remarks" => nil,
149
- # "is_routing_info_required" => "Y"
150
- # }
151
- # ],
152
- # }
231
+ # }
@@ -0,0 +1,157 @@
1
+ module DHLEcommerceAPI
2
+ class ShipmentTest < ActiveResource::Base
3
+ self.include_format_in_path = false
4
+ self.site = "https://sandbox.dhlecommerce.asia"
5
+ self.prefix = "/rest/v3/Shipment"
6
+ self.element_name = ""
7
+
8
+ def to_json(options = {})
9
+ attributes.as_json
10
+ .deep_transform_keys { |k| custom_key_format(k) }
11
+ .to_json(include_root_in_json ? { root: self.class.element_name }.merge(options) : options)
12
+ end
13
+
14
+ def custom_key_format(key)
15
+ case key
16
+ when "shipment_id"
17
+ "shipmentID"
18
+ when "total_weight_uom"
19
+ "totalWeightUOM"
20
+ when "dimension_uom"
21
+ "dimensionUOM"
22
+ when "order_url"
23
+ "orderURL"
24
+ when "location_id"
25
+ "locationID"
26
+ when "piece_id"
27
+ "pieceID"
28
+ when "weight_uom"
29
+ "weightUOM"
30
+ when "marketplace_url"
31
+ "marketplaceURL"
32
+ when "handover_id"
33
+ "handoverID"
34
+ when "email_id"
35
+ "emailID"
36
+ when "e_pod_required"
37
+ "ePODRequired"
38
+ else
39
+ key.to_s.camelize(:lower)
40
+ end
41
+ end
42
+ end
43
+ end
44
+
45
+ =begin
46
+ def format_data(data)
47
+ data.as_json.deep_transform_keys {|key| custom_key_format(key)}
48
+ end
49
+
50
+ def custom_key_format(key)
51
+ case key
52
+ when "shipment_id"
53
+ "shipmentID"
54
+ when "total_weight_uom"
55
+ "totalWeightUOM"
56
+ when "dimension_uom"
57
+ "dimensionUOM"
58
+ when "order_url"
59
+ "orderURL"
60
+ when "location_id"
61
+ "locationID"
62
+ when "piece_id"
63
+ "pieceID"
64
+ when "weight_uom"
65
+ "weightUOM"
66
+ when "marketplace_url"
67
+ "marketplaceURL"
68
+ when "handover_id"
69
+ "handoverID"
70
+ when "email_id"
71
+ "emailID"
72
+ when "e_pod_required"
73
+ "ePODRequired"
74
+ else
75
+ key.to_s.camelize(:lower)
76
+ end
77
+ end
78
+
79
+ params = {
80
+ "manifestRequest": {
81
+ "hdr": {
82
+ "message_type": "SHIPMENT",
83
+ "message_date_time": DateTime.now.to_s,
84
+ "access_token": DHLEcommerceAPI::Authentication.get_token,
85
+ "message_version": "1.0"
86
+ },
87
+ "bd": {
88
+ "pickup_account_id": DHLEcommerceAPI.config.pickup_account_id,
89
+ "sold_to_account_id": DHLEcommerceAPI.config.sold_to_account_id,
90
+ "handoverMethod": 2,
91
+ "shipperAddress": {
92
+ "companyName": "Pickup From Company",
93
+ "name": "Pickup From Name",
94
+ "address1": "Holistic Pharmacy PostCo, 55, Jalan Landak",
95
+ "address2": "",
96
+ "address3": "",
97
+ "city": " Kuala Lumpur",
98
+ "state": " Kuala Lumpur",
99
+ "postCode": "55100",
100
+ "country": "MY",
101
+ "phone": "0123456789",
102
+ "email": "hello@example.com"
103
+ },
104
+ "pickupDateTime": DateTime.now.to_s,
105
+ "pickupAddress": {
106
+ "companyName": "Pickup From Company",
107
+ "name": "Pickup From Name",
108
+ "address1": "Holistic Pharmacy PostCo, 55, Jalan Landak",
109
+ "address2": "",
110
+ "address3": "",
111
+ "city": " Kuala Lumpur",
112
+ "state": " Kuala Lumpur",
113
+ "postCode": "55100",
114
+ "country": "MY",
115
+ "phone": "0123456789",
116
+ "email": "hello@example.com"
117
+ },
118
+ "shipmentItems": [
119
+ {
120
+ "shipmentID": "MYPTC0085",
121
+ "packageDesc": "Laptop Sleeve",
122
+ "totalWeight": 500,
123
+ "totalWeightUOM": "G",
124
+ "dimensionUOM": "CM",
125
+ "height": nil,
126
+ "length": nil,
127
+ "width": nil,
128
+ "productCode": "PDO",
129
+ "codValue": nil,
130
+ "insuranceValue": nil,
131
+ "totalValue": 300,
132
+ "currency": "MYR",
133
+ "remarks": nil,
134
+ "isRoutingInfoRequired": "Y",
135
+ "consigneeAddress": {
136
+ "companyName": "Sleeve Company",
137
+ "name": "Sleeve Sdn Bhd",
138
+ "address1": "No. 3, Jalan Bangsar, Kampung Haji Abdullah Hukum",
139
+ "address2": nil,
140
+ "address3": nil,
141
+ "city": "Kuala Lumpur",
142
+ "state": "Kuala Lumpur",
143
+ "district": nil,
144
+ "country": "MY",
145
+ "postCode": "59200",
146
+ "phone": "0169822645",
147
+ "email": nil
148
+ }
149
+ },
150
+ ]
151
+ }
152
+ }
153
+ }.deep_transform_keys {|key| key.to_s.underscore }
154
+
155
+ formatted_data = format_data(params)
156
+
157
+ =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 Shipment::Pickup < Shipment
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
- shipment_with_pickup_params = {
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
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module DHLEcommerceAPI
4
- VERSION = "0.1.6"
4
+ VERSION = "0.1.9"
5
5
  end
@@ -12,10 +12,9 @@ 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/shipment/pickup"
16
- require "dhl_ecommerce_api/resources/shipment/dropoff"
17
- # require "dhl_ecommerce_api/resources/shipment/shipment_item"
18
-
15
+ require "dhl_ecommerce_api/resources/shipment/shipment_item"
16
+ require "dhl_ecommerce_api/resources/shipment_test"
17
+
19
18
  require "dhl_ecommerce_api/resources/pickup"
20
19
 
21
20
  require "dhl_ecommerce_api/resources/tracking"
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.6
4
+ version: 0.1.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Er Whey
8
- autorequire:
8
+ autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-03-14 00:00:00.000000000 Z
11
+ date: 2022-03-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activeresource
@@ -123,6 +123,7 @@ extra_rdoc_files: []
123
123
  files:
124
124
  - ".rspec"
125
125
  - ".rubocop.yml"
126
+ - ".tool-versions"
126
127
  - CHANGELOG.md
127
128
  - CODE_OF_CONDUCT.md
128
129
  - Gemfile
@@ -142,9 +143,10 @@ files:
142
143
  - lib/dhl_ecommerce_api/resources/pickup.rb
143
144
  - lib/dhl_ecommerce_api/resources/pickup/handover_item.rb
144
145
  - 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
146
  - lib/dhl_ecommerce_api/resources/shipment/shipment_item.rb
147
+ - lib/dhl_ecommerce_api/resources/shipment_test.rb
148
+ - lib/dhl_ecommerce_api/resources/shipment_with_dropoff.rb
149
+ - lib/dhl_ecommerce_api/resources/shipment_with_pickup.rb
148
150
  - lib/dhl_ecommerce_api/resources/tracking.rb
149
151
  - lib/dhl_ecommerce_api/version.rb
150
152
  - sig/dhl_ecommerce_api.rbs
@@ -156,7 +158,7 @@ metadata:
156
158
  homepage_uri: https://github.com/PostCo/dhl_ecommerce_api
157
159
  source_code_uri: https://github.com/PostCo/dhl_ecommerce_api
158
160
  changelog_uri: https://github.com/PostCo/dhl_ecommerce_api/releases
159
- post_install_message:
161
+ post_install_message:
160
162
  rdoc_options: []
161
163
  require_paths:
162
164
  - lib
@@ -171,8 +173,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
171
173
  - !ruby/object:Gem::Version
172
174
  version: '0'
173
175
  requirements: []
174
- rubygems_version: 3.3.3
175
- signing_key:
176
+ rubyforge_project:
177
+ rubygems_version: 2.7.6.2
178
+ signing_key:
176
179
  specification_version: 4
177
180
  summary: Unofficial Ruby object based DHL eCommerce API wrapper.
178
181
  test_files: []
@@ -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
- # }