dhl_api 0.1.1 → 0.1.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +11 -2
- data/Gemfile.lock +1 -1
- data/README.md +3 -5
- data/lib/dhl_api/clients/retoure_client.rb +2 -1
- data/lib/dhl_api/objects/base_object.rb +2 -2
- data/lib/dhl_api/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9b12f7af254bba77f9d7d87e5a3a78929e2c742ca36b2c6f371a83f8f9fe5ebf
|
4
|
+
data.tar.gz: e4b97029dac457ee558241fcc0761093c1464fa0014db9fe38809cdf7ff01ced
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f3742aeacb22214a7fad55047eebe7286ebccb36b1f376e09ef06152f4270fee016abb8edc735c3723c88700da566795b69f2f53a13ede83375496303ff6f22c
|
7
|
+
data.tar.gz: 9bdaf6a5c171217e7b8009543dddaffea81b007e2f16845ea9c79283cdb2eaa95ac287affaac059d95576a174712baff6a1d6d86b217df674bbf54e1ca7da016
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,14 @@
|
|
1
|
-
## [
|
1
|
+
## [0.1.2] - 2023-06-27
|
2
2
|
|
3
|
-
|
3
|
+
- Transform payload keys to lowerCamel before send.
|
4
|
+
|
5
|
+
## [0.1.1] - 2023-06-26
|
6
|
+
|
7
|
+
- Rename DHL constant to DHLAPI
|
8
|
+
- Rename dhl to dhl_api
|
9
|
+
|
10
|
+
## [0.1.0] - 2023-06-26
|
4
11
|
|
5
12
|
- Initial release
|
13
|
+
- Add Retoure label creation
|
14
|
+
- Add Unified Tracking
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -1,8 +1,6 @@
|
|
1
|
-
#
|
1
|
+
# DHL API
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
TODO: Delete this and the text above, and describe your gem
|
3
|
+
This is a Ruby API wrapper for DHL. Right now, we only cover Retoure & Tracking. Feel free to extend the gem t cover more DHL services.
|
6
4
|
|
7
5
|
## Installation
|
8
6
|
|
@@ -72,7 +70,7 @@ tracking = track_client.track(tracking_number: '420025369374810912402173942693')
|
|
72
70
|
|
73
71
|
# You can access the raw response by calling by calling the #response:
|
74
72
|
retoure_client.response
|
75
|
-
|
73
|
+
track_client.response
|
76
74
|
# It is a HTTP::Response object. See https://github.com/httprb/http/wiki/Response-Handling for more info.
|
77
75
|
|
78
76
|
# You can access the raw attributes before the keys is parsed to snake_case by calling the #attributes:
|
@@ -17,7 +17,8 @@ module DHLAPI
|
|
17
17
|
attr_accessor :label_type
|
18
18
|
|
19
19
|
def create_label(attributes = {})
|
20
|
-
|
20
|
+
payload = attributes.deep_transform_keys { |key| key.to_s.camelize(:lower) }
|
21
|
+
self.response = connection.post(url, json: payload, params: { labelType: label_type })
|
21
22
|
RetoureLabel.new handle_response.parse
|
22
23
|
end
|
23
24
|
|
@@ -13,9 +13,9 @@ module DHLAPI
|
|
13
13
|
if obj.is_a?(Hash)
|
14
14
|
OpenStruct.new(obj.map { |key, val| [key.to_s.underscore, to_ostruct(val)] }.to_h)
|
15
15
|
elsif obj.is_a?(Array)
|
16
|
+
return if obj.empty?
|
17
|
+
|
16
18
|
obj.map { |o| to_ostruct(o) }
|
17
|
-
else # Assumed to be a primitive value
|
18
|
-
obj
|
19
19
|
end
|
20
20
|
end
|
21
21
|
end
|
data/lib/dhl_api/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dhl_api
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andy Chong
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-
|
11
|
+
date: 2023-08-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|