dhl_ecommerce_api 0.1.0 → 0.1.1

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: 70b103b3e293f5bf2eadc1523941aae5fac275aec3938992f8783aadd9453923
4
+ data.tar.gz: 77a6ffb5fd07addba613727d388fe7ab526aa8d7a712731eb43783c128e4824f
5
5
  SHA512:
6
- metadata.gz: 30db0bcf3d8c54f66923af39e39f38996a7de36943d4834fd20ee716dd915a2cd84f147bfd589e8644fc1e7381190e59b3b7c25b97d2753bb2a13c8901a76a31
7
- data.tar.gz: '08607e7d379b167cd469f43a4bded2606b4dedc6994bc5a8f24fe40f094c6c9d1a68ca9dd04afdbea091a5afb84d7a7e908535150aad8277207d2cb377e8d681'
6
+ metadata.gz: 24eb00b962f86ec2ad509745f7fc36392d8c209a745444042594a38811f64045e6009a73006a40adf5ca32aa14d435cfd9920632ebf5725a269be8237c7fa170
7
+ data.tar.gz: ac57594eedff7e8e5cce2818864e9d6ce1c5ce13a9cfc57251c3b9c1040fc3168c93ae8c2a8acce64c81c95126ca3c1b24cbcaf35b1984e8c5ceec126fc0c0d6
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).
@@ -0,0 +1,47 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "lib/dhl_ecommerce_api/version"
4
+
5
+ Gem::Specification.new do |spec|
6
+ spec.name = "dhl_ecommerce_api"
7
+ spec.version = DHLEcommerceAPI::VERSION
8
+ spec.authors = ["Er Whey"]
9
+ spec.email = ["erwhey@postco.co"]
10
+
11
+ spec.summary = "Unofficial Ruby object based DHL eCommerce API wrapper."
12
+ spec.description = "Unofficial Ruby object based DHL eCommerce API wrapper."
13
+ spec.homepage = "https://github.com/PostCo/dhl_ecommerce_api"
14
+ spec.license = "MIT"
15
+ spec.required_ruby_version = ">= 2.6.0"
16
+
17
+ spec.metadata["allowed_push_host"] = "https://rubygems.org/"
18
+
19
+ spec.metadata["homepage_uri"] = spec.homepage
20
+ spec.metadata["source_code_uri"] = "https://github.com/PostCo/dhl_ecommerce_api"
21
+ spec.metadata["changelog_uri"] = "https://github.com/PostCo/dhl_ecommerce_api/releases"
22
+
23
+ # Specify which files should be added to the gem when it is released.
24
+ # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
25
+ spec.files = Dir.chdir(File.expand_path(__dir__)) do
26
+ `git ls-files -z`.split("\x0").reject do |f|
27
+ (f == __FILE__) || f.match(%r{\A(?:(?:bin|test|spec|features)/|\.(?:git|travis|circleci)|appveyor)})
28
+ end
29
+ end
30
+ spec.bindir = "exe"
31
+ spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) }
32
+ spec.require_paths = ["lib"]
33
+
34
+ # Uncomment to register a new dependency of your gem
35
+ # spec.add_dependency "example-gem", "~> 1.0"
36
+ spec.add_dependency "activeresource", ">= 4.1.0", "< 6.0.0"
37
+
38
+ spec.add_development_dependency "rspec", "~> 3.2"
39
+ spec.add_development_dependency "dotenv"
40
+ spec.add_development_dependency "pry", "~> 0.14.1"
41
+ spec.add_development_dependency "guard-rspec"
42
+ spec.add_development_dependency "standard"
43
+ spec.add_development_dependency "gem-release"
44
+
45
+ # For more information and examples about making a new gem, check out our
46
+ # guide at: https://bundler.io/guides/creating_gem.html
47
+ end
@@ -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.1"
5
5
  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.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Er Whey
@@ -130,6 +130,7 @@ files:
130
130
  - LICENSE.txt
131
131
  - README.md
132
132
  - Rakefile
133
+ - dhl_ecommerce_api.gemspec
133
134
  - lib/dev/config.rb
134
135
  - lib/dev/zeitwerk_loader.rb
135
136
  - lib/dhl_ecommerce_api.rb