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,65 @@
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 delivery options for which a delivery date is returned. Only one
8
+ # delivery option is specified. See [Delivery
9
+ # Options](https://developer.postnl.nl/docs/#/http/reference-data/reference-co
10
+ # des/delivery-options) for possible values.
11
+ class DeliverydateOptions < BaseModel
12
+ SKIP = Object.new
13
+ private_constant :SKIP
14
+
15
+ # TODO: Write general description for this method
16
+ # @return [DeliverydateOptionEnum]
17
+ attr_accessor :string
18
+
19
+ # A mapping from model property names to API property names.
20
+ def self.names
21
+ @_hash = {} if @_hash.nil?
22
+ @_hash['string'] = 'string'
23
+ @_hash
24
+ end
25
+
26
+ # An array for optional fields
27
+ def self.optionals
28
+ %w[
29
+ string
30
+ ]
31
+ end
32
+
33
+ # An array for nullable fields
34
+ def self.nullables
35
+ []
36
+ end
37
+
38
+ def initialize(string = SKIP)
39
+ @string = string unless string == SKIP
40
+ end
41
+
42
+ # Creates an instance of the object from a hash.
43
+ def self.from_hash(hash)
44
+ return nil unless hash
45
+
46
+ # Extract variables from the hash.
47
+ string = hash.key?('string') ? hash['string'] : SKIP
48
+
49
+ # Create object from extracted values.
50
+ DeliverydateOptions.new(string)
51
+ end
52
+
53
+ # Provides a human-readable string representation of the object.
54
+ def to_s
55
+ class_name = self.class.name.split('::').last
56
+ "<#{class_name} string: #{@string}>"
57
+ end
58
+
59
+ # Provides a debugging-friendly string with detailed object information.
60
+ def inspect
61
+ class_name = self.class.name.split('::').last
62
+ "<#{class_name} string: #{@string.inspect}>"
63
+ end
64
+ end
65
+ end
@@ -0,0 +1,62 @@
1
+ # postnl_ecommerce
2
+ #
3
+ # This file was automatically generated for PostNL by
4
+ # APIMATIC v3.0 ( https://www.apimatic.io ).
5
+
6
+ module PostnlEcommerce
7
+ # DeliverydateShippingResponse Model.
8
+ class DeliverydateShippingResponse < BaseModel
9
+ SKIP = Object.new
10
+ private_constant :SKIP
11
+
12
+ # TODO: Write general description for this method
13
+ # @return [String]
14
+ attr_accessor :sent_date
15
+
16
+ # A mapping from model property names to API property names.
17
+ def self.names
18
+ @_hash = {} if @_hash.nil?
19
+ @_hash['sent_date'] = 'SentDate'
20
+ @_hash
21
+ end
22
+
23
+ # An array for optional fields
24
+ def self.optionals
25
+ %w[
26
+ sent_date
27
+ ]
28
+ end
29
+
30
+ # An array for nullable fields
31
+ def self.nullables
32
+ []
33
+ end
34
+
35
+ def initialize(sent_date = SKIP)
36
+ @sent_date = sent_date unless sent_date == 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
+ sent_date = hash.key?('SentDate') ? hash['SentDate'] : SKIP
45
+
46
+ # Create object from extracted values.
47
+ DeliverydateShippingResponse.new(sent_date)
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} sent_date: #{@sent_date}>"
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} sent_date: #{@sent_date.inspect}>"
60
+ end
61
+ end
62
+ end
@@ -0,0 +1,62 @@
1
+ # postnl_ecommerce
2
+ #
3
+ # This file was automatically generated for PostNL by
4
+ # APIMATIC v3.0 ( https://www.apimatic.io ).
5
+
6
+ module PostnlEcommerce
7
+ # Detail Model.
8
+ class Detail < BaseModel
9
+ SKIP = Object.new
10
+ private_constant :SKIP
11
+
12
+ # TODO: Write general description for this method
13
+ # @return [String]
14
+ attr_accessor :errorcode
15
+
16
+ # A mapping from model property names to API property names.
17
+ def self.names
18
+ @_hash = {} if @_hash.nil?
19
+ @_hash['errorcode'] = 'errorcode'
20
+ @_hash
21
+ end
22
+
23
+ # An array for optional fields
24
+ def self.optionals
25
+ %w[
26
+ errorcode
27
+ ]
28
+ end
29
+
30
+ # An array for nullable fields
31
+ def self.nullables
32
+ []
33
+ end
34
+
35
+ def initialize(errorcode = SKIP)
36
+ @errorcode = errorcode unless errorcode == 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
+ errorcode = hash.key?('errorcode') ? hash['errorcode'] : SKIP
45
+
46
+ # Create object from extracted values.
47
+ Detail.new(errorcode)
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} errorcode: #{@errorcode}>"
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} errorcode: #{@errorcode.inspect}>"
60
+ end
61
+ end
62
+ end
@@ -0,0 +1,106 @@
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
+ # Note: Length, Width, Height values are about the order of the size and need
8
+ # to be filled in from the longest to the shortest value. For example:
9
+ # shipment's official height is 700mm, width 500mm, length 300mm. The longest
10
+ # side (highest value) of 700mm needs to be entered at Length. Width value
11
+ # becomes 500mm, Height value: 300mm (the lowest). Entering the dimensions in
12
+ # the wrong order may result in incorrect shipping labels and longer delivery
13
+ # times. The maximum dimensions can be found in your PostNL contract.
14
+ class Dimension < BaseModel
15
+ SKIP = Object.new
16
+ private_constant :SKIP
17
+
18
+ # The shortest side of the shipment in millimeters (mm).
19
+ # @return [Integer]
20
+ attr_accessor :height
21
+
22
+ # The longest side of the shipment in millimeters (mm).
23
+ # @return [Integer]
24
+ attr_accessor :length
25
+
26
+ # Volume of the shipment in centimeters (cm3). Mandatory for E@H-products.
27
+ # @return [Integer]
28
+ attr_accessor :volume
29
+
30
+ # Weight of the shipment in grams. Approximate weight suffices
31
+ # @return [Integer]
32
+ attr_accessor :weight
33
+
34
+ # The second longest side of the shipment in millimeters (mm).
35
+ # @return [Integer]
36
+ attr_accessor :width
37
+
38
+ # A mapping from model property names to API property names.
39
+ def self.names
40
+ @_hash = {} if @_hash.nil?
41
+ @_hash['height'] = 'Height'
42
+ @_hash['length'] = 'Length'
43
+ @_hash['volume'] = 'Volume'
44
+ @_hash['weight'] = 'Weight'
45
+ @_hash['width'] = 'Width'
46
+ @_hash
47
+ end
48
+
49
+ # An array for optional fields
50
+ def self.optionals
51
+ %w[
52
+ height
53
+ length
54
+ volume
55
+ width
56
+ ]
57
+ end
58
+
59
+ # An array for nullable fields
60
+ def self.nullables
61
+ []
62
+ end
63
+
64
+ def initialize(weight = nil, height = SKIP, length = SKIP, volume = SKIP,
65
+ width = SKIP)
66
+ @height = height unless height == SKIP
67
+ @length = length unless length == SKIP
68
+ @volume = volume unless volume == SKIP
69
+ @weight = weight
70
+ @width = width unless width == SKIP
71
+ end
72
+
73
+ # Creates an instance of the object from a hash.
74
+ def self.from_hash(hash)
75
+ return nil unless hash
76
+
77
+ # Extract variables from the hash.
78
+ weight = hash.key?('Weight') ? hash['Weight'] : nil
79
+ height = hash.key?('Height') ? hash['Height'] : SKIP
80
+ length = hash.key?('Length') ? hash['Length'] : SKIP
81
+ volume = hash.key?('Volume') ? hash['Volume'] : SKIP
82
+ width = hash.key?('Width') ? hash['Width'] : SKIP
83
+
84
+ # Create object from extracted values.
85
+ Dimension.new(weight,
86
+ height,
87
+ length,
88
+ volume,
89
+ width)
90
+ end
91
+
92
+ # Provides a human-readable string representation of the object.
93
+ def to_s
94
+ class_name = self.class.name.split('::').last
95
+ "<#{class_name} height: #{@height}, length: #{@length}, volume: #{@volume}, weight:"\
96
+ " #{@weight}, width: #{@width}>"
97
+ end
98
+
99
+ # Provides a debugging-friendly string with detailed object information.
100
+ def inspect
101
+ class_name = self.class.name.split('::').last
102
+ "<#{class_name} height: #{@height.inspect}, length: #{@length.inspect}, volume:"\
103
+ " #{@volume.inspect}, weight: #{@weight.inspect}, width: #{@width.inspect}>"
104
+ end
105
+ end
106
+ end
@@ -0,0 +1,73 @@
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
+ # Error Model.
8
+ class Error < BaseModel
9
+ SKIP = Object.new
10
+ private_constant :SKIP
11
+
12
+ # TODO: Write general description for this method
13
+ # @return [String]
14
+ attr_accessor :error_code
15
+
16
+ # TODO: Write general description for this method
17
+ # @return [String]
18
+ attr_accessor :error_description
19
+
20
+ # A mapping from model property names to API property names.
21
+ def self.names
22
+ @_hash = {} if @_hash.nil?
23
+ @_hash['error_code'] = 'ErrorCode'
24
+ @_hash['error_description'] = 'ErrorDescription'
25
+ @_hash
26
+ end
27
+
28
+ # An array for optional fields
29
+ def self.optionals
30
+ %w[
31
+ error_code
32
+ error_description
33
+ ]
34
+ end
35
+
36
+ # An array for nullable fields
37
+ def self.nullables
38
+ []
39
+ end
40
+
41
+ def initialize(error_code = SKIP, error_description = SKIP)
42
+ @error_code = error_code unless error_code == SKIP
43
+ @error_description = error_description unless error_description == SKIP
44
+ end
45
+
46
+ # Creates an instance of the object from a hash.
47
+ def self.from_hash(hash)
48
+ return nil unless hash
49
+
50
+ # Extract variables from the hash.
51
+ error_code = hash.key?('ErrorCode') ? hash['ErrorCode'] : SKIP
52
+ error_description =
53
+ hash.key?('ErrorDescription') ? hash['ErrorDescription'] : SKIP
54
+
55
+ # Create object from extracted values.
56
+ Error.new(error_code,
57
+ error_description)
58
+ end
59
+
60
+ # Provides a human-readable string representation of the object.
61
+ def to_s
62
+ class_name = self.class.name.split('::').last
63
+ "<#{class_name} error_code: #{@error_code}, error_description: #{@error_description}>"
64
+ end
65
+
66
+ # Provides a debugging-friendly string with detailed object information.
67
+ def inspect
68
+ class_name = self.class.name.split('::').last
69
+ "<#{class_name} error_code: #{@error_code.inspect}, error_description:"\
70
+ " #{@error_description.inspect}>"
71
+ end
72
+ end
73
+ end
@@ -0,0 +1,127 @@
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
+ # Event Model.
8
+ class Event < BaseModel
9
+ SKIP = Object.new
10
+ private_constant :SKIP
11
+
12
+ # The event code
13
+ # @return [String]
14
+ attr_accessor :code
15
+
16
+ # The event description
17
+ # @return [String]
18
+ attr_accessor :description
19
+
20
+ # Location code of the destination
21
+ # @return [String]
22
+ attr_accessor :destination_location_code
23
+
24
+ # The current location code
25
+ # @return [String]
26
+ attr_accessor :location_code
27
+
28
+ # The route code
29
+ # @return [String]
30
+ attr_accessor :route_code
31
+
32
+ # The route number
33
+ # @return [String]
34
+ attr_accessor :route_number
35
+
36
+ # Timestamp of the event
37
+ # @return [String]
38
+ attr_accessor :time_stamp
39
+
40
+ # A mapping from model property names to API property names.
41
+ def self.names
42
+ @_hash = {} if @_hash.nil?
43
+ @_hash['code'] = 'Code'
44
+ @_hash['description'] = 'Description'
45
+ @_hash['destination_location_code'] = 'DestinationLocationCode'
46
+ @_hash['location_code'] = 'LocationCode'
47
+ @_hash['route_code'] = 'RouteCode'
48
+ @_hash['route_number'] = 'RouteNumber'
49
+ @_hash['time_stamp'] = 'TimeStamp'
50
+ @_hash
51
+ end
52
+
53
+ # An array for optional fields
54
+ def self.optionals
55
+ %w[
56
+ code
57
+ description
58
+ destination_location_code
59
+ location_code
60
+ route_code
61
+ route_number
62
+ time_stamp
63
+ ]
64
+ end
65
+
66
+ # An array for nullable fields
67
+ def self.nullables
68
+ []
69
+ end
70
+
71
+ def initialize(code = SKIP, description = SKIP,
72
+ destination_location_code = SKIP, location_code = SKIP,
73
+ route_code = SKIP, route_number = SKIP, time_stamp = SKIP)
74
+ @code = code unless code == SKIP
75
+ @description = description unless description == SKIP
76
+ unless destination_location_code == SKIP
77
+ @destination_location_code =
78
+ destination_location_code
79
+ end
80
+ @location_code = location_code unless location_code == SKIP
81
+ @route_code = route_code unless route_code == SKIP
82
+ @route_number = route_number unless route_number == SKIP
83
+ @time_stamp = time_stamp unless time_stamp == SKIP
84
+ end
85
+
86
+ # Creates an instance of the object from a hash.
87
+ def self.from_hash(hash)
88
+ return nil unless hash
89
+
90
+ # Extract variables from the hash.
91
+ code = hash.key?('Code') ? hash['Code'] : SKIP
92
+ description = hash.key?('Description') ? hash['Description'] : SKIP
93
+ destination_location_code =
94
+ hash.key?('DestinationLocationCode') ? hash['DestinationLocationCode'] : SKIP
95
+ location_code = hash.key?('LocationCode') ? hash['LocationCode'] : SKIP
96
+ route_code = hash.key?('RouteCode') ? hash['RouteCode'] : SKIP
97
+ route_number = hash.key?('RouteNumber') ? hash['RouteNumber'] : SKIP
98
+ time_stamp = hash.key?('TimeStamp') ? hash['TimeStamp'] : SKIP
99
+
100
+ # Create object from extracted values.
101
+ Event.new(code,
102
+ description,
103
+ destination_location_code,
104
+ location_code,
105
+ route_code,
106
+ route_number,
107
+ time_stamp)
108
+ end
109
+
110
+ # Provides a human-readable string representation of the object.
111
+ def to_s
112
+ class_name = self.class.name.split('::').last
113
+ "<#{class_name} code: #{@code}, description: #{@description}, destination_location_code:"\
114
+ " #{@destination_location_code}, location_code: #{@location_code}, route_code:"\
115
+ " #{@route_code}, route_number: #{@route_number}, time_stamp: #{@time_stamp}>"
116
+ end
117
+
118
+ # Provides a debugging-friendly string with detailed object information.
119
+ def inspect
120
+ class_name = self.class.name.split('::').last
121
+ "<#{class_name} code: #{@code.inspect}, description: #{@description.inspect},"\
122
+ " destination_location_code: #{@destination_location_code.inspect}, location_code:"\
123
+ " #{@location_code.inspect}, route_code: #{@route_code.inspect}, route_number:"\
124
+ " #{@route_number.inspect}, time_stamp: #{@time_stamp.inspect}>"
125
+ end
126
+ end
127
+ end
@@ -0,0 +1,71 @@
1
+ # postnl_ecommerce
2
+ #
3
+ # This file was automatically generated for PostNL by
4
+ # APIMATIC v3.0 ( https://www.apimatic.io ).
5
+
6
+ module PostnlEcommerce
7
+ # The expected delivery timeframe
8
+ class Expectation < BaseModel
9
+ SKIP = Object.new
10
+ private_constant :SKIP
11
+
12
+ # The start of the timeframe
13
+ # @return [String]
14
+ attr_accessor :eta_from
15
+
16
+ # The end of the timeframe
17
+ # @return [String]
18
+ attr_accessor :eta_to
19
+
20
+ # A mapping from model property names to API property names.
21
+ def self.names
22
+ @_hash = {} if @_hash.nil?
23
+ @_hash['eta_from'] = 'ETAFrom'
24
+ @_hash['eta_to'] = 'ETATo'
25
+ @_hash
26
+ end
27
+
28
+ # An array for optional fields
29
+ def self.optionals
30
+ %w[
31
+ eta_from
32
+ eta_to
33
+ ]
34
+ end
35
+
36
+ # An array for nullable fields
37
+ def self.nullables
38
+ []
39
+ end
40
+
41
+ def initialize(eta_from = SKIP, eta_to = SKIP)
42
+ @eta_from = eta_from unless eta_from == SKIP
43
+ @eta_to = eta_to unless eta_to == SKIP
44
+ end
45
+
46
+ # Creates an instance of the object from a hash.
47
+ def self.from_hash(hash)
48
+ return nil unless hash
49
+
50
+ # Extract variables from the hash.
51
+ eta_from = hash.key?('ETAFrom') ? hash['ETAFrom'] : SKIP
52
+ eta_to = hash.key?('ETATo') ? hash['ETATo'] : SKIP
53
+
54
+ # Create object from extracted values.
55
+ Expectation.new(eta_from,
56
+ eta_to)
57
+ end
58
+
59
+ # Provides a human-readable string representation of the object.
60
+ def to_s
61
+ class_name = self.class.name.split('::').last
62
+ "<#{class_name} eta_from: #{@eta_from}, eta_to: #{@eta_to}>"
63
+ end
64
+
65
+ # Provides a debugging-friendly string with detailed object information.
66
+ def inspect
67
+ class_name = self.class.name.split('::').last
68
+ "<#{class_name} eta_from: #{@eta_from.inspect}, eta_to: #{@eta_to.inspect}>"
69
+ end
70
+ end
71
+ end
@@ -0,0 +1,71 @@
1
+ # postnl_ecommerce
2
+ #
3
+ # This file was automatically generated for PostNL by
4
+ # APIMATIC v3.0 ( https://www.apimatic.io ).
5
+
6
+ module PostnlEcommerce
7
+ # ExtraField Model.
8
+ class ExtraField < BaseModel
9
+ SKIP = Object.new
10
+ private_constant :SKIP
11
+
12
+ # TODO: Write general description for this method
13
+ # @return [String]
14
+ attr_accessor :key
15
+
16
+ # TODO: Write general description for this method
17
+ # @return [String]
18
+ attr_accessor :value
19
+
20
+ # A mapping from model property names to API property names.
21
+ def self.names
22
+ @_hash = {} if @_hash.nil?
23
+ @_hash['key'] = 'Key'
24
+ @_hash['value'] = 'Value'
25
+ @_hash
26
+ end
27
+
28
+ # An array for optional fields
29
+ def self.optionals
30
+ %w[
31
+ key
32
+ value
33
+ ]
34
+ end
35
+
36
+ # An array for nullable fields
37
+ def self.nullables
38
+ []
39
+ end
40
+
41
+ def initialize(key = SKIP, value = SKIP)
42
+ @key = key unless key == SKIP
43
+ @value = value unless value == SKIP
44
+ end
45
+
46
+ # Creates an instance of the object from a hash.
47
+ def self.from_hash(hash)
48
+ return nil unless hash
49
+
50
+ # Extract variables from the hash.
51
+ key = hash.key?('Key') ? hash['Key'] : SKIP
52
+ value = hash.key?('Value') ? hash['Value'] : SKIP
53
+
54
+ # Create object from extracted values.
55
+ ExtraField.new(key,
56
+ value)
57
+ end
58
+
59
+ # Provides a human-readable string representation of the object.
60
+ def to_s
61
+ class_name = self.class.name.split('::').last
62
+ "<#{class_name} key: #{@key}, value: #{@value}>"
63
+ end
64
+
65
+ # Provides a debugging-friendly string with detailed object information.
66
+ def inspect
67
+ class_name = self.class.name.split('::').last
68
+ "<#{class_name} key: #{@key.inspect}, value: #{@value.inspect}>"
69
+ end
70
+ end
71
+ end