apimatic-pnl-sdk 1.0.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.
Files changed (172) hide show
  1. checksums.yaml +7 -0
  2. data/LICENSE +28 -0
  3. data/README.md +164 -0
  4. data/bin/console +15 -0
  5. data/lib/postnl_ecommerce/api_helper.rb +10 -0
  6. data/lib/postnl_ecommerce/client.rb +126 -0
  7. data/lib/postnl_ecommerce/configuration.rb +195 -0
  8. data/lib/postnl_ecommerce/controllers/barcode_controller.rb +71 -0
  9. data/lib/postnl_ecommerce/controllers/base_controller.rb +60 -0
  10. data/lib/postnl_ecommerce/controllers/checkout_controller.rb +45 -0
  11. data/lib/postnl_ecommerce/controllers/confirming_controller.rb +45 -0
  12. data/lib/postnl_ecommerce/controllers/deliverydate_controller.rb +233 -0
  13. data/lib/postnl_ecommerce/controllers/labelling_controller.rb +52 -0
  14. data/lib/postnl_ecommerce/controllers/locations_controller.rb +271 -0
  15. data/lib/postnl_ecommerce/controllers/postalcode_check_controller.rb +60 -0
  16. data/lib/postnl_ecommerce/controllers/shipment_controller.rb +52 -0
  17. data/lib/postnl_ecommerce/controllers/shipping_status_controller.rb +222 -0
  18. data/lib/postnl_ecommerce/controllers/timeframes_controller.rb +90 -0
  19. data/lib/postnl_ecommerce/exceptions/api_exception.rb +21 -0
  20. data/lib/postnl_ecommerce/exceptions/barcode_response_invalid_exception.rb +57 -0
  21. data/lib/postnl_ecommerce/exceptions/confirming_response_error_exception.rb +55 -0
  22. data/lib/postnl_ecommerce/exceptions/internal_server_error_exception.rb +46 -0
  23. data/lib/postnl_ecommerce/exceptions/invalid_request_exception.rb +62 -0
  24. data/lib/postnl_ecommerce/exceptions/labelling_response_invalid_exception.rb +57 -0
  25. data/lib/postnl_ecommerce/exceptions/method_not_allowed_only_get_exception.rb +53 -0
  26. data/lib/postnl_ecommerce/exceptions/method_not_allowed_only_get_post_exception.rb +53 -0
  27. data/lib/postnl_ecommerce/exceptions/method_not_allowed_only_post_exception.rb +53 -0
  28. data/lib/postnl_ecommerce/exceptions/postalcode_check_response_invalid_exception.rb +55 -0
  29. data/lib/postnl_ecommerce/exceptions/too_many_requests_exception.rb +53 -0
  30. data/lib/postnl_ecommerce/exceptions/unauthorized_exception.rb +53 -0
  31. data/lib/postnl_ecommerce/http/api_response.rb +19 -0
  32. data/lib/postnl_ecommerce/http/auth/custom_header_authentication.rb +52 -0
  33. data/lib/postnl_ecommerce/http/http_call_back.rb +10 -0
  34. data/lib/postnl_ecommerce/http/http_method_enum.rb +10 -0
  35. data/lib/postnl_ecommerce/http/http_request.rb +10 -0
  36. data/lib/postnl_ecommerce/http/http_response.rb +10 -0
  37. data/lib/postnl_ecommerce/http/proxy_settings.rb +22 -0
  38. data/lib/postnl_ecommerce/models/address.rb +240 -0
  39. data/lib/postnl_ecommerce/models/address_type_enum.rb +36 -0
  40. data/lib/postnl_ecommerce/models/amount.rb +138 -0
  41. data/lib/postnl_ecommerce/models/barcode_error.rb +71 -0
  42. data/lib/postnl_ecommerce/models/barcode_response.rb +62 -0
  43. data/lib/postnl_ecommerce/models/base_model.rb +110 -0
  44. data/lib/postnl_ecommerce/models/checkout_address.rb +120 -0
  45. data/lib/postnl_ecommerce/models/checkout_cut_off_day_enum.rb +61 -0
  46. data/lib/postnl_ecommerce/models/checkout_cut_off_time.rb +91 -0
  47. data/lib/postnl_ecommerce/models/checkout_cut_off_type_enum.rb +40 -0
  48. data/lib/postnl_ecommerce/models/checkout_delivery_option.rb +81 -0
  49. data/lib/postnl_ecommerce/models/checkout_location.rb +126 -0
  50. data/lib/postnl_ecommerce/models/checkout_option_enum.rb +64 -0
  51. data/lib/postnl_ecommerce/models/checkout_pickup_address.rb +112 -0
  52. data/lib/postnl_ecommerce/models/checkout_pickup_option.rb +103 -0
  53. data/lib/postnl_ecommerce/models/checkout_request.rb +152 -0
  54. data/lib/postnl_ecommerce/models/checkout_response.rb +110 -0
  55. data/lib/postnl_ecommerce/models/checkout_time_frame.rb +108 -0
  56. data/lib/postnl_ecommerce/models/checkout_warning.rb +95 -0
  57. data/lib/postnl_ecommerce/models/checkout_warning_option_enum.rb +68 -0
  58. data/lib/postnl_ecommerce/models/code_enum.rb +44 -0
  59. data/lib/postnl_ecommerce/models/complete_status.rb +62 -0
  60. data/lib/postnl_ecommerce/models/complete_status_shipment.rb +270 -0
  61. data/lib/postnl_ecommerce/models/confirming_custom.rb +239 -0
  62. data/lib/postnl_ecommerce/models/confirming_custom_content.rb +113 -0
  63. data/lib/postnl_ecommerce/models/confirming_error.rb +71 -0
  64. data/lib/postnl_ecommerce/models/confirming_message.rb +70 -0
  65. data/lib/postnl_ecommerce/models/confirming_request.rb +86 -0
  66. data/lib/postnl_ecommerce/models/confirming_response.rb +71 -0
  67. data/lib/postnl_ecommerce/models/confirming_response_shipment.rb +103 -0
  68. data/lib/postnl_ecommerce/models/confirming_shipment.rb +472 -0
  69. data/lib/postnl_ecommerce/models/contact.rb +101 -0
  70. data/lib/postnl_ecommerce/models/countrycode_enum.rb +36 -0
  71. data/lib/postnl_ecommerce/models/currency_enum.rb +44 -0
  72. data/lib/postnl_ecommerce/models/currency_labelling_api_enum.rb +36 -0
  73. data/lib/postnl_ecommerce/models/current_status.rb +62 -0
  74. data/lib/postnl_ecommerce/models/current_status_shipment.rb +207 -0
  75. data/lib/postnl_ecommerce/models/customer.rb +123 -0
  76. data/lib/postnl_ecommerce/models/customer_address.rb +237 -0
  77. data/lib/postnl_ecommerce/models/customs.rb +238 -0
  78. data/lib/postnl_ecommerce/models/customs_labelling_api.rb +238 -0
  79. data/lib/postnl_ecommerce/models/delivery_options.rb +64 -0
  80. data/lib/postnl_ecommerce/models/deliverydate_delivery_response.rb +87 -0
  81. data/lib/postnl_ecommerce/models/deliverydate_option_enum.rb +56 -0
  82. data/lib/postnl_ecommerce/models/deliverydate_options.rb +65 -0
  83. data/lib/postnl_ecommerce/models/deliverydate_shipping_response.rb +62 -0
  84. data/lib/postnl_ecommerce/models/detail.rb +62 -0
  85. data/lib/postnl_ecommerce/models/dimension.rb +106 -0
  86. data/lib/postnl_ecommerce/models/error.rb +73 -0
  87. data/lib/postnl_ecommerce/models/event.rb +127 -0
  88. data/lib/postnl_ecommerce/models/expectation.rb +71 -0
  89. data/lib/postnl_ecommerce/models/extra_field.rb +71 -0
  90. data/lib/postnl_ecommerce/models/fault.rb +71 -0
  91. data/lib/postnl_ecommerce/models/fault_shipping_status_api.rb +71 -0
  92. data/lib/postnl_ecommerce/models/friday.rb +62 -0
  93. data/lib/postnl_ecommerce/models/get_locations_result_multiple.rb +71 -0
  94. data/lib/postnl_ecommerce/models/get_locations_result_single.rb +62 -0
  95. data/lib/postnl_ecommerce/models/group.rb +97 -0
  96. data/lib/postnl_ecommerce/models/hazardous_material.rb +178 -0
  97. data/lib/postnl_ecommerce/models/labelling_customer.rb +123 -0
  98. data/lib/postnl_ecommerce/models/labelling_customer_labelling_api.rb +123 -0
  99. data/lib/postnl_ecommerce/models/labelling_customer_message.rb +83 -0
  100. data/lib/postnl_ecommerce/models/labelling_customer_shipment.rb +484 -0
  101. data/lib/postnl_ecommerce/models/labelling_customer_shipment_labelling_api.rb +484 -0
  102. data/lib/postnl_ecommerce/models/labelling_customs_content.rb +111 -0
  103. data/lib/postnl_ecommerce/models/labelling_error.rb +81 -0
  104. data/lib/postnl_ecommerce/models/labelling_label.rb +84 -0
  105. data/lib/postnl_ecommerce/models/labelling_merged_label.rb +80 -0
  106. data/lib/postnl_ecommerce/models/labelling_request.rb +112 -0
  107. data/lib/postnl_ecommerce/models/labelling_response.rb +95 -0
  108. data/lib/postnl_ecommerce/models/labelling_response_shipment.rb +123 -0
  109. data/lib/postnl_ecommerce/models/language_enum.rb +48 -0
  110. data/lib/postnl_ecommerce/models/location.rb +174 -0
  111. data/lib/postnl_ecommerce/models/location_response_single.rb +63 -0
  112. data/lib/postnl_ecommerce/models/locations_address.rb +122 -0
  113. data/lib/postnl_ecommerce/models/locations_delivery_option_enum.rb +40 -0
  114. data/lib/postnl_ecommerce/models/locations_opening_hours.rb +121 -0
  115. data/lib/postnl_ecommerce/models/locations_response_multiple.rb +63 -0
  116. data/lib/postnl_ecommerce/models/monday.rb +62 -0
  117. data/lib/postnl_ecommerce/models/no_timeframes_options.rb +62 -0
  118. data/lib/postnl_ecommerce/models/old_status.rb +106 -0
  119. data/lib/postnl_ecommerce/models/opening_hours.rb +121 -0
  120. data/lib/postnl_ecommerce/models/opening_hours_per_day.rb +71 -0
  121. data/lib/postnl_ecommerce/models/options.rb +64 -0
  122. data/lib/postnl_ecommerce/models/origin_country_code_enum.rb +36 -0
  123. data/lib/postnl_ecommerce/models/postalcode_check_address.rb +116 -0
  124. data/lib/postnl_ecommerce/models/postalcode_check_error.rb +81 -0
  125. data/lib/postnl_ecommerce/models/product_option.rb +74 -0
  126. data/lib/postnl_ecommerce/models/reason_no_timeframe.rb +104 -0
  127. data/lib/postnl_ecommerce/models/reason_no_timeframes.rb +71 -0
  128. data/lib/postnl_ecommerce/models/saturday.rb +62 -0
  129. data/lib/postnl_ecommerce/models/shipment_type_enum.rb +50 -0
  130. data/lib/postnl_ecommerce/models/shippingstatus_address.rb +204 -0
  131. data/lib/postnl_ecommerce/models/shippingstatus_amount.rb +75 -0
  132. data/lib/postnl_ecommerce/models/shippingstatus_customer.rb +83 -0
  133. data/lib/postnl_ecommerce/models/shippingstatus_dimension.rb +101 -0
  134. data/lib/postnl_ecommerce/models/shippingstatus_product_option.rb +74 -0
  135. data/lib/postnl_ecommerce/models/shippingstatus_product_options.rb +63 -0
  136. data/lib/postnl_ecommerce/models/shippingstatus_response.rb +94 -0
  137. data/lib/postnl_ecommerce/models/shippingstatus_response_signature.rb +71 -0
  138. data/lib/postnl_ecommerce/models/shippingstatus_response_updated_shipment.rb +105 -0
  139. data/lib/postnl_ecommerce/models/shippingstatus_warning.rb +71 -0
  140. data/lib/postnl_ecommerce/models/signature.rb +84 -0
  141. data/lib/postnl_ecommerce/models/status.rb +108 -0
  142. data/lib/postnl_ecommerce/models/sunday.rb +62 -0
  143. data/lib/postnl_ecommerce/models/sustainability.rb +73 -0
  144. data/lib/postnl_ecommerce/models/thursday.rb +62 -0
  145. data/lib/postnl_ecommerce/models/timeframe.rb +71 -0
  146. data/lib/postnl_ecommerce/models/timeframe_options_enum.rb +60 -0
  147. data/lib/postnl_ecommerce/models/timeframe_response.rb +74 -0
  148. data/lib/postnl_ecommerce/models/timeframe_timeframe.rb +96 -0
  149. data/lib/postnl_ecommerce/models/timeframes.rb +71 -0
  150. data/lib/postnl_ecommerce/models/timeframes_response_object.rb +71 -0
  151. data/lib/postnl_ecommerce/models/tuesday.rb +62 -0
  152. data/lib/postnl_ecommerce/models/type_enum.rb +64 -0
  153. data/lib/postnl_ecommerce/models/updated_shipment_status.rb +108 -0
  154. data/lib/postnl_ecommerce/models/warning.rb +71 -0
  155. data/lib/postnl_ecommerce/models/warnings.rb +62 -0
  156. data/lib/postnl_ecommerce/models/wednesday.rb +62 -0
  157. data/lib/postnl_ecommerce/utilities/date_time_helper.rb +11 -0
  158. data/lib/postnl_ecommerce/utilities/file_wrapper.rb +28 -0
  159. data/lib/postnl_ecommerce.rb +188 -0
  160. data/test/controllers/controller_test_base.rb +23 -0
  161. data/test/controllers/test_barcode_controller.rb +52 -0
  162. data/test/controllers/test_checkout_controller.rb +63 -0
  163. data/test/controllers/test_confirming_controller.rb +54 -0
  164. data/test/controllers/test_deliverydate_controller.rb +60 -0
  165. data/test/controllers/test_labelling_controller.rb +57 -0
  166. data/test/controllers/test_locations_controller.rb +185 -0
  167. data/test/controllers/test_postalcode_check_controller.rb +55 -0
  168. data/test/controllers/test_shipment_controller.rb +57 -0
  169. data/test/controllers/test_shipping_status_controller.rb +209 -0
  170. data/test/controllers/test_timeframes_controller.rb +67 -0
  171. data/test/http_response_catcher.rb +19 -0
  172. metadata +283 -0
@@ -0,0 +1,71 @@
1
+ # postnl_ecommerce
2
+ #
3
+ # This file was automatically generated for PostNL by
4
+ # APIMATIC v3.0 ( https://www.apimatic.io ).
5
+
6
+ module PostnlEcommerce
7
+ # Fault Model.
8
+ class Fault < BaseModel
9
+ SKIP = Object.new
10
+ private_constant :SKIP
11
+
12
+ # TODO: Write general description for this method
13
+ # @return [String]
14
+ attr_accessor :faultstring
15
+
16
+ # TODO: Write general description for this method
17
+ # @return [Detail]
18
+ attr_accessor :detail
19
+
20
+ # A mapping from model property names to API property names.
21
+ def self.names
22
+ @_hash = {} if @_hash.nil?
23
+ @_hash['faultstring'] = 'faultstring'
24
+ @_hash['detail'] = 'detail'
25
+ @_hash
26
+ end
27
+
28
+ # An array for optional fields
29
+ def self.optionals
30
+ %w[
31
+ faultstring
32
+ detail
33
+ ]
34
+ end
35
+
36
+ # An array for nullable fields
37
+ def self.nullables
38
+ []
39
+ end
40
+
41
+ def initialize(faultstring = SKIP, detail = SKIP)
42
+ @faultstring = faultstring unless faultstring == SKIP
43
+ @detail = detail unless detail == SKIP
44
+ end
45
+
46
+ # Creates an instance of the object from a hash.
47
+ def self.from_hash(hash)
48
+ return nil unless hash
49
+
50
+ # Extract variables from the hash.
51
+ faultstring = hash.key?('faultstring') ? hash['faultstring'] : SKIP
52
+ detail = Detail.from_hash(hash['detail']) if hash['detail']
53
+
54
+ # Create object from extracted values.
55
+ Fault.new(faultstring,
56
+ detail)
57
+ end
58
+
59
+ # Provides a human-readable string representation of the object.
60
+ def to_s
61
+ class_name = self.class.name.split('::').last
62
+ "<#{class_name} faultstring: #{@faultstring}, detail: #{@detail}>"
63
+ end
64
+
65
+ # Provides a debugging-friendly string with detailed object information.
66
+ def inspect
67
+ class_name = self.class.name.split('::').last
68
+ "<#{class_name} faultstring: #{@faultstring.inspect}, detail: #{@detail.inspect}>"
69
+ end
70
+ end
71
+ end
@@ -0,0 +1,71 @@
1
+ # postnl_ecommerce
2
+ #
3
+ # This file was automatically generated for PostNL by
4
+ # APIMATIC v3.0 ( https://www.apimatic.io ).
5
+
6
+ module PostnlEcommerce
7
+ # FaultShippingStatusAPI Model.
8
+ class FaultShippingStatusAPI < BaseModel
9
+ SKIP = Object.new
10
+ private_constant :SKIP
11
+
12
+ # TODO: Write general description for this method
13
+ # @return [String]
14
+ attr_accessor :faultstring
15
+
16
+ # TODO: Write general description for this method
17
+ # @return [Detail]
18
+ attr_accessor :detail
19
+
20
+ # A mapping from model property names to API property names.
21
+ def self.names
22
+ @_hash = {} if @_hash.nil?
23
+ @_hash['faultstring'] = 'faultstring'
24
+ @_hash['detail'] = 'detail'
25
+ @_hash
26
+ end
27
+
28
+ # An array for optional fields
29
+ def self.optionals
30
+ %w[
31
+ faultstring
32
+ detail
33
+ ]
34
+ end
35
+
36
+ # An array for nullable fields
37
+ def self.nullables
38
+ []
39
+ end
40
+
41
+ def initialize(faultstring = SKIP, detail = SKIP)
42
+ @faultstring = faultstring unless faultstring == SKIP
43
+ @detail = detail unless detail == SKIP
44
+ end
45
+
46
+ # Creates an instance of the object from a hash.
47
+ def self.from_hash(hash)
48
+ return nil unless hash
49
+
50
+ # Extract variables from the hash.
51
+ faultstring = hash.key?('faultstring') ? hash['faultstring'] : SKIP
52
+ detail = Detail.from_hash(hash['detail']) if hash['detail']
53
+
54
+ # Create object from extracted values.
55
+ FaultShippingStatusAPI.new(faultstring,
56
+ detail)
57
+ end
58
+
59
+ # Provides a human-readable string representation of the object.
60
+ def to_s
61
+ class_name = self.class.name.split('::').last
62
+ "<#{class_name} faultstring: #{@faultstring}, detail: #{@detail}>"
63
+ end
64
+
65
+ # Provides a debugging-friendly string with detailed object information.
66
+ def inspect
67
+ class_name = self.class.name.split('::').last
68
+ "<#{class_name} faultstring: #{@faultstring.inspect}, detail: #{@detail.inspect}>"
69
+ end
70
+ end
71
+ end
@@ -0,0 +1,62 @@
1
+ # postnl_ecommerce
2
+ #
3
+ # This file was automatically generated for PostNL by
4
+ # APIMATIC v3.0 ( https://www.apimatic.io ).
5
+
6
+ module PostnlEcommerce
7
+ # Friday Model.
8
+ class Friday < BaseModel
9
+ SKIP = Object.new
10
+ private_constant :SKIP
11
+
12
+ # TODO: Write general description for this method
13
+ # @return [String]
14
+ attr_accessor :string
15
+
16
+ # A mapping from model property names to API property names.
17
+ def self.names
18
+ @_hash = {} if @_hash.nil?
19
+ @_hash['string'] = 'string'
20
+ @_hash
21
+ end
22
+
23
+ # An array for optional fields
24
+ def self.optionals
25
+ %w[
26
+ string
27
+ ]
28
+ end
29
+
30
+ # An array for nullable fields
31
+ def self.nullables
32
+ []
33
+ end
34
+
35
+ def initialize(string = SKIP)
36
+ @string = string unless string == SKIP
37
+ end
38
+
39
+ # Creates an instance of the object from a hash.
40
+ def self.from_hash(hash)
41
+ return nil unless hash
42
+
43
+ # Extract variables from the hash.
44
+ string = hash.key?('string') ? hash['string'] : SKIP
45
+
46
+ # Create object from extracted values.
47
+ Friday.new(string)
48
+ end
49
+
50
+ # Provides a human-readable string representation of the object.
51
+ def to_s
52
+ class_name = self.class.name.split('::').last
53
+ "<#{class_name} string: #{@string}>"
54
+ end
55
+
56
+ # Provides a debugging-friendly string with detailed object information.
57
+ def inspect
58
+ class_name = self.class.name.split('::').last
59
+ "<#{class_name} string: #{@string.inspect}>"
60
+ end
61
+ end
62
+ end
@@ -0,0 +1,71 @@
1
+ # postnl_ecommerce
2
+ #
3
+ # This file was automatically generated for PostNL by
4
+ # APIMATIC v3.0 ( https://www.apimatic.io ).
5
+
6
+ module PostnlEcommerce
7
+ # GetLocationsResultMultiple Model.
8
+ class GetLocationsResultMultiple < BaseModel
9
+ SKIP = Object.new
10
+ private_constant :SKIP
11
+
12
+ # TODO: Write general description for this method
13
+ # @return [Array[Location]]
14
+ attr_accessor :response_location
15
+
16
+ # A mapping from model property names to API property names.
17
+ def self.names
18
+ @_hash = {} if @_hash.nil?
19
+ @_hash['response_location'] = 'ResponseLocation'
20
+ @_hash
21
+ end
22
+
23
+ # An array for optional fields
24
+ def self.optionals
25
+ %w[
26
+ response_location
27
+ ]
28
+ end
29
+
30
+ # An array for nullable fields
31
+ def self.nullables
32
+ []
33
+ end
34
+
35
+ def initialize(response_location = SKIP)
36
+ @response_location = response_location unless response_location == SKIP
37
+ end
38
+
39
+ # Creates an instance of the object from a hash.
40
+ def self.from_hash(hash)
41
+ return nil unless hash
42
+
43
+ # Extract variables from the hash.
44
+ # Parameter is an array, so we need to iterate through it
45
+ response_location = nil
46
+ unless hash['ResponseLocation'].nil?
47
+ response_location = []
48
+ hash['ResponseLocation'].each do |structure|
49
+ response_location << (Location.from_hash(structure) if structure)
50
+ end
51
+ end
52
+
53
+ response_location = SKIP unless hash.key?('ResponseLocation')
54
+
55
+ # Create object from extracted values.
56
+ GetLocationsResultMultiple.new(response_location)
57
+ end
58
+
59
+ # Provides a human-readable string representation of the object.
60
+ def to_s
61
+ class_name = self.class.name.split('::').last
62
+ "<#{class_name} response_location: #{@response_location}>"
63
+ end
64
+
65
+ # Provides a debugging-friendly string with detailed object information.
66
+ def inspect
67
+ class_name = self.class.name.split('::').last
68
+ "<#{class_name} response_location: #{@response_location.inspect}>"
69
+ end
70
+ end
71
+ end
@@ -0,0 +1,62 @@
1
+ # postnl_ecommerce
2
+ #
3
+ # This file was automatically generated for PostNL by
4
+ # APIMATIC v3.0 ( https://www.apimatic.io ).
5
+
6
+ module PostnlEcommerce
7
+ # GetLocationsResultSingle Model.
8
+ class GetLocationsResultSingle < BaseModel
9
+ SKIP = Object.new
10
+ private_constant :SKIP
11
+
12
+ # TODO: Write general description for this method
13
+ # @return [Location]
14
+ attr_accessor :response_location
15
+
16
+ # A mapping from model property names to API property names.
17
+ def self.names
18
+ @_hash = {} if @_hash.nil?
19
+ @_hash['response_location'] = 'ResponseLocation'
20
+ @_hash
21
+ end
22
+
23
+ # An array for optional fields
24
+ def self.optionals
25
+ %w[
26
+ response_location
27
+ ]
28
+ end
29
+
30
+ # An array for nullable fields
31
+ def self.nullables
32
+ []
33
+ end
34
+
35
+ def initialize(response_location = SKIP)
36
+ @response_location = response_location unless response_location == SKIP
37
+ end
38
+
39
+ # Creates an instance of the object from a hash.
40
+ def self.from_hash(hash)
41
+ return nil unless hash
42
+
43
+ # Extract variables from the hash.
44
+ response_location = Location.from_hash(hash['ResponseLocation']) if hash['ResponseLocation']
45
+
46
+ # Create object from extracted values.
47
+ GetLocationsResultSingle.new(response_location)
48
+ end
49
+
50
+ # Provides a human-readable string representation of the object.
51
+ def to_s
52
+ class_name = self.class.name.split('::').last
53
+ "<#{class_name} response_location: #{@response_location}>"
54
+ end
55
+
56
+ # Provides a debugging-friendly string with detailed object information.
57
+ def inspect
58
+ class_name = self.class.name.split('::').last
59
+ "<#{class_name} response_location: #{@response_location.inspect}>"
60
+ end
61
+ end
62
+ end
@@ -0,0 +1,97 @@
1
+ # postnl_ecommerce
2
+ #
3
+ # This file was automatically generated for PostNL by
4
+ # APIMATIC v3.0 ( https://www.apimatic.io ).
5
+
6
+ module PostnlEcommerce
7
+ # Group Model.
8
+ class Group < BaseModel
9
+ SKIP = Object.new
10
+ private_constant :SKIP
11
+
12
+ # Group sort that determines the type of group that is indicated. This is a
13
+ # code. For possible values, please see
14
+ # [here](https://developer.postnl.nl/docs/#/http/reference-data/reference-co
15
+ # des/group-types)
16
+ # @return [String]
17
+ attr_accessor :group_type
18
+
19
+ # Sequence number of the collo within the complete shipment (e.g. collo 2 of
20
+ # 4) Mandatory for multicollo shipments
21
+ # @return [Integer]
22
+ attr_accessor :group_sequence
23
+
24
+ # Total number of colli in the shipment (in case of multicolli shipments)
25
+ # Mandatory for multicollo shipments
26
+ # @return [Integer]
27
+ attr_accessor :group_count
28
+
29
+ # Main barcode for the shipment (in case of multicolli shipments) Mandatory
30
+ # for multicollo shipments
31
+ # @return [String]
32
+ attr_accessor :main_barcode
33
+
34
+ # A mapping from model property names to API property names.
35
+ def self.names
36
+ @_hash = {} if @_hash.nil?
37
+ @_hash['group_type'] = 'GroupType'
38
+ @_hash['group_sequence'] = 'GroupSequence'
39
+ @_hash['group_count'] = 'GroupCount'
40
+ @_hash['main_barcode'] = 'MainBarcode'
41
+ @_hash
42
+ end
43
+
44
+ # An array for optional fields
45
+ def self.optionals
46
+ %w[
47
+ group_sequence
48
+ group_count
49
+ ]
50
+ end
51
+
52
+ # An array for nullable fields
53
+ def self.nullables
54
+ []
55
+ end
56
+
57
+ def initialize(group_type = nil, main_barcode = nil, group_sequence = SKIP,
58
+ group_count = SKIP)
59
+ @group_type = group_type
60
+ @group_sequence = group_sequence unless group_sequence == SKIP
61
+ @group_count = group_count unless group_count == SKIP
62
+ @main_barcode = main_barcode
63
+ end
64
+
65
+ # Creates an instance of the object from a hash.
66
+ def self.from_hash(hash)
67
+ return nil unless hash
68
+
69
+ # Extract variables from the hash.
70
+ group_type = hash.key?('GroupType') ? hash['GroupType'] : nil
71
+ main_barcode = hash.key?('MainBarcode') ? hash['MainBarcode'] : nil
72
+ group_sequence = hash.key?('GroupSequence') ? hash['GroupSequence'] : SKIP
73
+ group_count = hash.key?('GroupCount') ? hash['GroupCount'] : SKIP
74
+
75
+ # Create object from extracted values.
76
+ Group.new(group_type,
77
+ main_barcode,
78
+ group_sequence,
79
+ group_count)
80
+ end
81
+
82
+ # Provides a human-readable string representation of the object.
83
+ def to_s
84
+ class_name = self.class.name.split('::').last
85
+ "<#{class_name} group_type: #{@group_type}, group_sequence: #{@group_sequence},"\
86
+ " group_count: #{@group_count}, main_barcode: #{@main_barcode}>"
87
+ end
88
+
89
+ # Provides a debugging-friendly string with detailed object information.
90
+ def inspect
91
+ class_name = self.class.name.split('::').last
92
+ "<#{class_name} group_type: #{@group_type.inspect}, group_sequence:"\
93
+ " #{@group_sequence.inspect}, group_count: #{@group_count.inspect}, main_barcode:"\
94
+ " #{@main_barcode.inspect}>"
95
+ end
96
+ end
97
+ end
@@ -0,0 +1,178 @@
1
+ # postnl_ecommerce
2
+ #
3
+ # This file was automatically generated for PostNL by
4
+ # APIMATIC v3.0 ( https://www.apimatic.io ).
5
+
6
+ module PostnlEcommerce
7
+ # HazardousMaterial Model.
8
+ class HazardousMaterial < BaseModel
9
+ SKIP = Object.new
10
+ private_constant :SKIP
11
+
12
+ # Toxic substance code as stated in the ADR agreement
13
+ # @return [String]
14
+ attr_accessor :toxic_substance_code
15
+
16
+ # Array of additional toxic substance codes as stated in the ADR agreement
17
+ # @return [Array[String]]
18
+ attr_accessor :additional_toxic_substance_code
19
+
20
+ # The amount of ADR points
21
+ # @return [String]
22
+ attr_accessor :adr_points
23
+
24
+ # The code indicating for which category of tunnels passage is prohibited
25
+ # with these goods.
26
+ # @return [String]
27
+ attr_accessor :tunnel_code
28
+
29
+ # Code identifying the category of the packaging material.
30
+ # @return [String]
31
+ attr_accessor :packaging_group_code
32
+
33
+ # Description of the packaging material
34
+ # @return [String]
35
+ attr_accessor :packaging_group_description
36
+
37
+ # Gross weight of the goods in grams.
38
+ # @return [String]
39
+ attr_accessor :gross_weight
40
+
41
+ # The UNDG number
42
+ # @return [String]
43
+ attr_accessor :undg_number
44
+
45
+ # The transport category code
46
+ # @return [String]
47
+ attr_accessor :transport_category_code
48
+
49
+ # The chemical technical description of the goods.
50
+ # @return [String]
51
+ attr_accessor :chemical_technical_description
52
+
53
+ # A mapping from model property names to API property names.
54
+ def self.names
55
+ @_hash = {} if @_hash.nil?
56
+ @_hash['toxic_substance_code'] = 'ToxicSubstanceCode'
57
+ @_hash['additional_toxic_substance_code'] =
58
+ 'AdditionalToxicSubstanceCode'
59
+ @_hash['adr_points'] = 'ADRPoints'
60
+ @_hash['tunnel_code'] = 'TunnelCode'
61
+ @_hash['packaging_group_code'] = 'PackagingGroupCode'
62
+ @_hash['packaging_group_description'] = 'PackagingGroupDescription'
63
+ @_hash['gross_weight'] = 'GrossWeight'
64
+ @_hash['undg_number'] = 'UNDGNumber'
65
+ @_hash['transport_category_code'] = 'TransportCategoryCode'
66
+ @_hash['chemical_technical_description'] =
67
+ 'ChemicalTechnicalDescription'
68
+ @_hash
69
+ end
70
+
71
+ # An array for optional fields
72
+ def self.optionals
73
+ %w[
74
+ additional_toxic_substance_code
75
+ adr_points
76
+ tunnel_code
77
+ packaging_group_code
78
+ packaging_group_description
79
+ gross_weight
80
+ undg_number
81
+ transport_category_code
82
+ chemical_technical_description
83
+ ]
84
+ end
85
+
86
+ # An array for nullable fields
87
+ def self.nullables
88
+ []
89
+ end
90
+
91
+ def initialize(toxic_substance_code = nil,
92
+ additional_toxic_substance_code = SKIP, adr_points = SKIP,
93
+ tunnel_code = SKIP, packaging_group_code = SKIP,
94
+ packaging_group_description = SKIP, gross_weight = SKIP,
95
+ undg_number = SKIP, transport_category_code = SKIP,
96
+ chemical_technical_description = SKIP)
97
+ @toxic_substance_code = toxic_substance_code
98
+ unless additional_toxic_substance_code == SKIP
99
+ @additional_toxic_substance_code =
100
+ additional_toxic_substance_code
101
+ end
102
+ @adr_points = adr_points unless adr_points == SKIP
103
+ @tunnel_code = tunnel_code unless tunnel_code == SKIP
104
+ @packaging_group_code = packaging_group_code unless packaging_group_code == SKIP
105
+ unless packaging_group_description == SKIP
106
+ @packaging_group_description =
107
+ packaging_group_description
108
+ end
109
+ @gross_weight = gross_weight unless gross_weight == SKIP
110
+ @undg_number = undg_number unless undg_number == SKIP
111
+ @transport_category_code = transport_category_code unless transport_category_code == SKIP
112
+ unless chemical_technical_description == SKIP
113
+ @chemical_technical_description =
114
+ chemical_technical_description
115
+ end
116
+ end
117
+
118
+ # Creates an instance of the object from a hash.
119
+ def self.from_hash(hash)
120
+ return nil unless hash
121
+
122
+ # Extract variables from the hash.
123
+ toxic_substance_code =
124
+ hash.key?('ToxicSubstanceCode') ? hash['ToxicSubstanceCode'] : nil
125
+ additional_toxic_substance_code =
126
+ hash.key?('AdditionalToxicSubstanceCode') ? hash['AdditionalToxicSubstanceCode'] : SKIP
127
+ adr_points = hash.key?('ADRPoints') ? hash['ADRPoints'] : SKIP
128
+ tunnel_code = hash.key?('TunnelCode') ? hash['TunnelCode'] : SKIP
129
+ packaging_group_code =
130
+ hash.key?('PackagingGroupCode') ? hash['PackagingGroupCode'] : SKIP
131
+ packaging_group_description =
132
+ hash.key?('PackagingGroupDescription') ? hash['PackagingGroupDescription'] : SKIP
133
+ gross_weight = hash.key?('GrossWeight') ? hash['GrossWeight'] : SKIP
134
+ undg_number = hash.key?('UNDGNumber') ? hash['UNDGNumber'] : SKIP
135
+ transport_category_code =
136
+ hash.key?('TransportCategoryCode') ? hash['TransportCategoryCode'] : SKIP
137
+ chemical_technical_description =
138
+ hash.key?('ChemicalTechnicalDescription') ? hash['ChemicalTechnicalDescription'] : SKIP
139
+
140
+ # Create object from extracted values.
141
+ HazardousMaterial.new(toxic_substance_code,
142
+ additional_toxic_substance_code,
143
+ adr_points,
144
+ tunnel_code,
145
+ packaging_group_code,
146
+ packaging_group_description,
147
+ gross_weight,
148
+ undg_number,
149
+ transport_category_code,
150
+ chemical_technical_description)
151
+ end
152
+
153
+ # Provides a human-readable string representation of the object.
154
+ def to_s
155
+ class_name = self.class.name.split('::').last
156
+ "<#{class_name} toxic_substance_code: #{@toxic_substance_code},"\
157
+ " additional_toxic_substance_code: #{@additional_toxic_substance_code}, adr_points:"\
158
+ " #{@adr_points}, tunnel_code: #{@tunnel_code}, packaging_group_code:"\
159
+ " #{@packaging_group_code}, packaging_group_description: #{@packaging_group_description},"\
160
+ " gross_weight: #{@gross_weight}, undg_number: #{@undg_number}, transport_category_code:"\
161
+ " #{@transport_category_code}, chemical_technical_description:"\
162
+ " #{@chemical_technical_description}>"
163
+ end
164
+
165
+ # Provides a debugging-friendly string with detailed object information.
166
+ def inspect
167
+ class_name = self.class.name.split('::').last
168
+ "<#{class_name} toxic_substance_code: #{@toxic_substance_code.inspect},"\
169
+ " additional_toxic_substance_code: #{@additional_toxic_substance_code.inspect}, adr_points:"\
170
+ " #{@adr_points.inspect}, tunnel_code: #{@tunnel_code.inspect}, packaging_group_code:"\
171
+ " #{@packaging_group_code.inspect}, packaging_group_description:"\
172
+ " #{@packaging_group_description.inspect}, gross_weight: #{@gross_weight.inspect},"\
173
+ " undg_number: #{@undg_number.inspect}, transport_category_code:"\
174
+ " #{@transport_category_code.inspect}, chemical_technical_description:"\
175
+ " #{@chemical_technical_description.inspect}>"
176
+ end
177
+ end
178
+ end