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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 38fd924f15b98dc8f683c50ae9f377b7d79ab3dec1f0cbfc5d3641653a51350d
4
- data.tar.gz: 1d7d0afcf7949e90026ea3b2ee81912423f3c61a71f6a3b97b7b36082a29d56f
3
+ metadata.gz: 9b12f7af254bba77f9d7d87e5a3a78929e2c742ca36b2c6f371a83f8f9fe5ebf
4
+ data.tar.gz: e4b97029dac457ee558241fcc0761093c1464fa0014db9fe38809cdf7ff01ced
5
5
  SHA512:
6
- metadata.gz: 12709605fc3a4c59c9be84afd4764c14d72c75b88e544d77436f7b670bd89bbc90e7e84aa1f1d505d0201cd2289f847336066a32d75713f0b04ca49469eb5715
7
- data.tar.gz: d65f5bdeae686f719320815e817b183ccaca6be69869919600c754fc11f779b0a5f6002fff557e93e89818f89258a853364f10446b7a6e07d2c7c166b9b396e3
6
+ metadata.gz: f3742aeacb22214a7fad55047eebe7286ebccb36b1f376e09ef06152f4270fee016abb8edc735c3723c88700da566795b69f2f53a13ede83375496303ff6f22c
7
+ data.tar.gz: 9bdaf6a5c171217e7b8009543dddaffea81b007e2f16845ea9c79283cdb2eaa95ac287affaac059d95576a174712baff6a1d6d86b217df674bbf54e1ca7da016
data/CHANGELOG.md CHANGED
@@ -1,5 +1,14 @@
1
- ## [Unreleased]
1
+ ## [0.1.2] - 2023-06-27
2
2
 
3
- ## [0.1.0] - 2023-06-22
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
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- dhl_api (0.1.0)
4
+ dhl_api (0.1.2)
5
5
  activesupport (>= 4.0.2)
6
6
  http (~> 5.0)
7
7
 
data/README.md CHANGED
@@ -1,8 +1,6 @@
1
- # DHLAPI
1
+ # DHL API
2
2
 
3
- Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/dhl_api`. To experiment with that code, run `bin/console` for an interactive prompt.
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
- tracking_client.response
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
- self.response = connection.post(url, json: attributes, params: { labelType: label_type })
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
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module DHLAPI
4
- VERSION = '0.1.1'
4
+ VERSION = '0.1.3'
5
5
  end
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.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-06-26 00:00:00.000000000 Z
11
+ date: 2023-08-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport