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,238 @@
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 Customs type is mandatory for non-EU shipments and not allowed for any
8
+ # other shipment types.
9
+ class Customs < BaseModel
10
+ SKIP = Object.new
11
+ private_constant :SKIP
12
+
13
+ # Fill in if applicable, for specific items a export certificate is obliged,
14
+ # as proof that the item complies to the sanity regulations, [more
15
+ # information](https://ondernemersplein.kvk.nl/fytosanitair-of-veterinair-ex
16
+ # portcertificaat-aanvragen/). Mandatory for Parcel shipments in the
17
+ # category type Commercial Goods, Commercial Sample and Returned Goods
18
+ # (Certificate, Invoice or License; at least 1 out of 3 must be selected)
19
+ # @return [TrueClass | FalseClass]
20
+ attr_accessor :certificate
21
+
22
+ # Mandatory when Certificate is true.
23
+ # @return [String]
24
+ attr_accessor :certificate_nr
25
+
26
+ # Fill in if applicable. Mandatory for Parcel shipments in the category type
27
+ # Commercial Goods, Commercial Sample and Returned Goods (Certificate,
28
+ # Invoice or License; at least 1 out of 3 must be selected).
29
+ # @return [TrueClass | FalseClass]
30
+ attr_accessor :license
31
+
32
+ # Mandatory when License is true.
33
+ # @return [String]
34
+ attr_accessor :license_nr
35
+
36
+ # Fill in the invoice number of the shipment. For a faster customs clearing
37
+ # process apply the invoice on the outside of the shipment. Mandatory for
38
+ # Parcel shipments in the category type Commercial Goods, Commercial Sample
39
+ # and Returned Goods (Certificate, Invoice or License; at least 1 out of 3
40
+ # must be selected).
41
+ # @return [TrueClass | FalseClass]
42
+ attr_accessor :invoice
43
+
44
+ # Mandatory when Invoice is true
45
+ # @return [String]
46
+ attr_accessor :invoice_nr
47
+
48
+ # Determines what to do when the shipment cannot be delivered the first time
49
+ # (if this is set to true,the shipment will be returned after the first
50
+ # failed attempt)
51
+ # @return [TrueClass | FalseClass]
52
+ attr_accessor :handle_as_non_deliverable
53
+
54
+ # Currency code,only EUR and USS are allowed
55
+ # @return [CurrencyLabellingAPIEnum]
56
+ attr_accessor :currency
57
+
58
+ # Type of shipment,possible values: Gift,Documents,Commercial
59
+ # Goods,Commercial Sample,Returned Goods
60
+ # @return [ShipmentTypeEnum]
61
+ attr_accessor :shipment_type
62
+
63
+ # 'Use only when available. Depending on the destination with this ID the
64
+ # customs process can be faster. Only fill in this customs reference number
65
+ # if the sender is registrated as Trusted Shipper in the country of
66
+ # destination'
67
+ # @return [String]
68
+ attr_accessor :trusted_shipper_id
69
+
70
+ # Importer reference code. Fill in a Tax Code or VAT number or Importer
71
+ # code. Depending on the destination with this reference the customs process
72
+ # can be faster.
73
+ # @return [String]
74
+ attr_accessor :importer_reference_code
75
+
76
+ # Code and accompanying description according to UPU Codelist 136. Codes to
77
+ # be used are shown below for your reference. Or see the [Reference
78
+ # data](https://developer.postnl.nl/docs/#/http/reference-data/reference-cod
79
+ # es/transaction-codes).
80
+ # @return [String]
81
+ attr_accessor :transaction_code
82
+
83
+ # Transaction description; see
84
+ # [here](https://developer.postnl.nl/docs/#/http/reference-data/reference-co
85
+ # des/transaction-codes) for common examples.
86
+ # @return [String]
87
+ attr_accessor :transaction_description
88
+
89
+ # The contents of the shipment. This section is mandatory (minimum once,
90
+ # maximum 5).
91
+ # @return [Array[LabellingCustomsContent]]
92
+ attr_accessor :content
93
+
94
+ # A mapping from model property names to API property names.
95
+ def self.names
96
+ @_hash = {} if @_hash.nil?
97
+ @_hash['certificate'] = 'Certificate'
98
+ @_hash['certificate_nr'] = 'CertificateNr'
99
+ @_hash['license'] = 'License'
100
+ @_hash['license_nr'] = 'LicenseNr'
101
+ @_hash['invoice'] = 'Invoice'
102
+ @_hash['invoice_nr'] = 'InvoiceNr'
103
+ @_hash['handle_as_non_deliverable'] = 'HandleAsNonDeliverable'
104
+ @_hash['currency'] = 'Currency'
105
+ @_hash['shipment_type'] = 'ShipmentType'
106
+ @_hash['trusted_shipper_id'] = 'TrustedShipperID'
107
+ @_hash['importer_reference_code'] = 'ImporterReferenceCode'
108
+ @_hash['transaction_code'] = 'TransactionCode'
109
+ @_hash['transaction_description'] = 'TransactionDescription'
110
+ @_hash['content'] = 'Content'
111
+ @_hash
112
+ end
113
+
114
+ # An array for optional fields
115
+ def self.optionals
116
+ %w[
117
+ certificate
118
+ certificate_nr
119
+ license
120
+ license_nr
121
+ invoice
122
+ invoice_nr
123
+ handle_as_non_deliverable
124
+ trusted_shipper_id
125
+ importer_reference_code
126
+ transaction_code
127
+ transaction_description
128
+ ]
129
+ end
130
+
131
+ # An array for nullable fields
132
+ def self.nullables
133
+ []
134
+ end
135
+
136
+ def initialize(currency = nil, shipment_type = nil, content = nil,
137
+ certificate = SKIP, certificate_nr = SKIP, license = SKIP,
138
+ license_nr = SKIP, invoice = SKIP, invoice_nr = SKIP,
139
+ handle_as_non_deliverable = SKIP, trusted_shipper_id = SKIP,
140
+ importer_reference_code = SKIP, transaction_code = SKIP,
141
+ transaction_description = SKIP)
142
+ @certificate = certificate unless certificate == SKIP
143
+ @certificate_nr = certificate_nr unless certificate_nr == SKIP
144
+ @license = license unless license == SKIP
145
+ @license_nr = license_nr unless license_nr == SKIP
146
+ @invoice = invoice unless invoice == SKIP
147
+ @invoice_nr = invoice_nr unless invoice_nr == SKIP
148
+ unless handle_as_non_deliverable == SKIP
149
+ @handle_as_non_deliverable =
150
+ handle_as_non_deliverable
151
+ end
152
+ @currency = currency
153
+ @shipment_type = shipment_type
154
+ @trusted_shipper_id = trusted_shipper_id unless trusted_shipper_id == SKIP
155
+ @importer_reference_code = importer_reference_code unless importer_reference_code == SKIP
156
+ @transaction_code = transaction_code unless transaction_code == SKIP
157
+ @transaction_description = transaction_description unless transaction_description == SKIP
158
+ @content = content
159
+ end
160
+
161
+ # Creates an instance of the object from a hash.
162
+ def self.from_hash(hash)
163
+ return nil unless hash
164
+
165
+ # Extract variables from the hash.
166
+ currency = hash.key?('Currency') ? hash['Currency'] : nil
167
+ shipment_type = hash.key?('ShipmentType') ? hash['ShipmentType'] : nil
168
+ # Parameter is an array, so we need to iterate through it
169
+ content = nil
170
+ unless hash['Content'].nil?
171
+ content = []
172
+ hash['Content'].each do |structure|
173
+ content << (LabellingCustomsContent.from_hash(structure) if structure)
174
+ end
175
+ end
176
+
177
+ content = nil unless hash.key?('Content')
178
+ certificate = hash.key?('Certificate') ? hash['Certificate'] : SKIP
179
+ certificate_nr = hash.key?('CertificateNr') ? hash['CertificateNr'] : SKIP
180
+ license = hash.key?('License') ? hash['License'] : SKIP
181
+ license_nr = hash.key?('LicenseNr') ? hash['LicenseNr'] : SKIP
182
+ invoice = hash.key?('Invoice') ? hash['Invoice'] : SKIP
183
+ invoice_nr = hash.key?('InvoiceNr') ? hash['InvoiceNr'] : SKIP
184
+ handle_as_non_deliverable =
185
+ hash.key?('HandleAsNonDeliverable') ? hash['HandleAsNonDeliverable'] : SKIP
186
+ trusted_shipper_id =
187
+ hash.key?('TrustedShipperID') ? hash['TrustedShipperID'] : SKIP
188
+ importer_reference_code =
189
+ hash.key?('ImporterReferenceCode') ? hash['ImporterReferenceCode'] : SKIP
190
+ transaction_code =
191
+ hash.key?('TransactionCode') ? hash['TransactionCode'] : SKIP
192
+ transaction_description =
193
+ hash.key?('TransactionDescription') ? hash['TransactionDescription'] : SKIP
194
+
195
+ # Create object from extracted values.
196
+ Customs.new(currency,
197
+ shipment_type,
198
+ content,
199
+ certificate,
200
+ certificate_nr,
201
+ license,
202
+ license_nr,
203
+ invoice,
204
+ invoice_nr,
205
+ handle_as_non_deliverable,
206
+ trusted_shipper_id,
207
+ importer_reference_code,
208
+ transaction_code,
209
+ transaction_description)
210
+ end
211
+
212
+ # Provides a human-readable string representation of the object.
213
+ def to_s
214
+ class_name = self.class.name.split('::').last
215
+ "<#{class_name} certificate: #{@certificate}, certificate_nr: #{@certificate_nr}, license:"\
216
+ " #{@license}, license_nr: #{@license_nr}, invoice: #{@invoice}, invoice_nr: #{@invoice_nr},"\
217
+ " handle_as_non_deliverable: #{@handle_as_non_deliverable}, currency: #{@currency},"\
218
+ " shipment_type: #{@shipment_type}, trusted_shipper_id: #{@trusted_shipper_id},"\
219
+ " importer_reference_code: #{@importer_reference_code}, transaction_code:"\
220
+ " #{@transaction_code}, transaction_description: #{@transaction_description}, content:"\
221
+ " #{@content}>"
222
+ end
223
+
224
+ # Provides a debugging-friendly string with detailed object information.
225
+ def inspect
226
+ class_name = self.class.name.split('::').last
227
+ "<#{class_name} certificate: #{@certificate.inspect}, certificate_nr:"\
228
+ " #{@certificate_nr.inspect}, license: #{@license.inspect}, license_nr:"\
229
+ " #{@license_nr.inspect}, invoice: #{@invoice.inspect}, invoice_nr: #{@invoice_nr.inspect},"\
230
+ " handle_as_non_deliverable: #{@handle_as_non_deliverable.inspect}, currency:"\
231
+ " #{@currency.inspect}, shipment_type: #{@shipment_type.inspect}, trusted_shipper_id:"\
232
+ " #{@trusted_shipper_id.inspect}, importer_reference_code:"\
233
+ " #{@importer_reference_code.inspect}, transaction_code: #{@transaction_code.inspect},"\
234
+ " transaction_description: #{@transaction_description.inspect}, content:"\
235
+ " #{@content.inspect}>"
236
+ end
237
+ end
238
+ end
@@ -0,0 +1,238 @@
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 Customs type is mandatory for non-EU shipments and not allowed for any
8
+ # other shipment types.
9
+ class CustomsLabellingAPI < BaseModel
10
+ SKIP = Object.new
11
+ private_constant :SKIP
12
+
13
+ # Fill in if applicable, for specific items a export certificate is obliged,
14
+ # as proof that the item complies to the sanity regulations, [more
15
+ # information](https://ondernemersplein.kvk.nl/fytosanitair-of-veterinair-ex
16
+ # portcertificaat-aanvragen/). Mandatory for Parcel shipments in the
17
+ # category type Commercial Goods, Commercial Sample and Returned Goods
18
+ # (Certificate, Invoice or License; at least 1 out of 3 must be selected)
19
+ # @return [TrueClass | FalseClass]
20
+ attr_accessor :certificate
21
+
22
+ # Mandatory when Certificate is true.
23
+ # @return [String]
24
+ attr_accessor :certificate_nr
25
+
26
+ # Fill in if applicable. Mandatory for Parcel shipments in the category type
27
+ # Commercial Goods, Commercial Sample and Returned Goods (Certificate,
28
+ # Invoice or License; at least 1 out of 3 must be selected).
29
+ # @return [TrueClass | FalseClass]
30
+ attr_accessor :license
31
+
32
+ # Mandatory when License is true.
33
+ # @return [String]
34
+ attr_accessor :license_nr
35
+
36
+ # Fill in the invoice number of the shipment. For a faster customs clearing
37
+ # process apply the invoice on the outside of the shipment. Mandatory for
38
+ # Parcel shipments in the category type Commercial Goods, Commercial Sample
39
+ # and Returned Goods (Certificate, Invoice or License; at least 1 out of 3
40
+ # must be selected).
41
+ # @return [TrueClass | FalseClass]
42
+ attr_accessor :invoice
43
+
44
+ # Mandatory when Invoice is true
45
+ # @return [String]
46
+ attr_accessor :invoice_nr
47
+
48
+ # Determines what to do when the shipment cannot be delivered the first time
49
+ # (if this is set to true,the shipment will be returned after the first
50
+ # failed attempt)
51
+ # @return [TrueClass | FalseClass]
52
+ attr_accessor :handle_as_non_deliverable
53
+
54
+ # Currency code,only EUR and USS are allowed
55
+ # @return [CurrencyLabellingAPIEnum]
56
+ attr_accessor :currency
57
+
58
+ # Type of shipment,possible values: Gift,Documents,Commercial
59
+ # Goods,Commercial Sample,Returned Goods
60
+ # @return [ShipmentTypeEnum]
61
+ attr_accessor :shipment_type
62
+
63
+ # 'Use only when available. Depending on the destination with this ID the
64
+ # customs process can be faster. Only fill in this customs reference number
65
+ # if the sender is registrated as Trusted Shipper in the country of
66
+ # destination'
67
+ # @return [String]
68
+ attr_accessor :trusted_shipper_id
69
+
70
+ # Importer reference code. Fill in a Tax Code or VAT number or Importer
71
+ # code. Depending on the destination with this reference the customs process
72
+ # can be faster.
73
+ # @return [String]
74
+ attr_accessor :importer_reference_code
75
+
76
+ # Code and accompanying description according to UPU Codelist 136. Codes to
77
+ # be used are shown below for your reference. Or see the [Reference
78
+ # data](https://developer.postnl.nl/docs/#/http/reference-data/reference-cod
79
+ # es/transaction-codes).
80
+ # @return [String]
81
+ attr_accessor :transaction_code
82
+
83
+ # Transaction description; see
84
+ # [here](https://developer.postnl.nl/docs/#/http/reference-data/reference-co
85
+ # des/transaction-codes) for common examples.
86
+ # @return [String]
87
+ attr_accessor :transaction_description
88
+
89
+ # The contents of the shipment. This section is mandatory (minimum once,
90
+ # maximum 5).
91
+ # @return [Array[LabellingCustomsContent]]
92
+ attr_accessor :content
93
+
94
+ # A mapping from model property names to API property names.
95
+ def self.names
96
+ @_hash = {} if @_hash.nil?
97
+ @_hash['certificate'] = 'Certificate'
98
+ @_hash['certificate_nr'] = 'CertificateNr'
99
+ @_hash['license'] = 'License'
100
+ @_hash['license_nr'] = 'LicenseNr'
101
+ @_hash['invoice'] = 'Invoice'
102
+ @_hash['invoice_nr'] = 'InvoiceNr'
103
+ @_hash['handle_as_non_deliverable'] = 'HandleAsNonDeliverable'
104
+ @_hash['currency'] = 'Currency'
105
+ @_hash['shipment_type'] = 'ShipmentType'
106
+ @_hash['trusted_shipper_id'] = 'TrustedShipperID'
107
+ @_hash['importer_reference_code'] = 'ImporterReferenceCode'
108
+ @_hash['transaction_code'] = 'TransactionCode'
109
+ @_hash['transaction_description'] = 'TransactionDescription'
110
+ @_hash['content'] = 'Content'
111
+ @_hash
112
+ end
113
+
114
+ # An array for optional fields
115
+ def self.optionals
116
+ %w[
117
+ certificate
118
+ certificate_nr
119
+ license
120
+ license_nr
121
+ invoice
122
+ invoice_nr
123
+ handle_as_non_deliverable
124
+ trusted_shipper_id
125
+ importer_reference_code
126
+ transaction_code
127
+ transaction_description
128
+ ]
129
+ end
130
+
131
+ # An array for nullable fields
132
+ def self.nullables
133
+ []
134
+ end
135
+
136
+ def initialize(currency = nil, shipment_type = nil, content = nil,
137
+ certificate = SKIP, certificate_nr = SKIP, license = SKIP,
138
+ license_nr = SKIP, invoice = SKIP, invoice_nr = SKIP,
139
+ handle_as_non_deliverable = SKIP, trusted_shipper_id = SKIP,
140
+ importer_reference_code = SKIP, transaction_code = SKIP,
141
+ transaction_description = SKIP)
142
+ @certificate = certificate unless certificate == SKIP
143
+ @certificate_nr = certificate_nr unless certificate_nr == SKIP
144
+ @license = license unless license == SKIP
145
+ @license_nr = license_nr unless license_nr == SKIP
146
+ @invoice = invoice unless invoice == SKIP
147
+ @invoice_nr = invoice_nr unless invoice_nr == SKIP
148
+ unless handle_as_non_deliverable == SKIP
149
+ @handle_as_non_deliverable =
150
+ handle_as_non_deliverable
151
+ end
152
+ @currency = currency
153
+ @shipment_type = shipment_type
154
+ @trusted_shipper_id = trusted_shipper_id unless trusted_shipper_id == SKIP
155
+ @importer_reference_code = importer_reference_code unless importer_reference_code == SKIP
156
+ @transaction_code = transaction_code unless transaction_code == SKIP
157
+ @transaction_description = transaction_description unless transaction_description == SKIP
158
+ @content = content
159
+ end
160
+
161
+ # Creates an instance of the object from a hash.
162
+ def self.from_hash(hash)
163
+ return nil unless hash
164
+
165
+ # Extract variables from the hash.
166
+ currency = hash.key?('Currency') ? hash['Currency'] : nil
167
+ shipment_type = hash.key?('ShipmentType') ? hash['ShipmentType'] : nil
168
+ # Parameter is an array, so we need to iterate through it
169
+ content = nil
170
+ unless hash['Content'].nil?
171
+ content = []
172
+ hash['Content'].each do |structure|
173
+ content << (LabellingCustomsContent.from_hash(structure) if structure)
174
+ end
175
+ end
176
+
177
+ content = nil unless hash.key?('Content')
178
+ certificate = hash.key?('Certificate') ? hash['Certificate'] : SKIP
179
+ certificate_nr = hash.key?('CertificateNr') ? hash['CertificateNr'] : SKIP
180
+ license = hash.key?('License') ? hash['License'] : SKIP
181
+ license_nr = hash.key?('LicenseNr') ? hash['LicenseNr'] : SKIP
182
+ invoice = hash.key?('Invoice') ? hash['Invoice'] : SKIP
183
+ invoice_nr = hash.key?('InvoiceNr') ? hash['InvoiceNr'] : SKIP
184
+ handle_as_non_deliverable =
185
+ hash.key?('HandleAsNonDeliverable') ? hash['HandleAsNonDeliverable'] : SKIP
186
+ trusted_shipper_id =
187
+ hash.key?('TrustedShipperID') ? hash['TrustedShipperID'] : SKIP
188
+ importer_reference_code =
189
+ hash.key?('ImporterReferenceCode') ? hash['ImporterReferenceCode'] : SKIP
190
+ transaction_code =
191
+ hash.key?('TransactionCode') ? hash['TransactionCode'] : SKIP
192
+ transaction_description =
193
+ hash.key?('TransactionDescription') ? hash['TransactionDescription'] : SKIP
194
+
195
+ # Create object from extracted values.
196
+ CustomsLabellingAPI.new(currency,
197
+ shipment_type,
198
+ content,
199
+ certificate,
200
+ certificate_nr,
201
+ license,
202
+ license_nr,
203
+ invoice,
204
+ invoice_nr,
205
+ handle_as_non_deliverable,
206
+ trusted_shipper_id,
207
+ importer_reference_code,
208
+ transaction_code,
209
+ transaction_description)
210
+ end
211
+
212
+ # Provides a human-readable string representation of the object.
213
+ def to_s
214
+ class_name = self.class.name.split('::').last
215
+ "<#{class_name} certificate: #{@certificate}, certificate_nr: #{@certificate_nr}, license:"\
216
+ " #{@license}, license_nr: #{@license_nr}, invoice: #{@invoice}, invoice_nr: #{@invoice_nr},"\
217
+ " handle_as_non_deliverable: #{@handle_as_non_deliverable}, currency: #{@currency},"\
218
+ " shipment_type: #{@shipment_type}, trusted_shipper_id: #{@trusted_shipper_id},"\
219
+ " importer_reference_code: #{@importer_reference_code}, transaction_code:"\
220
+ " #{@transaction_code}, transaction_description: #{@transaction_description}, content:"\
221
+ " #{@content}>"
222
+ end
223
+
224
+ # Provides a debugging-friendly string with detailed object information.
225
+ def inspect
226
+ class_name = self.class.name.split('::').last
227
+ "<#{class_name} certificate: #{@certificate.inspect}, certificate_nr:"\
228
+ " #{@certificate_nr.inspect}, license: #{@license.inspect}, license_nr:"\
229
+ " #{@license_nr.inspect}, invoice: #{@invoice.inspect}, invoice_nr: #{@invoice_nr.inspect},"\
230
+ " handle_as_non_deliverable: #{@handle_as_non_deliverable.inspect}, currency:"\
231
+ " #{@currency.inspect}, shipment_type: #{@shipment_type.inspect}, trusted_shipper_id:"\
232
+ " #{@trusted_shipper_id.inspect}, importer_reference_code:"\
233
+ " #{@importer_reference_code.inspect}, transaction_code: #{@transaction_code.inspect},"\
234
+ " transaction_description: #{@transaction_description.inspect}, content:"\
235
+ " #{@content.inspect}>"
236
+ end
237
+ end
238
+ end
@@ -0,0 +1,64 @@
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 options belonging to the pickup location. The delivery options RETA, UL,
8
+ # PU, DO, BW, RT and BWUL can be shown in the response. Please ignore these
9
+ # codes. These codes are internal PostNL codes.
10
+ class DeliveryOptions < BaseModel
11
+ SKIP = Object.new
12
+ private_constant :SKIP
13
+
14
+ # TODO: Write general description for this method
15
+ # @return [Array[String]]
16
+ attr_accessor :string
17
+
18
+ # A mapping from model property names to API property names.
19
+ def self.names
20
+ @_hash = {} if @_hash.nil?
21
+ @_hash['string'] = 'string'
22
+ @_hash
23
+ end
24
+
25
+ # An array for optional fields
26
+ def self.optionals
27
+ %w[
28
+ string
29
+ ]
30
+ end
31
+
32
+ # An array for nullable fields
33
+ def self.nullables
34
+ []
35
+ end
36
+
37
+ def initialize(string = SKIP)
38
+ @string = string unless string == SKIP
39
+ end
40
+
41
+ # Creates an instance of the object from a hash.
42
+ def self.from_hash(hash)
43
+ return nil unless hash
44
+
45
+ # Extract variables from the hash.
46
+ string = hash.key?('string') ? hash['string'] : SKIP
47
+
48
+ # Create object from extracted values.
49
+ DeliveryOptions.new(string)
50
+ end
51
+
52
+ # Provides a human-readable string representation of the object.
53
+ def to_s
54
+ class_name = self.class.name.split('::').last
55
+ "<#{class_name} string: #{@string}>"
56
+ end
57
+
58
+ # Provides a debugging-friendly string with detailed object information.
59
+ def inspect
60
+ class_name = self.class.name.split('::').last
61
+ "<#{class_name} string: #{@string.inspect}>"
62
+ end
63
+ end
64
+ end
@@ -0,0 +1,87 @@
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
+ # DeliverydateDeliveryResponse Model.
8
+ class DeliverydateDeliveryResponse < BaseModel
9
+ SKIP = Object.new
10
+ private_constant :SKIP
11
+
12
+ # TODO: Write general description for this method
13
+ # @return [String]
14
+ attr_accessor :delivery_date
15
+
16
+ # The delivery options for which a delivery date is returned. Only one
17
+ # delivery option is specified. See [Delivery
18
+ # Options](https://developer.postnl.nl/docs/#/http/reference-data/reference-
19
+ # codes/delivery-options) for possible values.
20
+ # @return [DeliverydateOptions]
21
+ attr_accessor :options
22
+
23
+ # Sustainability score; see [Sustainability
24
+ # codes](https://developer.postnl.nl/docs/#/http/reference-data/reference-co
25
+ # des/sustainability-codes) for possible values.
26
+ # @return [Sustainability]
27
+ attr_accessor :sustainability
28
+
29
+ # A mapping from model property names to API property names.
30
+ def self.names
31
+ @_hash = {} if @_hash.nil?
32
+ @_hash['delivery_date'] = 'DeliveryDate'
33
+ @_hash['options'] = 'Options'
34
+ @_hash['sustainability'] = 'Sustainability'
35
+ @_hash
36
+ end
37
+
38
+ # An array for optional fields
39
+ def self.optionals
40
+ %w[
41
+ delivery_date
42
+ options
43
+ sustainability
44
+ ]
45
+ end
46
+
47
+ # An array for nullable fields
48
+ def self.nullables
49
+ []
50
+ end
51
+
52
+ def initialize(delivery_date = SKIP, options = SKIP, sustainability = SKIP)
53
+ @delivery_date = delivery_date unless delivery_date == SKIP
54
+ @options = options unless options == SKIP
55
+ @sustainability = sustainability unless sustainability == SKIP
56
+ end
57
+
58
+ # Creates an instance of the object from a hash.
59
+ def self.from_hash(hash)
60
+ return nil unless hash
61
+
62
+ # Extract variables from the hash.
63
+ delivery_date = hash.key?('DeliveryDate') ? hash['DeliveryDate'] : SKIP
64
+ options = DeliverydateOptions.from_hash(hash['Options']) if hash['Options']
65
+ sustainability = Sustainability.from_hash(hash['Sustainability']) if hash['Sustainability']
66
+
67
+ # Create object from extracted values.
68
+ DeliverydateDeliveryResponse.new(delivery_date,
69
+ options,
70
+ sustainability)
71
+ end
72
+
73
+ # Provides a human-readable string representation of the object.
74
+ def to_s
75
+ class_name = self.class.name.split('::').last
76
+ "<#{class_name} delivery_date: #{@delivery_date}, options: #{@options}, sustainability:"\
77
+ " #{@sustainability}>"
78
+ end
79
+
80
+ # Provides a debugging-friendly string with detailed object information.
81
+ def inspect
82
+ class_name = self.class.name.split('::').last
83
+ "<#{class_name} delivery_date: #{@delivery_date.inspect}, options: #{@options.inspect},"\
84
+ " sustainability: #{@sustainability.inspect}>"
85
+ end
86
+ end
87
+ end
@@ -0,0 +1,56 @@
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
+ # deliverydateOption.
8
+ class DeliverydateOptionEnum
9
+ DELIVERYDATE_OPTION_ENUM = [
10
+ # TODO: Write general description for DAYTIME
11
+ DAYTIME = 'Daytime'.freeze,
12
+
13
+ # TODO: Write general description for EVENING
14
+ EVENING = 'Evening'.freeze,
15
+
16
+ # TODO: Write general description for MORNING
17
+ MORNING = 'Morning'.freeze,
18
+
19
+ # TODO: Write general description for NOON
20
+ NOON = 'Noon'.freeze,
21
+
22
+ # TODO: Write general description for SUNDAY
23
+ SUNDAY = 'Sunday'.freeze,
24
+
25
+ # TODO: Write general description for TODAY
26
+ TODAY = 'Today'.freeze,
27
+
28
+ # TODO: Write general description for AFTERNOON
29
+ AFTERNOON = 'Afternoon'.freeze
30
+ ].freeze
31
+
32
+ def self.validate(value)
33
+ return false if value.nil?
34
+
35
+ DELIVERYDATE_OPTION_ENUM.include?(value)
36
+ end
37
+
38
+ def self.from_value(value, default_value = DAYTIME)
39
+ return default_value if value.nil?
40
+
41
+ str = value.to_s.strip
42
+
43
+ case str.downcase
44
+ when 'daytime' then DAYTIME
45
+ when 'evening' then EVENING
46
+ when 'morning' then MORNING
47
+ when 'noon' then NOON
48
+ when 'sunday' then SUNDAY
49
+ when 'today' then TODAY
50
+ when 'afternoon' then AFTERNOON
51
+ else
52
+ default_value
53
+ end
54
+ end
55
+ end
56
+ end