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,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
+ # The current status and old statuses of the shipment
8
+ class CompleteStatus < BaseModel
9
+ SKIP = Object.new
10
+ private_constant :SKIP
11
+
12
+ # TODO: Write general description for this method
13
+ # @return [CompleteStatusShipment]
14
+ attr_accessor :shipment
15
+
16
+ # A mapping from model property names to API property names.
17
+ def self.names
18
+ @_hash = {} if @_hash.nil?
19
+ @_hash['shipment'] = 'Shipment'
20
+ @_hash
21
+ end
22
+
23
+ # An array for optional fields
24
+ def self.optionals
25
+ %w[
26
+ shipment
27
+ ]
28
+ end
29
+
30
+ # An array for nullable fields
31
+ def self.nullables
32
+ []
33
+ end
34
+
35
+ def initialize(shipment = SKIP)
36
+ @shipment = shipment unless shipment == 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
+ shipment = CompleteStatusShipment.from_hash(hash['Shipment']) if hash['Shipment']
45
+
46
+ # Create object from extracted values.
47
+ CompleteStatus.new(shipment)
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} shipment: #{@shipment}>"
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} shipment: #{@shipment.inspect}>"
60
+ end
61
+ end
62
+ end
@@ -0,0 +1,270 @@
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
+ # CompleteStatusShipment Model.
8
+ class CompleteStatusShipment < BaseModel
9
+ SKIP = Object.new
10
+ private_constant :SKIP
11
+
12
+ # The main barcode of the shipment
13
+ # @return [String]
14
+ attr_accessor :main_barcode
15
+
16
+ # The barcode of the shipment
17
+ # @return [String]
18
+ attr_accessor :barcode
19
+
20
+ # The amount of parcels in the multi-collo shipment
21
+ # @return [String]
22
+ attr_accessor :shipment_amount
23
+
24
+ # The sequence of this parcel in the multi-collo shipment
25
+ # @return [String]
26
+ attr_accessor :shipment_counter
27
+
28
+ # The sequence of this parcel in the multi-collo shipment
29
+ # @return [ShippingstatusCustomer]
30
+ attr_accessor :customer
31
+
32
+ # The product code of the shipment
33
+ # @return [String]
34
+ attr_accessor :product_code
35
+
36
+ # The description of the product code
37
+ # @return [String]
38
+ attr_accessor :product_description
39
+
40
+ # The customer reference belonging to the shipment
41
+ # @return [String]
42
+ attr_accessor :reference
43
+
44
+ # The expected delivery date of the shipment
45
+ # @return [String]
46
+ attr_accessor :delivery_date
47
+
48
+ # The expected delivery date of the shipment
49
+ # @return [ShippingstatusDimension]
50
+ attr_accessor :dimension
51
+
52
+ # The amounts belonging to the shipment
53
+ # @return [ShippingstatusAmount]
54
+ attr_accessor :amount
55
+
56
+ # A list of addresses belonging to the shipment
57
+ # @return [Array[ShippingstatusAddress]]
58
+ attr_accessor :address
59
+
60
+ # The events of the shipment. (see the [Event
61
+ # Codes](https://developer.postnl.nl/docs/#/http/reference-data/t-t-status-c
62
+ # odes/event-codes) for possible values.
63
+ # @return [Array[Event]]
64
+ attr_accessor :event
65
+
66
+ # The expected delivery timeframe
67
+ # @return [Expectation]
68
+ attr_accessor :expectation
69
+
70
+ # A list of product options.
71
+ # @return [Array[ShippingstatusProductOptions]]
72
+ attr_accessor :product_options
73
+
74
+ # The current status of the shipment (see the [Status
75
+ # codes](https://developer.postnl.nl/docs/#/http/reference-data/t-t-status-c
76
+ # odes/event-codes) for possible values.
77
+ # @return [Status]
78
+ attr_accessor :status
79
+
80
+ # A list of previous status codes (see the [Status
81
+ # codes](https://developer.postnl.nl/docs/#/http/reference-data/t-t-status-c
82
+ # odes/event-codes) for possible values.
83
+ # @return [Array[OldStatus]]
84
+ attr_accessor :old_status
85
+
86
+ # A mapping from model property names to API property names.
87
+ def self.names
88
+ @_hash = {} if @_hash.nil?
89
+ @_hash['main_barcode'] = 'MainBarcode'
90
+ @_hash['barcode'] = 'Barcode'
91
+ @_hash['shipment_amount'] = 'ShipmentAmount'
92
+ @_hash['shipment_counter'] = 'ShipmentCounter'
93
+ @_hash['customer'] = 'Customer'
94
+ @_hash['product_code'] = 'ProductCode'
95
+ @_hash['product_description'] = 'ProductDescription'
96
+ @_hash['reference'] = 'Reference'
97
+ @_hash['delivery_date'] = 'DeliveryDate'
98
+ @_hash['dimension'] = 'Dimension'
99
+ @_hash['amount'] = 'Amount'
100
+ @_hash['address'] = 'Address'
101
+ @_hash['event'] = 'Event'
102
+ @_hash['expectation'] = 'Expectation'
103
+ @_hash['product_options'] = 'ProductOptions'
104
+ @_hash['status'] = 'Status'
105
+ @_hash['old_status'] = 'OldStatus'
106
+ @_hash
107
+ end
108
+
109
+ # An array for optional fields
110
+ def self.optionals
111
+ %w[
112
+ main_barcode
113
+ barcode
114
+ shipment_amount
115
+ shipment_counter
116
+ customer
117
+ product_code
118
+ product_description
119
+ reference
120
+ delivery_date
121
+ dimension
122
+ amount
123
+ address
124
+ event
125
+ expectation
126
+ product_options
127
+ status
128
+ old_status
129
+ ]
130
+ end
131
+
132
+ # An array for nullable fields
133
+ def self.nullables
134
+ []
135
+ end
136
+
137
+ def initialize(main_barcode = SKIP, barcode = SKIP, shipment_amount = SKIP,
138
+ shipment_counter = SKIP, customer = SKIP,
139
+ product_code = SKIP, product_description = SKIP,
140
+ reference = SKIP, delivery_date = SKIP, dimension = SKIP,
141
+ amount = SKIP, address = SKIP, event = SKIP,
142
+ expectation = SKIP, product_options = SKIP, status = SKIP,
143
+ old_status = SKIP)
144
+ @main_barcode = main_barcode unless main_barcode == SKIP
145
+ @barcode = barcode unless barcode == SKIP
146
+ @shipment_amount = shipment_amount unless shipment_amount == SKIP
147
+ @shipment_counter = shipment_counter unless shipment_counter == SKIP
148
+ @customer = customer unless customer == SKIP
149
+ @product_code = product_code unless product_code == SKIP
150
+ @product_description = product_description unless product_description == SKIP
151
+ @reference = reference unless reference == SKIP
152
+ @delivery_date = delivery_date unless delivery_date == SKIP
153
+ @dimension = dimension unless dimension == SKIP
154
+ @amount = amount unless amount == SKIP
155
+ @address = address unless address == SKIP
156
+ @event = event unless event == SKIP
157
+ @expectation = expectation unless expectation == SKIP
158
+ @product_options = product_options unless product_options == SKIP
159
+ @status = status unless status == SKIP
160
+ @old_status = old_status unless old_status == SKIP
161
+ end
162
+
163
+ # Creates an instance of the object from a hash.
164
+ def self.from_hash(hash)
165
+ return nil unless hash
166
+
167
+ # Extract variables from the hash.
168
+ main_barcode = hash.key?('MainBarcode') ? hash['MainBarcode'] : SKIP
169
+ barcode = hash.key?('Barcode') ? hash['Barcode'] : SKIP
170
+ shipment_amount =
171
+ hash.key?('ShipmentAmount') ? hash['ShipmentAmount'] : SKIP
172
+ shipment_counter =
173
+ hash.key?('ShipmentCounter') ? hash['ShipmentCounter'] : SKIP
174
+ customer = ShippingstatusCustomer.from_hash(hash['Customer']) if hash['Customer']
175
+ product_code = hash.key?('ProductCode') ? hash['ProductCode'] : SKIP
176
+ product_description =
177
+ hash.key?('ProductDescription') ? hash['ProductDescription'] : SKIP
178
+ reference = hash.key?('Reference') ? hash['Reference'] : SKIP
179
+ delivery_date = hash.key?('DeliveryDate') ? hash['DeliveryDate'] : SKIP
180
+ dimension = ShippingstatusDimension.from_hash(hash['Dimension']) if hash['Dimension']
181
+ amount = ShippingstatusAmount.from_hash(hash['Amount']) if hash['Amount']
182
+ # Parameter is an array, so we need to iterate through it
183
+ address = nil
184
+ unless hash['Address'].nil?
185
+ address = []
186
+ hash['Address'].each do |structure|
187
+ address << (ShippingstatusAddress.from_hash(structure) if structure)
188
+ end
189
+ end
190
+
191
+ address = SKIP unless hash.key?('Address')
192
+ # Parameter is an array, so we need to iterate through it
193
+ event = nil
194
+ unless hash['Event'].nil?
195
+ event = []
196
+ hash['Event'].each do |structure|
197
+ event << (Event.from_hash(structure) if structure)
198
+ end
199
+ end
200
+
201
+ event = SKIP unless hash.key?('Event')
202
+ expectation = Expectation.from_hash(hash['Expectation']) if hash['Expectation']
203
+ # Parameter is an array, so we need to iterate through it
204
+ product_options = nil
205
+ unless hash['ProductOptions'].nil?
206
+ product_options = []
207
+ hash['ProductOptions'].each do |structure|
208
+ product_options << (ShippingstatusProductOptions.from_hash(structure) if structure)
209
+ end
210
+ end
211
+
212
+ product_options = SKIP unless hash.key?('ProductOptions')
213
+ status = Status.from_hash(hash['Status']) if hash['Status']
214
+ # Parameter is an array, so we need to iterate through it
215
+ old_status = nil
216
+ unless hash['OldStatus'].nil?
217
+ old_status = []
218
+ hash['OldStatus'].each do |structure|
219
+ old_status << (OldStatus.from_hash(structure) if structure)
220
+ end
221
+ end
222
+
223
+ old_status = SKIP unless hash.key?('OldStatus')
224
+
225
+ # Create object from extracted values.
226
+ CompleteStatusShipment.new(main_barcode,
227
+ barcode,
228
+ shipment_amount,
229
+ shipment_counter,
230
+ customer,
231
+ product_code,
232
+ product_description,
233
+ reference,
234
+ delivery_date,
235
+ dimension,
236
+ amount,
237
+ address,
238
+ event,
239
+ expectation,
240
+ product_options,
241
+ status,
242
+ old_status)
243
+ end
244
+
245
+ # Provides a human-readable string representation of the object.
246
+ def to_s
247
+ class_name = self.class.name.split('::').last
248
+ "<#{class_name} main_barcode: #{@main_barcode}, barcode: #{@barcode}, shipment_amount:"\
249
+ " #{@shipment_amount}, shipment_counter: #{@shipment_counter}, customer: #{@customer},"\
250
+ " product_code: #{@product_code}, product_description: #{@product_description}, reference:"\
251
+ " #{@reference}, delivery_date: #{@delivery_date}, dimension: #{@dimension}, amount:"\
252
+ " #{@amount}, address: #{@address}, event: #{@event}, expectation: #{@expectation},"\
253
+ " product_options: #{@product_options}, status: #{@status}, old_status: #{@old_status}>"
254
+ end
255
+
256
+ # Provides a debugging-friendly string with detailed object information.
257
+ def inspect
258
+ class_name = self.class.name.split('::').last
259
+ "<#{class_name} main_barcode: #{@main_barcode.inspect}, barcode: #{@barcode.inspect},"\
260
+ " shipment_amount: #{@shipment_amount.inspect}, shipment_counter:"\
261
+ " #{@shipment_counter.inspect}, customer: #{@customer.inspect}, product_code:"\
262
+ " #{@product_code.inspect}, product_description: #{@product_description.inspect}, reference:"\
263
+ " #{@reference.inspect}, delivery_date: #{@delivery_date.inspect}, dimension:"\
264
+ " #{@dimension.inspect}, amount: #{@amount.inspect}, address: #{@address.inspect}, event:"\
265
+ " #{@event.inspect}, expectation: #{@expectation.inspect}, product_options:"\
266
+ " #{@product_options.inspect}, status: #{@status.inspect}, old_status:"\
267
+ " #{@old_status.inspect}>"
268
+ end
269
+ end
270
+ end
@@ -0,0 +1,239 @@
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
+ # ConfirmingCustom Model.
8
+ class ConfirmingCustom < BaseModel
9
+ SKIP = Object.new
10
+ private_constant :SKIP
11
+
12
+ # Fill in if applicable, for specific items a export certificate is obliged,
13
+ # as proof that the item complies to the sanity regulations, [more
14
+ # information](https://ondernemersplein.kvk.nl/fytosanitair-of-veterinair-ex
15
+ # portcertificaat-aanvragen/). Mandatory for Parcel shipments in the
16
+ # category type Commercial Goods, Commercial Sample and Returned Goods
17
+ # (Certificate, Invoice or License; at least 1 out of 3 must be selected)
18
+ # @return [TrueClass | FalseClass]
19
+ attr_accessor :certificate
20
+
21
+ # Mandatory when Certificate is true.
22
+ # @return [String]
23
+ attr_accessor :certificate_nr
24
+
25
+ # Fill in if applicable. Mandatory for Parcel shipments in the category type
26
+ # Commercial Goods, Commercial Sample and Returned Goods (Certificate,
27
+ # Invoice or License; at least 1 out of 3 must be selected).
28
+ # @return [TrueClass | FalseClass]
29
+ attr_accessor :license
30
+
31
+ # Mandatory when License is true.
32
+ # @return [String]
33
+ attr_accessor :license_nr
34
+
35
+ # Fill in the invoice number of the shipment. For a faster customs clearing
36
+ # process apply the invoice on the outside of the shipment. Mandatory for
37
+ # Parcel shipments in the category type Commercial Goods, Commercial Sample
38
+ # and Returned Goods (Certificate, Invoice or License; at least 1 out of 3
39
+ # must be selected).
40
+ # @return [TrueClass | FalseClass]
41
+ attr_accessor :invoice
42
+
43
+ # Mandatory when Invoice is true
44
+ # @return [String]
45
+ attr_accessor :invoice_nr
46
+
47
+ # Determines what to do when the shipment cannot be delivered the first time
48
+ # (if this is set to true,the shipment will be returned after the first
49
+ # failed attempt)
50
+ # @return [TrueClass | FalseClass]
51
+ attr_accessor :handle_as_non_deliverable
52
+
53
+ # Currency code. only EUR, GBP, USD and CNY are allowed.
54
+ # @return [CurrencyEnum]
55
+ attr_accessor :currency
56
+
57
+ # Type of shipment, possible values: Gift, Documents, Commercial Goods,
58
+ # Commercial Sample, Returned Goods. Is used to fill in the checkbox on the
59
+ # customs form on the shipment label.
60
+ # @return [ShipmentTypeEnum]
61
+ attr_accessor :shipment_type
62
+
63
+ # Use only when available. This is the reference of the sender. Depending on
64
+ # the destination with this ID, EORI, IOSS, TAX, VAT, VOEC*, the customs
65
+ # process can be faster. Only fill in this customs reference number if the
66
+ # sender is registrated as Trusted Shipper in the country of destination.
67
+ # *VOEC is a Norwegian VAT number.
68
+ # @return [String]
69
+ attr_accessor :trusted_shipper_id
70
+
71
+ # This is the reference of the recipient. Fill in a Tax Code or VAT number
72
+ # or Importer code. Depending on the destination with this reference the
73
+ # customs process can be faster. For example Brazil uses an TAXID number for
74
+ # natural persons, known as CPF.
75
+ # @return [String]
76
+ attr_accessor :importer_reference_code
77
+
78
+ # See the [Reference
79
+ # data](https://developer.postnl.nl/docs/#/http/reference-data/reference-cod
80
+ # es/transaction-codes) for possible values.
81
+ # @return [String]
82
+ attr_accessor :transaction_code
83
+
84
+ # Transaction description; see
85
+ # [here](https://developer.postnl.nl/docs/#/http/reference-data/reference-co
86
+ # des/transaction-codes) for common examples.
87
+ # @return [String]
88
+ attr_accessor :transaction_description
89
+
90
+ # The contents of the shipment. This section is mandatory (minimum once,
91
+ # maximum 5). Fill per unique item.
92
+ # @return [Array[ConfirmingCustomContent]]
93
+ attr_accessor :content
94
+
95
+ # A mapping from model property names to API property names.
96
+ def self.names
97
+ @_hash = {} if @_hash.nil?
98
+ @_hash['certificate'] = 'Certificate'
99
+ @_hash['certificate_nr'] = 'CertificateNr'
100
+ @_hash['license'] = 'License'
101
+ @_hash['license_nr'] = 'LicenseNr'
102
+ @_hash['invoice'] = 'Invoice'
103
+ @_hash['invoice_nr'] = 'InvoiceNr'
104
+ @_hash['handle_as_non_deliverable'] = 'HandleAsNonDeliverable'
105
+ @_hash['currency'] = 'Currency'
106
+ @_hash['shipment_type'] = 'ShipmentType'
107
+ @_hash['trusted_shipper_id'] = 'TrustedShipperID'
108
+ @_hash['importer_reference_code'] = 'ImporterReferenceCode'
109
+ @_hash['transaction_code'] = 'TransactionCode'
110
+ @_hash['transaction_description'] = 'TransactionDescription'
111
+ @_hash['content'] = 'Content'
112
+ @_hash
113
+ end
114
+
115
+ # An array for optional fields
116
+ def self.optionals
117
+ %w[
118
+ certificate
119
+ certificate_nr
120
+ license
121
+ license_nr
122
+ invoice
123
+ invoice_nr
124
+ handle_as_non_deliverable
125
+ trusted_shipper_id
126
+ importer_reference_code
127
+ transaction_code
128
+ transaction_description
129
+ ]
130
+ end
131
+
132
+ # An array for nullable fields
133
+ def self.nullables
134
+ []
135
+ end
136
+
137
+ def initialize(currency = nil, shipment_type = nil, content = nil,
138
+ certificate = SKIP, certificate_nr = SKIP, license = SKIP,
139
+ license_nr = SKIP, invoice = SKIP, invoice_nr = SKIP,
140
+ handle_as_non_deliverable = SKIP, trusted_shipper_id = SKIP,
141
+ importer_reference_code = SKIP, transaction_code = SKIP,
142
+ transaction_description = SKIP)
143
+ @certificate = certificate unless certificate == SKIP
144
+ @certificate_nr = certificate_nr unless certificate_nr == SKIP
145
+ @license = license unless license == SKIP
146
+ @license_nr = license_nr unless license_nr == SKIP
147
+ @invoice = invoice unless invoice == SKIP
148
+ @invoice_nr = invoice_nr unless invoice_nr == SKIP
149
+ unless handle_as_non_deliverable == SKIP
150
+ @handle_as_non_deliverable =
151
+ handle_as_non_deliverable
152
+ end
153
+ @currency = currency
154
+ @shipment_type = shipment_type
155
+ @trusted_shipper_id = trusted_shipper_id unless trusted_shipper_id == SKIP
156
+ @importer_reference_code = importer_reference_code unless importer_reference_code == SKIP
157
+ @transaction_code = transaction_code unless transaction_code == SKIP
158
+ @transaction_description = transaction_description unless transaction_description == SKIP
159
+ @content = content
160
+ end
161
+
162
+ # Creates an instance of the object from a hash.
163
+ def self.from_hash(hash)
164
+ return nil unless hash
165
+
166
+ # Extract variables from the hash.
167
+ currency = hash.key?('Currency') ? hash['Currency'] : nil
168
+ shipment_type = hash.key?('ShipmentType') ? hash['ShipmentType'] : nil
169
+ # Parameter is an array, so we need to iterate through it
170
+ content = nil
171
+ unless hash['Content'].nil?
172
+ content = []
173
+ hash['Content'].each do |structure|
174
+ content << (ConfirmingCustomContent.from_hash(structure) if structure)
175
+ end
176
+ end
177
+
178
+ content = nil unless hash.key?('Content')
179
+ certificate = hash.key?('Certificate') ? hash['Certificate'] : SKIP
180
+ certificate_nr = hash.key?('CertificateNr') ? hash['CertificateNr'] : SKIP
181
+ license = hash.key?('License') ? hash['License'] : SKIP
182
+ license_nr = hash.key?('LicenseNr') ? hash['LicenseNr'] : SKIP
183
+ invoice = hash.key?('Invoice') ? hash['Invoice'] : SKIP
184
+ invoice_nr = hash.key?('InvoiceNr') ? hash['InvoiceNr'] : SKIP
185
+ handle_as_non_deliverable =
186
+ hash.key?('HandleAsNonDeliverable') ? hash['HandleAsNonDeliverable'] : SKIP
187
+ trusted_shipper_id =
188
+ hash.key?('TrustedShipperID') ? hash['TrustedShipperID'] : SKIP
189
+ importer_reference_code =
190
+ hash.key?('ImporterReferenceCode') ? hash['ImporterReferenceCode'] : SKIP
191
+ transaction_code =
192
+ hash.key?('TransactionCode') ? hash['TransactionCode'] : SKIP
193
+ transaction_description =
194
+ hash.key?('TransactionDescription') ? hash['TransactionDescription'] : SKIP
195
+
196
+ # Create object from extracted values.
197
+ ConfirmingCustom.new(currency,
198
+ shipment_type,
199
+ content,
200
+ certificate,
201
+ certificate_nr,
202
+ license,
203
+ license_nr,
204
+ invoice,
205
+ invoice_nr,
206
+ handle_as_non_deliverable,
207
+ trusted_shipper_id,
208
+ importer_reference_code,
209
+ transaction_code,
210
+ transaction_description)
211
+ end
212
+
213
+ # Provides a human-readable string representation of the object.
214
+ def to_s
215
+ class_name = self.class.name.split('::').last
216
+ "<#{class_name} certificate: #{@certificate}, certificate_nr: #{@certificate_nr}, license:"\
217
+ " #{@license}, license_nr: #{@license_nr}, invoice: #{@invoice}, invoice_nr: #{@invoice_nr},"\
218
+ " handle_as_non_deliverable: #{@handle_as_non_deliverable}, currency: #{@currency},"\
219
+ " shipment_type: #{@shipment_type}, trusted_shipper_id: #{@trusted_shipper_id},"\
220
+ " importer_reference_code: #{@importer_reference_code}, transaction_code:"\
221
+ " #{@transaction_code}, transaction_description: #{@transaction_description}, content:"\
222
+ " #{@content}>"
223
+ end
224
+
225
+ # Provides a debugging-friendly string with detailed object information.
226
+ def inspect
227
+ class_name = self.class.name.split('::').last
228
+ "<#{class_name} certificate: #{@certificate.inspect}, certificate_nr:"\
229
+ " #{@certificate_nr.inspect}, license: #{@license.inspect}, license_nr:"\
230
+ " #{@license_nr.inspect}, invoice: #{@invoice.inspect}, invoice_nr: #{@invoice_nr.inspect},"\
231
+ " handle_as_non_deliverable: #{@handle_as_non_deliverable.inspect}, currency:"\
232
+ " #{@currency.inspect}, shipment_type: #{@shipment_type.inspect}, trusted_shipper_id:"\
233
+ " #{@trusted_shipper_id.inspect}, importer_reference_code:"\
234
+ " #{@importer_reference_code.inspect}, transaction_code: #{@transaction_code.inspect},"\
235
+ " transaction_description: #{@transaction_description.inspect}, content:"\
236
+ " #{@content.inspect}>"
237
+ end
238
+ end
239
+ end
@@ -0,0 +1,113 @@
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
+ # ConfirmingCustomContent Model.
8
+ class ConfirmingCustomContent < BaseModel
9
+ SKIP = Object.new
10
+ private_constant :SKIP
11
+
12
+ # Description of goods
13
+ # @return [String]
14
+ attr_accessor :description
15
+
16
+ # Fill in the total of the item(s)
17
+ # @return [Integer]
18
+ attr_accessor :quantity
19
+
20
+ # Net weight of goods in gram(gr)
21
+ # @return [Integer]
22
+ attr_accessor :weight
23
+
24
+ # Commercial (customs) value of goods. Fill in the value of the item(s).
25
+ # @return [Float]
26
+ attr_accessor :value
27
+
28
+ # Specify every item with the standard HS commodity code (6-8-10 digits
29
+ # HS-code), [more
30
+ # information](https://tarief.douane.nl/ite-tariff-public/#/home). Note:
31
+ # punctuation marks and symbols are not allowed.
32
+ # @return [String]
33
+ attr_accessor :hs_tariff_nr
34
+
35
+ # Fill in the code of the country where the item was produced (ISO-code),
36
+ # [more information](https://www.iso.org/home.html)
37
+ # @return [String]
38
+ attr_accessor :country_of_origin
39
+
40
+ # A mapping from model property names to API property names.
41
+ def self.names
42
+ @_hash = {} if @_hash.nil?
43
+ @_hash['description'] = 'Description'
44
+ @_hash['quantity'] = 'Quantity'
45
+ @_hash['weight'] = 'Weight'
46
+ @_hash['value'] = 'Value'
47
+ @_hash['hs_tariff_nr'] = 'HSTariffNr'
48
+ @_hash['country_of_origin'] = 'CountryOfOrigin'
49
+ @_hash
50
+ end
51
+
52
+ # An array for optional fields
53
+ def self.optionals
54
+ %w[
55
+ hs_tariff_nr
56
+ country_of_origin
57
+ ]
58
+ end
59
+
60
+ # An array for nullable fields
61
+ def self.nullables
62
+ []
63
+ end
64
+
65
+ def initialize(description = nil, quantity = nil, weight = nil, value = nil,
66
+ hs_tariff_nr = SKIP, country_of_origin = SKIP)
67
+ @description = description
68
+ @quantity = quantity
69
+ @weight = weight
70
+ @value = value
71
+ @hs_tariff_nr = hs_tariff_nr unless hs_tariff_nr == SKIP
72
+ @country_of_origin = country_of_origin unless country_of_origin == SKIP
73
+ end
74
+
75
+ # Creates an instance of the object from a hash.
76
+ def self.from_hash(hash)
77
+ return nil unless hash
78
+
79
+ # Extract variables from the hash.
80
+ description = hash.key?('Description') ? hash['Description'] : nil
81
+ quantity = hash.key?('Quantity') ? hash['Quantity'] : nil
82
+ weight = hash.key?('Weight') ? hash['Weight'] : nil
83
+ value = hash.key?('Value') ? hash['Value'] : nil
84
+ hs_tariff_nr = hash.key?('HSTariffNr') ? hash['HSTariffNr'] : SKIP
85
+ country_of_origin =
86
+ hash.key?('CountryOfOrigin') ? hash['CountryOfOrigin'] : SKIP
87
+
88
+ # Create object from extracted values.
89
+ ConfirmingCustomContent.new(description,
90
+ quantity,
91
+ weight,
92
+ value,
93
+ hs_tariff_nr,
94
+ country_of_origin)
95
+ end
96
+
97
+ # Provides a human-readable string representation of the object.
98
+ def to_s
99
+ class_name = self.class.name.split('::').last
100
+ "<#{class_name} description: #{@description}, quantity: #{@quantity}, weight: #{@weight},"\
101
+ " value: #{@value}, hs_tariff_nr: #{@hs_tariff_nr}, country_of_origin:"\
102
+ " #{@country_of_origin}>"
103
+ end
104
+
105
+ # Provides a debugging-friendly string with detailed object information.
106
+ def inspect
107
+ class_name = self.class.name.split('::').last
108
+ "<#{class_name} description: #{@description.inspect}, quantity: #{@quantity.inspect},"\
109
+ " weight: #{@weight.inspect}, value: #{@value.inspect}, hs_tariff_nr:"\
110
+ " #{@hs_tariff_nr.inspect}, country_of_origin: #{@country_of_origin.inspect}>"
111
+ end
112
+ end
113
+ end