dhl-bcs 0.3.0 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: de9c80a9486c4d7c02e9c2f08bce20e4519297b65a7e56e45292b6d81da1b7d1
4
- data.tar.gz: df4f7998310675845b3033b38f4e4e82985361491b84a827cb3a21c841ecadd7
3
+ metadata.gz: 99dd25ad1a742a8726594746c03ec739238f0dbde358fd100bddf87204c42cb6
4
+ data.tar.gz: 98d402939ab3d9dcff91f433613dd54887912fc5a65fa8434b7332390b60c463
5
5
  SHA512:
6
- metadata.gz: 6df55ab919ded0e7388011f21dccce2f19a2c27eba6f641e5f34b325b8f33046281be1131bcdebf3586a64396b4b9e6198c45e77fa498660800f9ea29766b70d
7
- data.tar.gz: 42e880a8ea72c3c7cedeadc5fa1292831e5ae24b021aa66b208e62efadbe017c61504d64286bdea044a36340a54ac67fcb4aff7329f49a726af7cac3784b4b88
6
+ metadata.gz: df164db19806cce7b8ecebcbc9ccb3d234280eaa7ee7e0fcea867785addb58deab6ac362beea500fd16965201898cdde49329d15bad54ba4e966cf44c7c393dd
7
+ data.tar.gz: fdc4e23269be4df34b440fc6e8a6644620e0eb6deb74282c705e04c149f57c5982f4d70cd1d6ada8e440aa0c5d8a633e6ffe37effc853ad491c2e77a4e50fbdd
data/.gitignore CHANGED
@@ -1,6 +1,5 @@
1
1
  /.bundle/
2
2
  /.yardoc
3
- /Gemfile.lock
4
3
  /_yardoc/
5
4
  /coverage/
6
5
  /doc/
data/Gemfile.lock ADDED
@@ -0,0 +1,73 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ dhl-bcs (0.3.0)
5
+ savon (~> 2.12)
6
+
7
+ GEM
8
+ remote: https://rubygems.org/
9
+ specs:
10
+ addressable (2.8.0)
11
+ public_suffix (>= 2.0.2, < 5.0)
12
+ akami (1.3.1)
13
+ gyoku (>= 0.4.0)
14
+ nokogiri
15
+ builder (3.2.4)
16
+ byebug (11.1.3)
17
+ coderay (1.1.3)
18
+ crack (0.4.5)
19
+ rexml
20
+ gyoku (1.4.0)
21
+ builder (>= 2.1.2)
22
+ rexml (~> 3.0)
23
+ hashdiff (1.0.1)
24
+ httpi (2.5.0)
25
+ rack
26
+ socksify
27
+ method_source (1.0.0)
28
+ minitest (5.15.0)
29
+ nokogiri (1.13.10-x86_64-linux)
30
+ racc (~> 1.4)
31
+ nori (2.6.0)
32
+ pry (0.13.1)
33
+ coderay (~> 1.1)
34
+ method_source (~> 1.0)
35
+ pry-byebug (3.9.0)
36
+ byebug (~> 11.0)
37
+ pry (~> 0.13.0)
38
+ public_suffix (4.0.7)
39
+ racc (1.6.1)
40
+ rack (3.0.4.2)
41
+ rake (13.0.6)
42
+ rexml (3.2.5)
43
+ savon (2.12.1)
44
+ akami (~> 1.2)
45
+ builder (>= 2.1.2)
46
+ gyoku (~> 1.2)
47
+ httpi (~> 2.3)
48
+ nokogiri (>= 1.8.1)
49
+ nori (~> 2.4)
50
+ wasabi (~> 3.4)
51
+ socksify (1.7.1)
52
+ wasabi (3.7.0)
53
+ addressable
54
+ httpi (~> 2.0)
55
+ nokogiri (>= 1.4.2)
56
+ webmock (3.14.0)
57
+ addressable (>= 2.8.0)
58
+ crack (>= 0.3.2)
59
+ hashdiff (>= 0.4.0, < 2.0.0)
60
+
61
+ PLATFORMS
62
+ x86_64-linux
63
+
64
+ DEPENDENCIES
65
+ bundler (~> 2.3)
66
+ dhl-bcs!
67
+ minitest (~> 5.15)
68
+ pry-byebug (~> 3.9)
69
+ rake (~> 13.0)
70
+ webmock (~> 3.14)
71
+
72
+ BUNDLED WITH
73
+ 2.3.4
data/dhl-bcs.gemspec CHANGED
@@ -21,9 +21,9 @@ Gem::Specification.new do |spec|
21
21
 
22
22
  spec.add_dependency "savon", "~> 2.12"
23
23
 
24
- spec.add_development_dependency "bundler", "~> 1.16"
25
- spec.add_development_dependency "rake", "~> 12.3"
26
- spec.add_development_dependency "minitest", "~> 5.11"
27
- spec.add_development_dependency "webmock", "~> 3.3"
28
- spec.add_development_dependency "pry-byebug", "~> 3.6"
24
+ spec.add_development_dependency "bundler", "~> 2.3"
25
+ spec.add_development_dependency "rake", "~> 13.0"
26
+ spec.add_development_dependency "minitest", "~> 5.15"
27
+ spec.add_development_dependency "webmock", "~> 3.14"
28
+ spec.add_development_dependency "pry-byebug", "~> 3.9"
29
29
  end
@@ -6,7 +6,7 @@ module Dhl::Bcs::V2
6
6
  end
7
7
 
8
8
  module ClassMethods
9
- def build(attributes)
9
+ def build(**attributes)
10
10
  attrib = attributes[underscore(name.split('::').last).to_sym]
11
11
  if attrib.is_a?(self)
12
12
  attrib
@@ -16,9 +16,9 @@ module Dhl::Bcs::V2
16
16
  value = attributes.delete(prop)
17
17
  klass_attributes[prop] = value if value
18
18
  end
19
- new(klass_attributes)
19
+ new(**klass_attributes)
20
20
  elsif attrib.is_a?(Hash)
21
- new(attrib)
21
+ new(**attrib)
22
22
  end
23
23
  end
24
24
 
@@ -50,7 +50,7 @@ module Dhl::Bcs::V2
50
50
  end
51
51
 
52
52
  def validate_shipment(*shipments, **options)
53
- request(:validate_shipment, build_shipment_orders(shipments, options)) do |response|
53
+ request(:validate_shipment, build_shipment_orders(shipments, **options)) do |response|
54
54
  [response.body[:validate_shipment_response][:validation_state]].flatten.map do |validation_state|
55
55
  validation_state[:status]
56
56
  end
@@ -58,7 +58,7 @@ module Dhl::Bcs::V2
58
58
  end
59
59
 
60
60
  def create_shipment_order(*shipments, **options)
61
- request(:create_shipment_order, build_shipment_orders(shipments, options)) do |response|
61
+ request(:create_shipment_order, build_shipment_orders(shipments, **options)) do |response|
62
62
  [response.body[:create_shipment_order_response][:creation_state]].flatten.map do |creation_state|
63
63
  creation_state[:label_data]
64
64
  end
@@ -66,7 +66,7 @@ module Dhl::Bcs::V2
66
66
  end
67
67
 
68
68
  def update_shipment_order(shipment_number, shipment, **options)
69
- request(:update_shipment_order, { 'cis:shipmentNumber' => shipment_number }.merge(build_shipment_orders([shipment], options))) do |response|
69
+ request(:update_shipment_order, { 'cis:shipmentNumber' => shipment_number }.merge(build_shipment_orders([shipment], **options))) do |response|
70
70
  clean_response_data(response.body[:update_shipment_order_response][:label_data])
71
71
  end
72
72
  end
@@ -2,8 +2,11 @@ module Dhl::Bcs::V2
2
2
  class ExportDocument
3
3
  include Buildable
4
4
 
5
- PROPERTIES = %i(invoice_number export_type export_type_description terms_of_trade place_of_commital additional_fee permit_number attestation_number with_electronic_export_notification export_doc_positions).freeze
6
- attr_accessor(*PROPERTIES)
5
+ ACCESSOR_PROPERTIES = %i[invoice_number export_type_description place_of_commital additional_fee permit_number attestation_number with_electronic_export_notification export_doc_positions].freeze
6
+ READER_PROPERTIES = %i[export_type terms_of_trade]
7
+ PROPERTIES = (ACCESSOR_PROPERTIES + READER_PROPERTIES).freeze
8
+ attr_accessor(*ACCESSOR_PROPERTIES)
9
+ attr_reader(*READER_PROPERTIES)
7
10
 
8
11
  EXPORT_TYPES = %w(OTHER PRESENT COMMERCIAL_SAMPLE DOCUMENT RETURN_OF_GOODS).freeze
9
12
  TERMS_OF_TRADES = %w(DDP DXV DDU DDX).freeze
@@ -11,9 +14,9 @@ module Dhl::Bcs::V2
11
14
  def self.build(export_doc_positions = [], **attributes)
12
15
  array_of_export_doc_positions = []
13
16
  export_doc_positions.each do |export_doc_position|
14
- array_of_export_doc_positions << ExportDocPosition.build(export_doc_position) if export_doc_position.is_a?(Hash)
17
+ array_of_export_doc_positions << ExportDocPosition.build(**export_doc_position) if export_doc_position.is_a?(Hash)
15
18
  end
16
- new({ export_doc_positions: array_of_export_doc_positions }.merge(attributes))
19
+ new(**{ export_doc_positions: array_of_export_doc_positions }.merge(attributes))
17
20
  end
18
21
 
19
22
  def initialize(**attributes)
@@ -2,12 +2,12 @@ module Dhl::Bcs::V2
2
2
  # finds proper class from attributes and builds object
3
3
  class Locator
4
4
 
5
- def self.for(attributes = {})
6
- location_class = location_class_finder(attributes)
5
+ def self.for(**attributes)
6
+ location_class = location_class_finder(**attributes)
7
7
  location_builder(attributes, location_class: location_class)
8
8
  end
9
9
 
10
- def self.location_class_finder(attributes)
10
+ def self.location_class_finder(**attributes)
11
11
  if attributes.key?(:packstation_number)
12
12
  Packstation
13
13
  elsif attributes.key?(:postfilial_number)
@@ -20,7 +20,7 @@ module Dhl::Bcs::V2
20
20
  end
21
21
 
22
22
  def self.location_builder(attributes = {}, location_class: Address)
23
- location_class.build(attributes)
23
+ location_class.build(**attributes)
24
24
  end
25
25
 
26
26
  end
@@ -7,9 +7,9 @@ module Dhl::Bcs::V2
7
7
  attr_accessor(*PROPERTIES)
8
8
 
9
9
  def self.build(name: nil, **attributes)
10
- communication = Communication.build(attributes)
11
- location = Locator.for(attributes)
12
- new(attributes.merge(name: name, communication: communication, location: location))
10
+ communication = Communication.build(**attributes)
11
+ location = Locator.for(**attributes)
12
+ new(**attributes.merge(name: name, communication: communication, location: location))
13
13
  end
14
14
 
15
15
  def initialize(**attributes)
@@ -23,14 +23,14 @@ module Dhl::Bcs::V2
23
23
 
24
24
  # build a shipment from hash data
25
25
  def self.build(shipper:, receiver:, bank_data: nil, export_document: nil, **shipment_attributes)
26
- shipper = Shipper.build(shipper) if shipper.is_a?(Hash)
27
- receiver = Receiver.build(receiver) if receiver.is_a?(Hash)
28
- bank_data = BankData.build(bank_data) if bank_data.is_a?(Hash)
29
- export_document = ExportDocument.build(export_document.delete(:export_doc_positions),export_document) if export_document.is_a?(Hash)
30
- new({ shipper: shipper, receiver: receiver, bank_data: bank_data, export_document: export_document }.merge(shipment_attributes))
26
+ shipper = Shipper.build(**shipper) if shipper.is_a?(Hash)
27
+ receiver = Receiver.build(**receiver) if receiver.is_a?(Hash)
28
+ bank_data = BankData.build(**bank_data) if bank_data.is_a?(Hash)
29
+ export_document = ExportDocument.build(export_document.delete(:export_doc_positions), **export_document) if export_document.is_a?(Hash)
30
+ new(**{ shipper: shipper, receiver: receiver, bank_data: bank_data, export_document: export_document }.merge(shipment_attributes))
31
31
  end
32
32
 
33
- def initialize(attributes = {})
33
+ def initialize(**attributes)
34
34
  assign_attributes(
35
35
  {
36
36
  product: 'V01PAK',
@@ -6,9 +6,9 @@ module Dhl::Bcs::V2
6
6
  attr_accessor(*PROPERTIES)
7
7
 
8
8
  def self.build(company: nil, **attributes)
9
- address = Address.build(attributes)
10
- communication = Communication.build(attributes)
11
- new(attributes.merge(address: address, communication: communication, company: company))
9
+ address = Address.build(**attributes)
10
+ communication = Communication.build(**attributes)
11
+ new(**attributes.merge(address: address, communication: communication, company: company))
12
12
  end
13
13
 
14
14
  def initialize(**attributes)
@@ -1,5 +1,5 @@
1
1
  module Dhl
2
2
  module Bcs
3
- VERSION = "0.3.0"
3
+ VERSION = "0.4.0"
4
4
  end
5
5
  end
data/lib/dhl/bcs.rb CHANGED
@@ -19,24 +19,24 @@ require 'dhl/bcs/v2/export_document'
19
19
  module Dhl
20
20
  module Bcs
21
21
 
22
- def self.client(config, options = {})
23
- V2::Client.new(config, options)
22
+ def self.client(config, **options)
23
+ V2::Client.new(config, **options)
24
24
  end
25
25
 
26
- def self.build_shipment(*args)
27
- V2::Shipment.build(*args)
26
+ def self.build_shipment(**opts)
27
+ V2::Shipment.build(**opts)
28
28
  end
29
29
 
30
- def self.build_shipper(*args)
31
- V2::Shipper.build(*args)
30
+ def self.build_shipper(**opts)
31
+ V2::Shipper.build(**opts)
32
32
  end
33
33
 
34
- def self.build_receiver(*args)
35
- V2::Receiver.build(*args)
34
+ def self.build_receiver(**opts)
35
+ V2::Receiver.build(**opts)
36
36
  end
37
37
 
38
- def self.build_service(*args)
39
- V2::Service.new(*args)
38
+ def self.build_service(**opts)
39
+ V2::Service.new(**opts)
40
40
  end
41
41
 
42
42
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dhl-bcs
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Christoph Wagner
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-06-18 00:00:00.000000000 Z
11
+ date: 2023-03-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: savon
@@ -30,70 +30,70 @@ dependencies:
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: '1.16'
33
+ version: '2.3'
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: '1.16'
40
+ version: '2.3'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: rake
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
45
  - - "~>"
46
46
  - !ruby/object:Gem::Version
47
- version: '12.3'
47
+ version: '13.0'
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
52
  - - "~>"
53
53
  - !ruby/object:Gem::Version
54
- version: '12.3'
54
+ version: '13.0'
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: minitest
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
59
  - - "~>"
60
60
  - !ruby/object:Gem::Version
61
- version: '5.11'
61
+ version: '5.15'
62
62
  type: :development
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
66
  - - "~>"
67
67
  - !ruby/object:Gem::Version
68
- version: '5.11'
68
+ version: '5.15'
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: webmock
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
73
  - - "~>"
74
74
  - !ruby/object:Gem::Version
75
- version: '3.3'
75
+ version: '3.14'
76
76
  type: :development
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
80
  - - "~>"
81
81
  - !ruby/object:Gem::Version
82
- version: '3.3'
82
+ version: '3.14'
83
83
  - !ruby/object:Gem::Dependency
84
84
  name: pry-byebug
85
85
  requirement: !ruby/object:Gem::Requirement
86
86
  requirements:
87
87
  - - "~>"
88
88
  - !ruby/object:Gem::Version
89
- version: '3.6'
89
+ version: '3.9'
90
90
  type: :development
91
91
  prerelease: false
92
92
  version_requirements: !ruby/object:Gem::Requirement
93
93
  requirements:
94
94
  - - "~>"
95
95
  - !ruby/object:Gem::Version
96
- version: '3.6'
96
+ version: '3.9'
97
97
  description: This is inspired by the dhl-intraship gem that is a little bit outdated
98
98
  and doesn't support the new DHL API. If you need DHL Express Services this is not
99
99
  for you.
@@ -109,6 +109,7 @@ files:
109
109
  - ".travis.yml"
110
110
  - CODE_OF_CONDUCT.md
111
111
  - Gemfile
112
+ - Gemfile.lock
112
113
  - LICENSE.txt
113
114
  - README.md
114
115
  - Rakefile
@@ -137,7 +138,7 @@ homepage: https://github.com/webit-de/dhl-bcs
137
138
  licenses:
138
139
  - MIT
139
140
  metadata: {}
140
- post_install_message:
141
+ post_install_message:
141
142
  rdoc_options: []
142
143
  require_paths:
143
144
  - lib
@@ -152,9 +153,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
152
153
  - !ruby/object:Gem::Version
153
154
  version: '0'
154
155
  requirements: []
155
- rubyforge_project:
156
- rubygems_version: 2.7.3
157
- signing_key:
156
+ rubygems_version: 3.3.7
157
+ signing_key:
158
158
  specification_version: 4
159
159
  summary: Client for DHL Business-Customer-Shipping SOAP API 2.0
160
160
  test_files: []