dhl_ecommerce_api 0.1.0 → 0.1.3

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: 6997d6fa361fe163afb7ce2d69325ad6cd20f8d3902cbc6b51c891b910766160
4
- data.tar.gz: 231ba82b1d8507a15b1b3e4883451473ddd8d431726aece3c755d5ff523a7b9d
3
+ metadata.gz: 9a2f1d2a269383e70ae8d3e1790d26a84cf75914195f112d1228030f18f46304
4
+ data.tar.gz: c7c5739d014fb7f1785b1d2da4531c50891e5c634a0adbe376978adab3850ec3
5
5
  SHA512:
6
- metadata.gz: 30db0bcf3d8c54f66923af39e39f38996a7de36943d4834fd20ee716dd915a2cd84f147bfd589e8644fc1e7381190e59b3b7c25b97d2753bb2a13c8901a76a31
7
- data.tar.gz: '08607e7d379b167cd469f43a4bded2606b4dedc6994bc5a8f24fe40f094c6c9d1a68ca9dd04afdbea091a5afb84d7a7e908535150aad8277207d2cb377e8d681'
6
+ metadata.gz: a7888364e05e7bd7eec4f778cbcb241451643907c93e73d3f6cca7d57803d2528611567612fa8b3515069eef889332d041704e0084b51b05dcdeaddd7db6e7bf
7
+ data.tar.gz: 0de0dd3a612306fda95c9892ceece8b08fcc37ba2720f984c7905a71cbc01cb65702ba897cecb25dbad6f416760ee0a5622662d6431b66cc2653580371064ff7
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- dhl_ecommerce_api (0.1.0)
4
+ dhl_ecommerce_api (0.1.1)
5
5
  activeresource (>= 4.1.0, < 6.0.0)
6
6
 
7
7
  GEM
data/README.md CHANGED
@@ -4,7 +4,7 @@ Welcome to your new gem! In this directory, you'll find the files you need to be
4
4
 
5
5
  TODO: Delete this and the text above, and describe your gem
6
6
 
7
- ## Installation
7
+ # Installation
8
8
 
9
9
  Add this line to your application's Gemfile:
10
10
 
@@ -20,33 +20,156 @@ Or install it yourself as:
20
20
 
21
21
  $ gem install dhl_ecommerce_api
22
22
 
23
- ## Configuration
23
+ # Configuration
24
24
  In `config/initializers` create a `dhl_ecommerce_api.rb` config file
25
25
  ```ruby
26
26
  DHLEcommerceAPI.configure do |config|
27
- config.env = ENV["DHL_ECOMMERCE_API_ENV"]
28
27
  config.client_id = ENV["DHL_ECOMMERCE_API_CLIENT_ID"]
29
28
  config.password = ENV["DHL_ECOMMERCE_API_PASSWORD"]
29
+ config.pickup_account_id = ENV["DHL_ECOMMERCE_API_PICKUP_ACCOUNT_ID"]
30
+ config.sold_to_account_id = ENV["DHL_ECOMMERCE_API_SOLD_TO_ACCOUNT_ID"]
31
+
32
+ # optional, will refer to Rails.env
33
+ # config.env = ENV["DHL_ECOMMERCE_API_ENV"]
30
34
  end
31
35
  ```
32
- ## Usage
33
- ### Create Shipment
36
+ # Usage
37
+ ## Create Shipment with Pickup
38
+ [DHL Shipment Documentation](https://sandbox.dhlecommerce.asia/API/docs/v2/pickup.html)
39
+ ```ruby
40
+ # Shipment::Pickup params
41
+ {
42
+ "pickup_date_time": DateTime.now.to_s,
43
+ "pickup_address": {
44
+ "company_name": "Pickup From Company",
45
+ "name": "Pickup From Name",
46
+ "address1": "Holistic Pharmacy PostCo, 55, Jalan Landak",
47
+ "city": " Kuala Lumpur",
48
+ "state": " Kuala Lumpur",
49
+ "post_code": "55100",
50
+ "country": "MY",
51
+ "phone": "0123456789",
52
+ "email": "hello@example.com"
53
+ },
54
+ "shipment_items": [
55
+ {
56
+ "shipment_id": "MYPTC00001", # unique
57
+ "package_desc": "Laptop Sleeve",
58
+ "total_weight": 500,
59
+ "total_weight_uom": "G",
60
+ "dimension_uom": "CM",
61
+ "product_code": "PDO",
62
+ "total_value": 300,
63
+ "currency": "MYR",
64
+ "is_routing_info_required": "Y",
65
+ "consignee_address": {
66
+ "company_name": "Sleeve Company",
67
+ "name": "Sleeve Sdn Bhd",
68
+ "address1": "No. 3, Jalan Bangsar, Kampung Haji Abdullah Hukum",
69
+ "city": "Kuala Lumpur",
70
+ "state": "Kuala Lumpur",
71
+ "country": "MY",
72
+ "postCode": "57000",
73
+ "phone": "0123456789"
74
+ }
75
+ },
76
+ ]
77
+ }
78
+ ```
79
+
34
80
  ```ruby
35
- DHLEcommerceAPI::Shipment.create(params)
81
+ DHLEcommerceAPI::Shipment::Pickup.create(params)
82
+ ```
83
+
84
+
85
+ ## Create Shipment w/o Pickup
86
+ Create a Shipment in DHLs system only. Used when we want to create a Shipment but not book a pickup. I.e. Generate the Shipment label for customers to print. (Use in conjunction with Pickup API.)
87
+ ```ruby
88
+ # Shipment::Dropoff params
89
+ {
90
+ "shipment_items" => [
91
+ {
92
+ "shipment_id" => "MYPTC00002", # unique
93
+ "package_desc" => "Bread Materials",
94
+ "total_weight" => 2000,
95
+ "total_weight_uom" => "G",
96
+ "dimension_uom" => "CM",
97
+ "product_code" => "PDO",
98
+ "total_value" => 300,
99
+ "currency" => "MYR",
100
+ "is_routing_info_required" => "Y",
101
+ "consignee_address" => {
102
+ "company_name" => "Test",
103
+ "name" => "Test1",
104
+ "address1" => "NO 3 JALAN PPU 1",
105
+ "address2" => "TAMAN PERINDUSTRIAN PUCHONG UTAMA",
106
+ "city" => "PUCHONG",
107
+ "state" => "SELANGOR",
108
+ "country" => "MY",
109
+ "post_code" => "57000",
110
+ "phone" => "0123456798"
111
+ }
112
+ }
113
+ ]
114
+ }
115
+ ```
116
+
117
+ ```ruby
118
+ DHLEcommerceAPI::Shipment::Dropoff.create(params)
119
+ ```
120
+
121
+ ## Create Pickup
122
+ DHL will send a courier to pickup parcels from the `shipper_details` address. The courier will only pickup parcels with a valid DHL label.
123
+
124
+ [DHL Pickup Documentation](https://sandbox.dhlecommerce.asia/API/docs/v2/pickup.html)
125
+
126
+ ```ruby
127
+ # Pickup params
128
+ {
129
+ "handover_items": [
130
+ {
131
+ "pickup_date": "2022-03-09",
132
+ "pickup_start_time": "09:00",
133
+ "pickup_end_time": "18:00",
134
+ "shipment_type": "1",
135
+ "shipper_details": {
136
+ "company": "PostCo",
137
+ "name": "PostCo",
138
+ "phone_number": "0123456789",
139
+ "address_line_1": "No 31, Jalan 123/123",
140
+ "city": "Petaling Jaya",
141
+ "state": "Selangor",
142
+ "postal_code": "57000",
143
+ "country": "MY",
144
+ },
145
+ "shipments": {
146
+ "quantity": 1,
147
+ "totalWeight": 100
148
+ }
149
+ }
150
+ ]
151
+ }
36
152
  ```
37
- ### Create Pickup
38
153
  ```ruby
39
154
  DHLEcommerceAPI::Pickup.create(params)
40
155
  ```
156
+ ## Tracking
157
+ [DHL Tracking Documentation](https://sandbox.dhlecommerce.asia/API/docs/v2/pickup.html)
158
+ ```ruby
159
+ DHLEcommerceAPI::Tracking.find('MYPOS0001')
160
+ # => [ShipmentItem]
161
+ ```
41
162
 
42
- ### Tracking
43
163
  ```ruby
44
- DHLEcommerceAPI::Tracking.track(array_of_string_tracking_numbers)
164
+ DHLEcommerceAPI::Tracking.find(['MYPOS0001', 'MYPOS0002'])
165
+ # => [...ShipmentItems]
45
166
  ```
46
167
 
47
168
 
48
- ## Development
169
+ ___
49
170
 
171
+
172
+ ## Development
50
173
  After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
51
174
 
52
175
  To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and the created tag, and push the `.gem` file to [rubygems.org](https://rubygems.org).
@@ -78,8 +78,8 @@ end
78
78
  # "state": " Kuala Lumpur",
79
79
  # "postCode": "55100",
80
80
  # "country": "MY",
81
- # "phone": "0169822645",
82
- # "email": "erwhey@postco.co"
81
+ # "phone": "0123456789",
82
+ # "email": "hello@example.com"
83
83
  # },
84
84
  # "shipmentItems": [
85
85
  # {
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module DHLEcommerceAPI
4
- VERSION = "0.1.0"
4
+ VERSION = "0.1.3"
5
5
  end
@@ -12,6 +12,10 @@ 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
19
  require "dhl_ecommerce_api/resources/pickup"
16
20
 
17
21
  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.0
4
+ version: 0.1.3
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-08 00:00:00.000000000 Z
11
+ date: 2022-03-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activeresource
@@ -164,7 +164,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
164
164
  requirements:
165
165
  - - ">="
166
166
  - !ruby/object:Gem::Version
167
- version: 2.6.0
167
+ version: '2.5'
168
168
  required_rubygems_version: !ruby/object:Gem::Requirement
169
169
  requirements:
170
170
  - - ">="