dhl_ecommerce_api 0.1.7 → 0.1.11

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: 1611a50fc49c9a322a7949f3080512e79d727d34d99ca75f4d6370f8bbdeef15
4
- data.tar.gz: 7dcf5b35eac8835be58e2baa8a6f93ee8c901c7ca94e3427156442ca8db758f1
3
+ metadata.gz: eb0971157608740682c486964b16f74e7c7cb98884f2be276daee0de8e09def8
4
+ data.tar.gz: c28f96ead90411021e8ad1b5a70a5ad9d2365a1cc016bf652dfb773461045db4
5
5
  SHA512:
6
- metadata.gz: 6119191eddd500affe3c2a7a5cc724082fa93e003f34c89649b26169f36380775cea1c270be92994a5709d24d42c3c00919e00f3f13c30c2cdd4f8cca1f8293c
7
- data.tar.gz: da6911749451b9951d1c8b07aa0cd44f05a1a6dd2290fbe9904202c45d408ce502dff9a6756e7712838c2d68dce70344aa7e485cb8a10a83c91057e6f78450a9
6
+ metadata.gz: 7f0cabaaed64860f138759d4432ca14bd93090b88c89c70e32ad92edfd24da4b2be41340cb17f9d0d0442d809c68b66602d433e12c50a2eb20b8aa77032fccfd
7
+ data.tar.gz: 8d0c7c7701040ef9b28c51d25d2707f620b32b8e6072b0483ab7c7561e08aace47452a4e3dd2200c96e5098d65f0336f9b59851465aecf7bdf993cf438e765fc
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.6)
4
+ dhl_ecommerce_api (0.1.9)
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)
@@ -43,7 +36,7 @@ module DHLEcommerceAPI
43
36
  # We have to write our own method to format the request data
44
37
  def formatted_request_data(request_data)
45
38
  request_data.as_json
46
- .deep_transform_keys {|key| custom_key_format(key)}.to_json
39
+ .deep_transform_keys {|key| custom_key_format(key)}
47
40
  end
48
41
 
49
42
  # custom keys that arent following lowerCamel convention
@@ -75,5 +68,13 @@ module DHLEcommerceAPI
75
68
  key.to_s.camelize(:lower)
76
69
  end
77
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
78
79
  end
79
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,6 +1,8 @@
1
1
  module DHLEcommerceAPI
2
2
  # Component item
3
3
  class Shipment::ShipmentItem < Base
4
+ self.element_name = ""
5
+
4
6
  # add some validations?
5
7
  DEFAULT_ATTRIBUTES = {
6
8
  shipment_id: nil,
@@ -18,20 +20,7 @@ module DHLEcommerceAPI
18
20
  currency: "MYR",
19
21
  remarks: nil,
20
22
  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
- }
23
+ consignee_address: {}
35
24
  }
36
25
 
37
26
  def initialize(attributes = {}, persisted = false)
@@ -6,8 +6,6 @@ module DHLEcommerceAPI
6
6
  self.prefix = "/rest/v3/Shipment"
7
7
  self.element_name = ""
8
8
 
9
- validates_presence_of :handover_method
10
-
11
9
  def create
12
10
  run_callbacks :create do
13
11
  data = formatted_request_data(manifest_request)
@@ -46,7 +44,7 @@ module DHLEcommerceAPI
46
44
  {
47
45
  manifest_request: {
48
46
  hdr: headers,
49
- bd: attributes_with_account_ids.deep_transform_keys {|key| key.to_s.underscore.to_sym }
47
+ bd: attributes_with_account_ids
50
48
  }
51
49
  }
52
50
  end
@@ -62,9 +60,126 @@ module DHLEcommerceAPI
62
60
  end
63
61
  end
64
62
 
63
+ =begin
65
64
  # Examples:
65
+ shipment_with_pickup_params = {
66
+ "handoverMethod": 2,
67
+ "shipperAddress": {
68
+ "companyName": "Pickup From Company",
69
+ "name": "Pickup From Name",
70
+ "address1": "Holistic Pharmacy PostCo, 55, Jalan Landak",
71
+ "address2": "",
72
+ "address3": "",
73
+ "city": " Kuala Lumpur",
74
+ "state": " Kuala Lumpur",
75
+ "postCode": "55100",
76
+ "country": "MY",
77
+ "phone": "0123456789",
78
+ "email": "hello@example.com"
79
+ },
80
+ "pickupDateTime": DateTime.now.to_s,
81
+ "pickupAddress": {
82
+ "companyName": "Pickup From Company",
83
+ "name": "Pickup From Name",
84
+ "address1": "Holistic Pharmacy PostCo, 55, Jalan Landak",
85
+ "address2": "",
86
+ "address3": "",
87
+ "city": " Kuala Lumpur",
88
+ "state": " Kuala Lumpur",
89
+ "postCode": "55100",
90
+ "country": "MY",
91
+ "phone": "0123456789",
92
+ "email": "hello@example.com"
93
+ },
94
+ "shipmentItems": [
95
+ {
96
+ "shipmentID": "MYPTC0085",
97
+ "packageDesc": "Laptop Sleeve",
98
+ "totalWeight": 500,
99
+ "totalWeightUOM": "G",
100
+ "dimensionUOM": "CM",
101
+ "height": nil,
102
+ "length": nil,
103
+ "width": nil,
104
+ "productCode": "PDO",
105
+ "codValue": nil,
106
+ "insuranceValue": nil,
107
+ "totalValue": 300,
108
+ "currency": "MYR",
109
+ "remarks": nil,
110
+ "isRoutingInfoRequired": "Y",
111
+ "consigneeAddress": {
112
+ "companyName": "Sleeve Company",
113
+ "name": "Sleeve Sdn Bhd",
114
+ "address1": "No. 3, Jalan Bangsar, Kampung Haji Abdullah Hukum",
115
+ "address2": nil,
116
+ "address3": nil,
117
+ "city": "Kuala Lumpur",
118
+ "state": "Kuala Lumpur",
119
+ "district": nil,
120
+ "country": "MY",
121
+ "postCode": "59200",
122
+ "phone": "0169822645",
123
+ "email": nil
124
+ }
125
+ },
126
+ ]
127
+ }.deep_transform_keys {|key| key.to_s.underscore }
128
+
129
+ shipment_with_dropoff_params = {
130
+ "handover_method" => 1,
131
+ "shipment_items" => [
132
+ {
133
+ "consignee_address" => {
134
+ "company_name" => "Test",
135
+ "name" => "Test1",
136
+ "address1" => "NO 3 JALAN PPU 1",
137
+ "address2" => "TAMAN PERINDUSTRIAN PUCHONG UTAMA",
138
+ "address3" => nil,
139
+ "city" => "PUCHONG",
140
+ "state" => "SELANGOR",
141
+ "district" => nil,
142
+ "country" => "MY",
143
+ "post_code" => "57000",
144
+ "phone" => "0123456798",
145
+ "email" => nil
146
+ },
147
+ "shipment_id" => "MYPTC000102",
148
+ "package_desc" => "Bread Materials",
149
+ "total_weight" => 2000,
150
+ "total_weight_uom" => "G",
151
+ "dimension_uom" => "CM",
152
+ "height" => nil,
153
+ "length" => nil,
154
+ "width" => nil,
155
+ "product_code" => "PDO",
156
+ "cod_value" => nil,
157
+ "insurance_value" => nil,
158
+ "total_value" => 300,
159
+ "currency" => "MYR",
160
+ "remarks" => nil,
161
+ "is_routing_info_required" => "Y"
162
+ }
163
+ ],
164
+ }
165
+ =end
166
+
167
+
66
168
  # shipment_with_pickup_params = {
67
169
  # "handoverMethod": 2,
170
+ # "shipperAddress": {
171
+ # "companyName": "Pickup From Company",
172
+ # "name": "Pickup From Name",
173
+ # "address1": "Holistic Pharmacy PostCo, 55, Jalan Landak",
174
+ # "address2": "",
175
+ # "address3": "",
176
+ # "city": " Kuala Lumpur",
177
+ # "state": " Kuala Lumpur",
178
+ # "postCode": "55100",
179
+ # "country": "MY",
180
+ # "phone": "0123456789",
181
+ # "email": "hello@example.com"
182
+ # },
68
183
  # "pickupDateTime": DateTime.now.to_s,
69
184
  # "pickupAddress": {
70
185
  # "companyName": "Pickup From Company",
@@ -81,7 +196,7 @@ end
81
196
  # },
82
197
  # "shipmentItems": [
83
198
  # {
84
- # "shipmentID": "MYPTC0083",
199
+ # "shipmentID": "MYPTC0085",
85
200
  # "packageDesc": "Laptop Sleeve",
86
201
  # "totalWeight": 500,
87
202
  # "totalWeightUOM": "G",
@@ -112,41 +227,4 @@ end
112
227
  # }
113
228
  # },
114
229
  # ]
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
- # }
230
+ # }
@@ -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
@@ -0,0 +1,93 @@
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
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module DHLEcommerceAPI
4
- VERSION = "0.1.7"
4
+ VERSION = "0.1.11"
5
5
  end
@@ -12,11 +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
15
  require "dhl_ecommerce_api/resources/shipment/shipment_item"
18
- require "dhl_ecommerce_api/resources/shipment/shipment_item/consignee_address"
19
-
16
+ require "dhl_ecommerce_api/resources/shipment_test"
17
+
20
18
  require "dhl_ecommerce_api/resources/pickup"
21
19
 
22
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.7
4
+ version: 0.1.11
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,10 +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
148
- - lib/dhl_ecommerce_api/resources/shipment/shipment_item/consignee_address.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
149
150
  - lib/dhl_ecommerce_api/resources/tracking.rb
150
151
  - lib/dhl_ecommerce_api/version.rb
151
152
  - sig/dhl_ecommerce_api.rbs
@@ -157,7 +158,7 @@ metadata:
157
158
  homepage_uri: https://github.com/PostCo/dhl_ecommerce_api
158
159
  source_code_uri: https://github.com/PostCo/dhl_ecommerce_api
159
160
  changelog_uri: https://github.com/PostCo/dhl_ecommerce_api/releases
160
- post_install_message:
161
+ post_install_message:
161
162
  rdoc_options: []
162
163
  require_paths:
163
164
  - lib
@@ -172,8 +173,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
172
173
  - !ruby/object:Gem::Version
173
174
  version: '0'
174
175
  requirements: []
175
- rubygems_version: 3.3.3
176
- signing_key:
176
+ rubyforge_project:
177
+ rubygems_version: 2.7.6.2
178
+ signing_key:
177
179
  specification_version: 4
178
180
  summary: Unofficial Ruby object based DHL eCommerce API wrapper.
179
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
- # }
@@ -1,77 +0,0 @@
1
- module DHLEcommerceAPI
2
- class Shipment::Pickup < 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
- # 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,5 +0,0 @@
1
- module DHLEcommerceAPI
2
- # Component item
3
- class Shipment::ShipmentItem::ConsigneeAddress < Base
4
- end
5
- end