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,472 @@
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
+ # ConfirmingShipment Model.
8
+ class ConfirmingShipment < BaseModel
9
+ SKIP = Object.new
10
+ private_constant :SKIP
11
+
12
+ # List of 1 or more Address type elements. At least 1 address type is
13
+ # mandatory. See [Address
14
+ # types](https://developer.postnl.nl/docs/#/http/reference-data/reference-co
15
+ # des/address-types) for the available types.
16
+ # @return [Array[Address]]
17
+ attr_accessor :addresses
18
+
19
+ # List of amount types. An amount represents a value of the shipment. Amount
20
+ # type 01 mandatory for COD-shipments, Amount type 02 mandatory for domestic
21
+ # insured shipments. Please see [Amount
22
+ # types](https://developer.postnl.nl/docs/#/http/reference-data/reference-co
23
+ # des/amount-types) for the available types.
24
+ # @return [Array[Amount]]
25
+ attr_accessor :amounts
26
+
27
+ # Barcode of the shipment. This is a unique value. Note: If you leave this
28
+ # attribute out of your request an unique barcode will be generated
29
+ # automatically.
30
+ # @return [String]
31
+ attr_accessor :barcode
32
+
33
+ # Code used for logistic purposes (usually generated by the service itself
34
+ # and returned in the response). Please note that this must be provided when
35
+ # using the Confirm API to confirm shipments where coding texts are
36
+ # required (e.g. letterbox parcels).
37
+ # @return [String]
38
+ attr_accessor :coding_text
39
+
40
+ # Starting date/time of the collection of the shipment. Format: dd-MM-yyyy
41
+ # hh:mm:ss
42
+ # @return [String]
43
+ attr_accessor :collection_time_stamp_start
44
+
45
+ # Ending date/time of the collection of the shipment. Format: dd-MM-yyyy
46
+ # hh:mm:ss
47
+ # @return [String]
48
+ attr_accessor :collection_time_stamp_end
49
+
50
+ # One or more ContactType elements belonging to a shipment. Mandatory in
51
+ # some cases. Please refer to the available [Contact
52
+ # types](https://developer.postnl.nl/docs/#/http/reference-data/reference-co
53
+ # des/contact-types) for the possible values.
54
+ # @return [Array[Contact]]
55
+ attr_accessor :contacts
56
+
57
+ # Content of the shipment. Mandatory for Extra@Home shipments
58
+ # @return [String]
59
+ attr_accessor :content
60
+
61
+ # Cost center of the shipment. This value will appear on your invoice
62
+ # @return [String]
63
+ attr_accessor :cost_center
64
+
65
+ # Order number of the customer
66
+ # @return [String]
67
+ attr_accessor :customer_order_number
68
+
69
+ # The Customs type is mandatory for non-EU shipments and not allowed for any
70
+ # other shipment types.
71
+ # @return [Array[ConfirmingCustom]]
72
+ attr_accessor :customs
73
+
74
+ # Delivery address specification. This field is mandatory when AddressType
75
+ # on the Address is 09.
76
+ # @return [String]
77
+ attr_accessor :delivery_address
78
+
79
+ # Mandatory when using Mailbox Parcels (for generation of the coding rule)
80
+ # and delivery options like Evening/Morning/Sameday delivery etc.
81
+ # @return [String]
82
+ attr_accessor :delivery_date
83
+
84
+ # Note: Length, Width, Height values are about the order of the size and
85
+ # need to be filled in from the longest to the shortest value. For example:
86
+ # shipment's official height is 700mm, width 500mm, length 300mm. The
87
+ # longest side (highest value) of 700mm needs to be entered at Length. Width
88
+ # value becomes 500mm, Height value: 300mm (the lowest). Entering the
89
+ # dimensions in the wrong order may result in incorrect shipping labels and
90
+ # longer delivery times. The maximum dimensions can be found in your PostNL
91
+ # contract.
92
+ # @return [Dimension]
93
+ attr_accessor :dimension
94
+
95
+ # Barcode of the downstream network partner of PostNL Parcels. Madatory for
96
+ # requesting Parcels Non-EU combilabel product codes.
97
+ # @return [String]
98
+ attr_accessor :down_partner_barcode
99
+
100
+ # Identification of the downstream network partner of PostNL Pakketten.
101
+ # @return [String]
102
+ attr_accessor :down_partner_id
103
+
104
+ # Identification of the location of the downstream network partner of PostNL
105
+ # Pakketten.
106
+ # @return [String]
107
+ attr_accessor :down_partner_location
108
+
109
+ # List of 0 or more Group types with data, grouping multiple shipments
110
+ # together. Mandatory for multicollo shipments. Please see
111
+ # [Guidelines](https://developer.postnl.nl/docs/#/http/api-endpoints/send-tr
112
+ # ack/confirming/guidelines) (Multiple shipments) for more information.
113
+ # @return [Array[Group]]
114
+ attr_accessor :groups
115
+
116
+ # Array of hazardous materials contained in the shipment
117
+ # @return [Array[HazardousMaterial]]
118
+ attr_accessor :hazardous_material
119
+
120
+ # Deprecated. Collection product code of a shipment.
121
+ # @return [String]
122
+ attr_accessor :product_code_collect
123
+
124
+ # Product code of the shipment. See the [Products
125
+ # page](https://developer.postnl.nl/docs/#/http/reference-data/product-codes
126
+ # -dutch-domestic) for possible products.
127
+ # @return [String]
128
+ attr_accessor :product_code_delivery
129
+
130
+ # Product options for the shipment, mandatory for certain products, see the
131
+ # [Products
132
+ # page](https://developer.postnl.nl/docs/#/http/reference-data/product-codes
133
+ # -dutch-domestic).
134
+ # @return [Array[ProductOption]]
135
+ attr_accessor :product_options
136
+
137
+ # Date of birth. Mandatory for Age check products
138
+ # @return [String]
139
+ attr_accessor :receiver_date_of_birth
140
+
141
+ # Your own reference of the shipment. Mandatory for Extra@Home shipments;
142
+ # for E@H this is used to create your order number, so this should be unique
143
+ # for each request.
144
+ # @return [String]
145
+ attr_accessor :reference
146
+
147
+ # Additional reference of the collect order of the shipment
148
+ # @return [String]
149
+ attr_accessor :reference_collect
150
+
151
+ # Remark of the shipment.
152
+ # @return [String]
153
+ attr_accessor :remark
154
+
155
+ # Return barcode of the shipment. PostNL will provide you with a separate
156
+ # customer code specifically for generating the returnBarcode. Mandatory for
157
+ # Label in the Box (return label) shipments.
158
+ # @return [String]
159
+ attr_accessor :return_barcode
160
+
161
+ # Return reference of the shipment
162
+ # @return [String]
163
+ attr_accessor :return_reference
164
+
165
+ # Deprecated. ID of the chosen timeslot as returned by the timeslot
166
+ # webservice
167
+ # @return [String]
168
+ attr_accessor :timeslot_id
169
+
170
+ # A mapping from model property names to API property names.
171
+ def self.names
172
+ @_hash = {} if @_hash.nil?
173
+ @_hash['addresses'] = 'Addresses'
174
+ @_hash['amounts'] = 'Amounts'
175
+ @_hash['barcode'] = 'Barcode'
176
+ @_hash['coding_text'] = 'CodingText'
177
+ @_hash['collection_time_stamp_start'] = 'CollectionTimeStampStart'
178
+ @_hash['collection_time_stamp_end'] = 'CollectionTimeStampEnd'
179
+ @_hash['contacts'] = 'Contacts'
180
+ @_hash['content'] = 'Content'
181
+ @_hash['cost_center'] = 'CostCenter'
182
+ @_hash['customer_order_number'] = 'CustomerOrderNumber'
183
+ @_hash['customs'] = 'Customs'
184
+ @_hash['delivery_address'] = 'DeliveryAddress'
185
+ @_hash['delivery_date'] = 'DeliveryDate'
186
+ @_hash['dimension'] = 'Dimension'
187
+ @_hash['down_partner_barcode'] = 'DownPartnerBarcode'
188
+ @_hash['down_partner_id'] = 'DownPartnerID'
189
+ @_hash['down_partner_location'] = 'DownPartnerLocation'
190
+ @_hash['groups'] = 'Groups'
191
+ @_hash['hazardous_material'] = 'HazardousMaterial'
192
+ @_hash['product_code_collect'] = 'ProductCodeCollect'
193
+ @_hash['product_code_delivery'] = 'ProductCodeDelivery'
194
+ @_hash['product_options'] = 'ProductOptions'
195
+ @_hash['receiver_date_of_birth'] = 'ReceiverDateOfBirth'
196
+ @_hash['reference'] = 'Reference'
197
+ @_hash['reference_collect'] = 'ReferenceCollect'
198
+ @_hash['remark'] = 'Remark'
199
+ @_hash['return_barcode'] = 'ReturnBarcode'
200
+ @_hash['return_reference'] = 'ReturnReference'
201
+ @_hash['timeslot_id'] = 'TimeslotID'
202
+ @_hash
203
+ end
204
+
205
+ # An array for optional fields
206
+ def self.optionals
207
+ %w[
208
+ amounts
209
+ coding_text
210
+ collection_time_stamp_start
211
+ collection_time_stamp_end
212
+ contacts
213
+ content
214
+ cost_center
215
+ customer_order_number
216
+ customs
217
+ delivery_address
218
+ delivery_date
219
+ down_partner_barcode
220
+ down_partner_id
221
+ down_partner_location
222
+ groups
223
+ hazardous_material
224
+ product_code_collect
225
+ product_options
226
+ receiver_date_of_birth
227
+ reference
228
+ reference_collect
229
+ remark
230
+ return_barcode
231
+ return_reference
232
+ timeslot_id
233
+ ]
234
+ end
235
+
236
+ # An array for nullable fields
237
+ def self.nullables
238
+ []
239
+ end
240
+
241
+ def initialize(addresses = nil, barcode = nil, dimension = nil,
242
+ product_code_delivery = '3085', amounts = SKIP,
243
+ coding_text = SKIP, collection_time_stamp_start = SKIP,
244
+ collection_time_stamp_end = SKIP, contacts = SKIP,
245
+ content = SKIP, cost_center = SKIP,
246
+ customer_order_number = SKIP, customs = SKIP,
247
+ delivery_address = SKIP, delivery_date = SKIP,
248
+ down_partner_barcode = SKIP, down_partner_id = SKIP,
249
+ down_partner_location = SKIP, groups = SKIP,
250
+ hazardous_material = SKIP, product_code_collect = SKIP,
251
+ product_options = SKIP, receiver_date_of_birth = SKIP,
252
+ reference = SKIP, reference_collect = SKIP, remark = SKIP,
253
+ return_barcode = SKIP, return_reference = SKIP,
254
+ timeslot_id = SKIP)
255
+ @addresses = addresses
256
+ @amounts = amounts unless amounts == SKIP
257
+ @barcode = barcode
258
+ @coding_text = coding_text unless coding_text == SKIP
259
+ unless collection_time_stamp_start == SKIP
260
+ @collection_time_stamp_start =
261
+ collection_time_stamp_start
262
+ end
263
+ unless collection_time_stamp_end == SKIP
264
+ @collection_time_stamp_end =
265
+ collection_time_stamp_end
266
+ end
267
+ @contacts = contacts unless contacts == SKIP
268
+ @content = content unless content == SKIP
269
+ @cost_center = cost_center unless cost_center == SKIP
270
+ @customer_order_number = customer_order_number unless customer_order_number == SKIP
271
+ @customs = customs unless customs == SKIP
272
+ @delivery_address = delivery_address unless delivery_address == SKIP
273
+ @delivery_date = delivery_date unless delivery_date == SKIP
274
+ @dimension = dimension
275
+ @down_partner_barcode = down_partner_barcode unless down_partner_barcode == SKIP
276
+ @down_partner_id = down_partner_id unless down_partner_id == SKIP
277
+ @down_partner_location = down_partner_location unless down_partner_location == SKIP
278
+ @groups = groups unless groups == SKIP
279
+ @hazardous_material = hazardous_material unless hazardous_material == SKIP
280
+ @product_code_collect = product_code_collect unless product_code_collect == SKIP
281
+ @product_code_delivery = product_code_delivery
282
+ @product_options = product_options unless product_options == SKIP
283
+ @receiver_date_of_birth = receiver_date_of_birth unless receiver_date_of_birth == SKIP
284
+ @reference = reference unless reference == SKIP
285
+ @reference_collect = reference_collect unless reference_collect == SKIP
286
+ @remark = remark unless remark == SKIP
287
+ @return_barcode = return_barcode unless return_barcode == SKIP
288
+ @return_reference = return_reference unless return_reference == SKIP
289
+ @timeslot_id = timeslot_id unless timeslot_id == SKIP
290
+ end
291
+
292
+ # Creates an instance of the object from a hash.
293
+ def self.from_hash(hash)
294
+ return nil unless hash
295
+
296
+ # Extract variables from the hash.
297
+ # Parameter is an array, so we need to iterate through it
298
+ addresses = nil
299
+ unless hash['Addresses'].nil?
300
+ addresses = []
301
+ hash['Addresses'].each do |structure|
302
+ addresses << (Address.from_hash(structure) if structure)
303
+ end
304
+ end
305
+
306
+ addresses = nil unless hash.key?('Addresses')
307
+ barcode = hash.key?('Barcode') ? hash['Barcode'] : nil
308
+ dimension = Dimension.from_hash(hash['Dimension']) if hash['Dimension']
309
+ product_code_delivery = hash['ProductCodeDelivery'] ||= '3085'
310
+ # Parameter is an array, so we need to iterate through it
311
+ amounts = nil
312
+ unless hash['Amounts'].nil?
313
+ amounts = []
314
+ hash['Amounts'].each do |structure|
315
+ amounts << (Amount.from_hash(structure) if structure)
316
+ end
317
+ end
318
+
319
+ amounts = SKIP unless hash.key?('Amounts')
320
+ coding_text = hash.key?('CodingText') ? hash['CodingText'] : SKIP
321
+ collection_time_stamp_start =
322
+ hash.key?('CollectionTimeStampStart') ? hash['CollectionTimeStampStart'] : SKIP
323
+ collection_time_stamp_end =
324
+ hash.key?('CollectionTimeStampEnd') ? hash['CollectionTimeStampEnd'] : SKIP
325
+ # Parameter is an array, so we need to iterate through it
326
+ contacts = nil
327
+ unless hash['Contacts'].nil?
328
+ contacts = []
329
+ hash['Contacts'].each do |structure|
330
+ contacts << (Contact.from_hash(structure) if structure)
331
+ end
332
+ end
333
+
334
+ contacts = SKIP unless hash.key?('Contacts')
335
+ content = hash.key?('Content') ? hash['Content'] : SKIP
336
+ cost_center = hash.key?('CostCenter') ? hash['CostCenter'] : SKIP
337
+ customer_order_number =
338
+ hash.key?('CustomerOrderNumber') ? hash['CustomerOrderNumber'] : SKIP
339
+ # Parameter is an array, so we need to iterate through it
340
+ customs = nil
341
+ unless hash['Customs'].nil?
342
+ customs = []
343
+ hash['Customs'].each do |structure|
344
+ customs << (ConfirmingCustom.from_hash(structure) if structure)
345
+ end
346
+ end
347
+
348
+ customs = SKIP unless hash.key?('Customs')
349
+ delivery_address =
350
+ hash.key?('DeliveryAddress') ? hash['DeliveryAddress'] : SKIP
351
+ delivery_date = hash.key?('DeliveryDate') ? hash['DeliveryDate'] : SKIP
352
+ down_partner_barcode =
353
+ hash.key?('DownPartnerBarcode') ? hash['DownPartnerBarcode'] : SKIP
354
+ down_partner_id =
355
+ hash.key?('DownPartnerID') ? hash['DownPartnerID'] : SKIP
356
+ down_partner_location =
357
+ hash.key?('DownPartnerLocation') ? hash['DownPartnerLocation'] : SKIP
358
+ # Parameter is an array, so we need to iterate through it
359
+ groups = nil
360
+ unless hash['Groups'].nil?
361
+ groups = []
362
+ hash['Groups'].each do |structure|
363
+ groups << (Group.from_hash(structure) if structure)
364
+ end
365
+ end
366
+
367
+ groups = SKIP unless hash.key?('Groups')
368
+ # Parameter is an array, so we need to iterate through it
369
+ hazardous_material = nil
370
+ unless hash['HazardousMaterial'].nil?
371
+ hazardous_material = []
372
+ hash['HazardousMaterial'].each do |structure|
373
+ hazardous_material << (HazardousMaterial.from_hash(structure) if structure)
374
+ end
375
+ end
376
+
377
+ hazardous_material = SKIP unless hash.key?('HazardousMaterial')
378
+ product_code_collect =
379
+ hash.key?('ProductCodeCollect') ? hash['ProductCodeCollect'] : SKIP
380
+ # Parameter is an array, so we need to iterate through it
381
+ product_options = nil
382
+ unless hash['ProductOptions'].nil?
383
+ product_options = []
384
+ hash['ProductOptions'].each do |structure|
385
+ product_options << (ProductOption.from_hash(structure) if structure)
386
+ end
387
+ end
388
+
389
+ product_options = SKIP unless hash.key?('ProductOptions')
390
+ receiver_date_of_birth =
391
+ hash.key?('ReceiverDateOfBirth') ? hash['ReceiverDateOfBirth'] : SKIP
392
+ reference = hash.key?('Reference') ? hash['Reference'] : SKIP
393
+ reference_collect =
394
+ hash.key?('ReferenceCollect') ? hash['ReferenceCollect'] : SKIP
395
+ remark = hash.key?('Remark') ? hash['Remark'] : SKIP
396
+ return_barcode = hash.key?('ReturnBarcode') ? hash['ReturnBarcode'] : SKIP
397
+ return_reference =
398
+ hash.key?('ReturnReference') ? hash['ReturnReference'] : SKIP
399
+ timeslot_id = hash.key?('TimeslotID') ? hash['TimeslotID'] : SKIP
400
+
401
+ # Create object from extracted values.
402
+ ConfirmingShipment.new(addresses,
403
+ barcode,
404
+ dimension,
405
+ product_code_delivery,
406
+ amounts,
407
+ coding_text,
408
+ collection_time_stamp_start,
409
+ collection_time_stamp_end,
410
+ contacts,
411
+ content,
412
+ cost_center,
413
+ customer_order_number,
414
+ customs,
415
+ delivery_address,
416
+ delivery_date,
417
+ down_partner_barcode,
418
+ down_partner_id,
419
+ down_partner_location,
420
+ groups,
421
+ hazardous_material,
422
+ product_code_collect,
423
+ product_options,
424
+ receiver_date_of_birth,
425
+ reference,
426
+ reference_collect,
427
+ remark,
428
+ return_barcode,
429
+ return_reference,
430
+ timeslot_id)
431
+ end
432
+
433
+ # Provides a human-readable string representation of the object.
434
+ def to_s
435
+ class_name = self.class.name.split('::').last
436
+ "<#{class_name} addresses: #{@addresses}, amounts: #{@amounts}, barcode: #{@barcode},"\
437
+ " coding_text: #{@coding_text}, collection_time_stamp_start:"\
438
+ " #{@collection_time_stamp_start}, collection_time_stamp_end: #{@collection_time_stamp_end},"\
439
+ " contacts: #{@contacts}, content: #{@content}, cost_center: #{@cost_center},"\
440
+ " customer_order_number: #{@customer_order_number}, customs: #{@customs}, delivery_address:"\
441
+ " #{@delivery_address}, delivery_date: #{@delivery_date}, dimension: #{@dimension},"\
442
+ " down_partner_barcode: #{@down_partner_barcode}, down_partner_id: #{@down_partner_id},"\
443
+ " down_partner_location: #{@down_partner_location}, groups: #{@groups}, hazardous_material:"\
444
+ " #{@hazardous_material}, product_code_collect: #{@product_code_collect},"\
445
+ " product_code_delivery: #{@product_code_delivery}, product_options: #{@product_options},"\
446
+ " receiver_date_of_birth: #{@receiver_date_of_birth}, reference: #{@reference},"\
447
+ " reference_collect: #{@reference_collect}, remark: #{@remark}, return_barcode:"\
448
+ " #{@return_barcode}, return_reference: #{@return_reference}, timeslot_id: #{@timeslot_id}>"
449
+ end
450
+
451
+ # Provides a debugging-friendly string with detailed object information.
452
+ def inspect
453
+ class_name = self.class.name.split('::').last
454
+ "<#{class_name} addresses: #{@addresses.inspect}, amounts: #{@amounts.inspect}, barcode:"\
455
+ " #{@barcode.inspect}, coding_text: #{@coding_text.inspect}, collection_time_stamp_start:"\
456
+ " #{@collection_time_stamp_start.inspect}, collection_time_stamp_end:"\
457
+ " #{@collection_time_stamp_end.inspect}, contacts: #{@contacts.inspect}, content:"\
458
+ " #{@content.inspect}, cost_center: #{@cost_center.inspect}, customer_order_number:"\
459
+ " #{@customer_order_number.inspect}, customs: #{@customs.inspect}, delivery_address:"\
460
+ " #{@delivery_address.inspect}, delivery_date: #{@delivery_date.inspect}, dimension:"\
461
+ " #{@dimension.inspect}, down_partner_barcode: #{@down_partner_barcode.inspect},"\
462
+ " down_partner_id: #{@down_partner_id.inspect}, down_partner_location:"\
463
+ " #{@down_partner_location.inspect}, groups: #{@groups.inspect}, hazardous_material:"\
464
+ " #{@hazardous_material.inspect}, product_code_collect: #{@product_code_collect.inspect},"\
465
+ " product_code_delivery: #{@product_code_delivery.inspect}, product_options:"\
466
+ " #{@product_options.inspect}, receiver_date_of_birth: #{@receiver_date_of_birth.inspect},"\
467
+ " reference: #{@reference.inspect}, reference_collect: #{@reference_collect.inspect},"\
468
+ " remark: #{@remark.inspect}, return_barcode: #{@return_barcode.inspect}, return_reference:"\
469
+ " #{@return_reference.inspect}, timeslot_id: #{@timeslot_id.inspect}>"
470
+ end
471
+ end
472
+ end
@@ -0,0 +1,101 @@
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
+ # Contact Model.
8
+ class Contact < BaseModel
9
+ SKIP = Object.new
10
+ private_constant :SKIP
11
+
12
+ # Type of the contact. This is a code. Please refer to the available
13
+ # [Contact
14
+ # types](https://developer.postnl.nl/docs/#/http/reference-data/reference-co
15
+ # des/contact-types) for the possible values.
16
+ # @return [String]
17
+ attr_accessor :contact_type
18
+
19
+ # Email address of the contact. Mandatory in some cases. Either the Email or
20
+ # Telnr needs to be filled in for Non EU destinations. Please see
21
+ # [Guidelines](https://developer.postnl.nl/docs/#/http/api-endpoints/send-tr
22
+ # ack/confirming/guidelines).
23
+ # @return [String]
24
+ attr_accessor :email
25
+
26
+ # Mobile phone number of the contact. Mandatory in some cases. Please see
27
+ # [Guidelines](https://developer.postnl.nl/docs/#/http/api-endpoints/send-tr
28
+ # ack/confirming/guidelines).
29
+ # @return [String]
30
+ attr_accessor :sms_nr
31
+
32
+ # Phone number of the contact. Either the Email or Telnr needs to be filled
33
+ # in for Non EU destinations. Preferably prefixed with “+” and the
34
+ # international dialling code.
35
+ # @return [String]
36
+ attr_accessor :tel_nr
37
+
38
+ # A mapping from model property names to API property names.
39
+ def self.names
40
+ @_hash = {} if @_hash.nil?
41
+ @_hash['contact_type'] = 'ContactType'
42
+ @_hash['email'] = 'Email'
43
+ @_hash['sms_nr'] = 'SMSNr'
44
+ @_hash['tel_nr'] = 'TelNr'
45
+ @_hash
46
+ end
47
+
48
+ # An array for optional fields
49
+ def self.optionals
50
+ %w[
51
+ email
52
+ sms_nr
53
+ tel_nr
54
+ ]
55
+ end
56
+
57
+ # An array for nullable fields
58
+ def self.nullables
59
+ []
60
+ end
61
+
62
+ def initialize(contact_type = nil, email = SKIP, sms_nr = SKIP,
63
+ tel_nr = SKIP)
64
+ @contact_type = contact_type
65
+ @email = email unless email == SKIP
66
+ @sms_nr = sms_nr unless sms_nr == SKIP
67
+ @tel_nr = tel_nr unless tel_nr == SKIP
68
+ end
69
+
70
+ # Creates an instance of the object from a hash.
71
+ def self.from_hash(hash)
72
+ return nil unless hash
73
+
74
+ # Extract variables from the hash.
75
+ contact_type = hash.key?('ContactType') ? hash['ContactType'] : nil
76
+ email = hash.key?('Email') ? hash['Email'] : SKIP
77
+ sms_nr = hash.key?('SMSNr') ? hash['SMSNr'] : SKIP
78
+ tel_nr = hash.key?('TelNr') ? hash['TelNr'] : SKIP
79
+
80
+ # Create object from extracted values.
81
+ Contact.new(contact_type,
82
+ email,
83
+ sms_nr,
84
+ tel_nr)
85
+ end
86
+
87
+ # Provides a human-readable string representation of the object.
88
+ def to_s
89
+ class_name = self.class.name.split('::').last
90
+ "<#{class_name} contact_type: #{@contact_type}, email: #{@email}, sms_nr: #{@sms_nr},"\
91
+ " tel_nr: #{@tel_nr}>"
92
+ end
93
+
94
+ # Provides a debugging-friendly string with detailed object information.
95
+ def inspect
96
+ class_name = self.class.name.split('::').last
97
+ "<#{class_name} contact_type: #{@contact_type.inspect}, email: #{@email.inspect}, sms_nr:"\
98
+ " #{@sms_nr.inspect}, tel_nr: #{@tel_nr.inspect}>"
99
+ end
100
+ end
101
+ end
@@ -0,0 +1,36 @@
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
+ # ISO2 country code. Limited to NL and BE.
8
+ class CountrycodeEnum
9
+ COUNTRYCODE_ENUM = [
10
+ # TODO: Write general description for NL
11
+ NL = 'NL'.freeze,
12
+
13
+ # TODO: Write general description for BE
14
+ BE = 'BE'.freeze
15
+ ].freeze
16
+
17
+ def self.validate(value)
18
+ return false if value.nil?
19
+
20
+ COUNTRYCODE_ENUM.include?(value)
21
+ end
22
+
23
+ def self.from_value(value, default_value = NL)
24
+ return default_value if value.nil?
25
+
26
+ str = value.to_s.strip
27
+
28
+ case str.downcase
29
+ when 'nl' then NL
30
+ when 'be' then BE
31
+ else
32
+ default_value
33
+ end
34
+ end
35
+ end
36
+ end
@@ -0,0 +1,44 @@
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
+ # Currency code. only EUR, GBP, USD and CNY are allowed.
8
+ class CurrencyEnum
9
+ CURRENCY_ENUM = [
10
+ # TODO: Write general description for EUR
11
+ EUR = 'EUR'.freeze,
12
+
13
+ # TODO: Write general description for GBP
14
+ GBP = 'GBP'.freeze,
15
+
16
+ # TODO: Write general description for USD
17
+ USD = 'USD'.freeze,
18
+
19
+ # TODO: Write general description for CNY
20
+ CNY = 'CNY'.freeze
21
+ ].freeze
22
+
23
+ def self.validate(value)
24
+ return false if value.nil?
25
+
26
+ CURRENCY_ENUM.include?(value)
27
+ end
28
+
29
+ def self.from_value(value, default_value = EUR)
30
+ return default_value if value.nil?
31
+
32
+ str = value.to_s.strip
33
+
34
+ case str.downcase
35
+ when 'eur' then EUR
36
+ when 'gbp' then GBP
37
+ when 'usd' then USD
38
+ when 'cny' then CNY
39
+ else
40
+ default_value
41
+ end
42
+ end
43
+ end
44
+ end
@@ -0,0 +1,36 @@
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
+ # Currency code,only EUR and USS are allowed
8
+ class CurrencyLabellingAPIEnum
9
+ CURRENCY_LABELLING_API_ENUM = [
10
+ # TODO: Write general description for EUR
11
+ EUR = 'EUR'.freeze,
12
+
13
+ # TODO: Write general description for USS
14
+ USS = 'USS'.freeze
15
+ ].freeze
16
+
17
+ def self.validate(value)
18
+ return false if value.nil?
19
+
20
+ CURRENCY_LABELLING_API_ENUM.include?(value)
21
+ end
22
+
23
+ def self.from_value(value, default_value = EUR)
24
+ return default_value if value.nil?
25
+
26
+ str = value.to_s.strip
27
+
28
+ case str.downcase
29
+ when 'eur' then EUR
30
+ when 'uss' then USS
31
+ else
32
+ default_value
33
+ end
34
+ end
35
+ end
36
+ end