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,84 @@
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
+ # Signature Model.
8
+ class Signature < BaseModel
9
+ SKIP = Object.new
10
+ private_constant :SKIP
11
+
12
+ # The barcode of the shipment for which the signature is returned
13
+ # @return [String]
14
+ attr_accessor :barcode
15
+
16
+ # The date of the signature
17
+ # @return [String]
18
+ attr_accessor :signature_date
19
+
20
+ # The signature content; base64 encoded GIF format.
21
+ # @return [String]
22
+ attr_accessor :signature_image
23
+
24
+ # A mapping from model property names to API property names.
25
+ def self.names
26
+ @_hash = {} if @_hash.nil?
27
+ @_hash['barcode'] = 'Barcode'
28
+ @_hash['signature_date'] = 'SignatureDate'
29
+ @_hash['signature_image'] = 'SignatureImage'
30
+ @_hash
31
+ end
32
+
33
+ # An array for optional fields
34
+ def self.optionals
35
+ %w[
36
+ barcode
37
+ signature_date
38
+ signature_image
39
+ ]
40
+ end
41
+
42
+ # An array for nullable fields
43
+ def self.nullables
44
+ []
45
+ end
46
+
47
+ def initialize(barcode = SKIP, signature_date = SKIP,
48
+ signature_image = SKIP)
49
+ @barcode = barcode unless barcode == SKIP
50
+ @signature_date = signature_date unless signature_date == SKIP
51
+ @signature_image = signature_image unless signature_image == SKIP
52
+ end
53
+
54
+ # Creates an instance of the object from a hash.
55
+ def self.from_hash(hash)
56
+ return nil unless hash
57
+
58
+ # Extract variables from the hash.
59
+ barcode = hash.key?('Barcode') ? hash['Barcode'] : SKIP
60
+ signature_date = hash.key?('SignatureDate') ? hash['SignatureDate'] : SKIP
61
+ signature_image =
62
+ hash.key?('SignatureImage') ? hash['SignatureImage'] : SKIP
63
+
64
+ # Create object from extracted values.
65
+ Signature.new(barcode,
66
+ signature_date,
67
+ signature_image)
68
+ end
69
+
70
+ # Provides a human-readable string representation of the object.
71
+ def to_s
72
+ class_name = self.class.name.split('::').last
73
+ "<#{class_name} barcode: #{@barcode}, signature_date: #{@signature_date}, signature_image:"\
74
+ " #{@signature_image}>"
75
+ end
76
+
77
+ # Provides a debugging-friendly string with detailed object information.
78
+ def inspect
79
+ class_name = self.class.name.split('::').last
80
+ "<#{class_name} barcode: #{@barcode.inspect}, signature_date: #{@signature_date.inspect},"\
81
+ " signature_image: #{@signature_image.inspect}>"
82
+ end
83
+ end
84
+ end
@@ -0,0 +1,108 @@
1
+ # postnl_ecommerce
2
+ #
3
+ # This file was automatically generated for PostNL by
4
+ # APIMATIC v3.0 ( https://www.apimatic.io ).
5
+
6
+ module PostnlEcommerce
7
+ # The current status of the shipment (see the [Status
8
+ # codes](https://developer.postnl.nl/docs/#/http/reference-data/t-t-status-cod
9
+ # es/event-codes) for possible values.
10
+ class Status < BaseModel
11
+ SKIP = Object.new
12
+ private_constant :SKIP
13
+
14
+ # The status timestamp
15
+ # @return [String]
16
+ attr_accessor :time_stamp
17
+
18
+ # The status code
19
+ # @return [String]
20
+ attr_accessor :status_code
21
+
22
+ # The status description
23
+ # @return [String]
24
+ attr_accessor :status_description
25
+
26
+ # The phase code
27
+ # @return [String]
28
+ attr_accessor :phase_code
29
+
30
+ # The phase description
31
+ # @return [String]
32
+ attr_accessor :phase_description
33
+
34
+ # A mapping from model property names to API property names.
35
+ def self.names
36
+ @_hash = {} if @_hash.nil?
37
+ @_hash['time_stamp'] = 'TimeStamp'
38
+ @_hash['status_code'] = 'StatusCode'
39
+ @_hash['status_description'] = 'StatusDescription'
40
+ @_hash['phase_code'] = 'PhaseCode'
41
+ @_hash['phase_description'] = 'PhaseDescription'
42
+ @_hash
43
+ end
44
+
45
+ # An array for optional fields
46
+ def self.optionals
47
+ %w[
48
+ time_stamp
49
+ status_code
50
+ status_description
51
+ phase_code
52
+ phase_description
53
+ ]
54
+ end
55
+
56
+ # An array for nullable fields
57
+ def self.nullables
58
+ []
59
+ end
60
+
61
+ def initialize(time_stamp = SKIP, status_code = SKIP,
62
+ status_description = SKIP, phase_code = SKIP,
63
+ phase_description = SKIP)
64
+ @time_stamp = time_stamp unless time_stamp == SKIP
65
+ @status_code = status_code unless status_code == SKIP
66
+ @status_description = status_description unless status_description == SKIP
67
+ @phase_code = phase_code unless phase_code == SKIP
68
+ @phase_description = phase_description unless phase_description == SKIP
69
+ end
70
+
71
+ # Creates an instance of the object from a hash.
72
+ def self.from_hash(hash)
73
+ return nil unless hash
74
+
75
+ # Extract variables from the hash.
76
+ time_stamp = hash.key?('TimeStamp') ? hash['TimeStamp'] : SKIP
77
+ status_code = hash.key?('StatusCode') ? hash['StatusCode'] : SKIP
78
+ status_description =
79
+ hash.key?('StatusDescription') ? hash['StatusDescription'] : SKIP
80
+ phase_code = hash.key?('PhaseCode') ? hash['PhaseCode'] : SKIP
81
+ phase_description =
82
+ hash.key?('PhaseDescription') ? hash['PhaseDescription'] : SKIP
83
+
84
+ # Create object from extracted values.
85
+ Status.new(time_stamp,
86
+ status_code,
87
+ status_description,
88
+ phase_code,
89
+ phase_description)
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} time_stamp: #{@time_stamp}, status_code: #{@status_code},"\
96
+ " status_description: #{@status_description}, phase_code: #{@phase_code}, phase_description:"\
97
+ " #{@phase_description}>"
98
+ end
99
+
100
+ # Provides a debugging-friendly string with detailed object information.
101
+ def inspect
102
+ class_name = self.class.name.split('::').last
103
+ "<#{class_name} time_stamp: #{@time_stamp.inspect}, status_code: #{@status_code.inspect},"\
104
+ " status_description: #{@status_description.inspect}, phase_code: #{@phase_code.inspect},"\
105
+ " phase_description: #{@phase_description.inspect}>"
106
+ end
107
+ end
108
+ 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
+ # Sunday Model.
8
+ class Sunday < BaseModel
9
+ SKIP = Object.new
10
+ private_constant :SKIP
11
+
12
+ # TODO: Write general description for this method
13
+ # @return [String]
14
+ attr_accessor :string
15
+
16
+ # A mapping from model property names to API property names.
17
+ def self.names
18
+ @_hash = {} if @_hash.nil?
19
+ @_hash['string'] = 'string'
20
+ @_hash
21
+ end
22
+
23
+ # An array for optional fields
24
+ def self.optionals
25
+ %w[
26
+ string
27
+ ]
28
+ end
29
+
30
+ # An array for nullable fields
31
+ def self.nullables
32
+ []
33
+ end
34
+
35
+ def initialize(string = SKIP)
36
+ @string = string unless string == SKIP
37
+ end
38
+
39
+ # Creates an instance of the object from a hash.
40
+ def self.from_hash(hash)
41
+ return nil unless hash
42
+
43
+ # Extract variables from the hash.
44
+ string = hash.key?('string') ? hash['string'] : SKIP
45
+
46
+ # Create object from extracted values.
47
+ Sunday.new(string)
48
+ end
49
+
50
+ # Provides a human-readable string representation of the object.
51
+ def to_s
52
+ class_name = self.class.name.split('::').last
53
+ "<#{class_name} string: #{@string}>"
54
+ end
55
+
56
+ # Provides a debugging-friendly string with detailed object information.
57
+ def inspect
58
+ class_name = self.class.name.split('::').last
59
+ "<#{class_name} string: #{@string.inspect}>"
60
+ end
61
+ end
62
+ end
@@ -0,0 +1,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
+ # Sustainability score; see [Sustainability
8
+ # codes](https://developer.postnl.nl/docs/#/http/reference-data/reference-code
9
+ # s/sustainability-codes) for possible values.
10
+ class Sustainability < BaseModel
11
+ SKIP = Object.new
12
+ private_constant :SKIP
13
+
14
+ # Sustainability score code
15
+ # @return [CodeEnum]
16
+ attr_accessor :code
17
+
18
+ # Sustainability score code description
19
+ # @return [String]
20
+ attr_accessor :description
21
+
22
+ # A mapping from model property names to API property names.
23
+ def self.names
24
+ @_hash = {} if @_hash.nil?
25
+ @_hash['code'] = 'Code'
26
+ @_hash['description'] = 'Description'
27
+ @_hash
28
+ end
29
+
30
+ # An array for optional fields
31
+ def self.optionals
32
+ %w[
33
+ code
34
+ description
35
+ ]
36
+ end
37
+
38
+ # An array for nullable fields
39
+ def self.nullables
40
+ []
41
+ end
42
+
43
+ def initialize(code = SKIP, description = SKIP)
44
+ @code = code unless code == SKIP
45
+ @description = description unless description == SKIP
46
+ end
47
+
48
+ # Creates an instance of the object from a hash.
49
+ def self.from_hash(hash)
50
+ return nil unless hash
51
+
52
+ # Extract variables from the hash.
53
+ code = hash.key?('Code') ? hash['Code'] : SKIP
54
+ description = hash.key?('Description') ? hash['Description'] : SKIP
55
+
56
+ # Create object from extracted values.
57
+ Sustainability.new(code,
58
+ description)
59
+ end
60
+
61
+ # Provides a human-readable string representation of the object.
62
+ def to_s
63
+ class_name = self.class.name.split('::').last
64
+ "<#{class_name} code: #{@code}, description: #{@description}>"
65
+ end
66
+
67
+ # Provides a debugging-friendly string with detailed object information.
68
+ def inspect
69
+ class_name = self.class.name.split('::').last
70
+ "<#{class_name} code: #{@code.inspect}, description: #{@description.inspect}>"
71
+ end
72
+ end
73
+ 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
+ # Thursday Model.
8
+ class Thursday < BaseModel
9
+ SKIP = Object.new
10
+ private_constant :SKIP
11
+
12
+ # TODO: Write general description for this method
13
+ # @return [String]
14
+ attr_accessor :string
15
+
16
+ # A mapping from model property names to API property names.
17
+ def self.names
18
+ @_hash = {} if @_hash.nil?
19
+ @_hash['string'] = 'string'
20
+ @_hash
21
+ end
22
+
23
+ # An array for optional fields
24
+ def self.optionals
25
+ %w[
26
+ string
27
+ ]
28
+ end
29
+
30
+ # An array for nullable fields
31
+ def self.nullables
32
+ []
33
+ end
34
+
35
+ def initialize(string = SKIP)
36
+ @string = string unless string == SKIP
37
+ end
38
+
39
+ # Creates an instance of the object from a hash.
40
+ def self.from_hash(hash)
41
+ return nil unless hash
42
+
43
+ # Extract variables from the hash.
44
+ string = hash.key?('string') ? hash['string'] : SKIP
45
+
46
+ # Create object from extracted values.
47
+ Thursday.new(string)
48
+ end
49
+
50
+ # Provides a human-readable string representation of the object.
51
+ def to_s
52
+ class_name = self.class.name.split('::').last
53
+ "<#{class_name} string: #{@string}>"
54
+ end
55
+
56
+ # Provides a debugging-friendly string with detailed object information.
57
+ def inspect
58
+ class_name = self.class.name.split('::').last
59
+ "<#{class_name} string: #{@string.inspect}>"
60
+ end
61
+ end
62
+ end
@@ -0,0 +1,71 @@
1
+ # postnl_ecommerce
2
+ #
3
+ # This file was automatically generated for PostNL by
4
+ # APIMATIC v3.0 ( https://www.apimatic.io ).
5
+
6
+ module PostnlEcommerce
7
+ # Timeframe Model.
8
+ class Timeframe < BaseModel
9
+ SKIP = Object.new
10
+ private_constant :SKIP
11
+
12
+ # The expected date of delivery
13
+ # @return [String]
14
+ attr_accessor :date
15
+
16
+ # The expected date of delivery
17
+ # @return [TimeframesResponseObject]
18
+ attr_accessor :timeframes
19
+
20
+ # A mapping from model property names to API property names.
21
+ def self.names
22
+ @_hash = {} if @_hash.nil?
23
+ @_hash['date'] = 'Date'
24
+ @_hash['timeframes'] = 'Timeframes'
25
+ @_hash
26
+ end
27
+
28
+ # An array for optional fields
29
+ def self.optionals
30
+ %w[
31
+ date
32
+ timeframes
33
+ ]
34
+ end
35
+
36
+ # An array for nullable fields
37
+ def self.nullables
38
+ []
39
+ end
40
+
41
+ def initialize(date = SKIP, timeframes = SKIP)
42
+ @date = date unless date == SKIP
43
+ @timeframes = timeframes unless timeframes == 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
+ date = hash.key?('Date') ? hash['Date'] : SKIP
52
+ timeframes = TimeframesResponseObject.from_hash(hash['Timeframes']) if hash['Timeframes']
53
+
54
+ # Create object from extracted values.
55
+ Timeframe.new(date,
56
+ timeframes)
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} date: #{@date}, timeframes: #{@timeframes}>"
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} date: #{@date.inspect}, timeframes: #{@timeframes.inspect}>"
69
+ end
70
+ end
71
+ end
@@ -0,0 +1,60 @@
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
+ # timeframeOptions.
8
+ class TimeframeOptionsEnum
9
+ TIMEFRAME_OPTIONS_ENUM = [
10
+ # TODO: Write general description for DAYTIME
11
+ DAYTIME = 'Daytime'.freeze,
12
+
13
+ # TODO: Write general description for TODAY
14
+ TODAY = 'Today'.freeze,
15
+
16
+ # TODO: Write general description for SAMEDAY
17
+ SAMEDAY = 'Sameday'.freeze,
18
+
19
+ # TODO: Write general description for EVENING
20
+ EVENING = 'Evening'.freeze,
21
+
22
+ # TODO: Write general description for MORNING
23
+ MORNING = 'Morning'.freeze,
24
+
25
+ # TODO: Write general description for NOON
26
+ NOON = 'Noon'.freeze,
27
+
28
+ # TODO: Write general description for SUNDAY
29
+ SUNDAY = 'Sunday'.freeze,
30
+
31
+ # TODO: Write general description for AFTERNOON
32
+ AFTERNOON = 'Afternoon'.freeze
33
+ ].freeze
34
+
35
+ def self.validate(value)
36
+ return false if value.nil?
37
+
38
+ TIMEFRAME_OPTIONS_ENUM.include?(value)
39
+ end
40
+
41
+ def self.from_value(value, default_value = DAYTIME)
42
+ return default_value if value.nil?
43
+
44
+ str = value.to_s.strip
45
+
46
+ case str.downcase
47
+ when 'daytime' then DAYTIME
48
+ when 'today' then TODAY
49
+ when 'sameday' then SAMEDAY
50
+ when 'evening' then EVENING
51
+ when 'morning' then MORNING
52
+ when 'noon' then NOON
53
+ when 'sunday' then SUNDAY
54
+ when 'afternoon' then AFTERNOON
55
+ else
56
+ default_value
57
+ end
58
+ end
59
+ end
60
+ end
@@ -0,0 +1,74 @@
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
+ # TimeframeResponse Model.
8
+ class TimeframeResponse < BaseModel
9
+ SKIP = Object.new
10
+ private_constant :SKIP
11
+
12
+ # TODO: Write general description for this method
13
+ # @return [Timeframes]
14
+ attr_accessor :timeframes
15
+
16
+ # TODO: Write general description for this method
17
+ # @return [ReasonNoTimeframes]
18
+ attr_accessor :reason_no_timeframes
19
+
20
+ # A mapping from model property names to API property names.
21
+ def self.names
22
+ @_hash = {} if @_hash.nil?
23
+ @_hash['timeframes'] = 'Timeframes'
24
+ @_hash['reason_no_timeframes'] = 'ReasonNoTimeframes'
25
+ @_hash
26
+ end
27
+
28
+ # An array for optional fields
29
+ def self.optionals
30
+ %w[
31
+ timeframes
32
+ reason_no_timeframes
33
+ ]
34
+ end
35
+
36
+ # An array for nullable fields
37
+ def self.nullables
38
+ []
39
+ end
40
+
41
+ def initialize(timeframes = SKIP, reason_no_timeframes = SKIP)
42
+ @timeframes = timeframes unless timeframes == SKIP
43
+ @reason_no_timeframes = reason_no_timeframes unless reason_no_timeframes == 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
+ timeframes = Timeframes.from_hash(hash['Timeframes']) if hash['Timeframes']
52
+ reason_no_timeframes = ReasonNoTimeframes.from_hash(hash['ReasonNoTimeframes']) if
53
+ hash['ReasonNoTimeframes']
54
+
55
+ # Create object from extracted values.
56
+ TimeframeResponse.new(timeframes,
57
+ reason_no_timeframes)
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} timeframes: #{@timeframes}, reason_no_timeframes:"\
64
+ " #{@reason_no_timeframes}>"
65
+ end
66
+
67
+ # Provides a debugging-friendly string with detailed object information.
68
+ def inspect
69
+ class_name = self.class.name.split('::').last
70
+ "<#{class_name} timeframes: #{@timeframes.inspect}, reason_no_timeframes:"\
71
+ " #{@reason_no_timeframes.inspect}>"
72
+ end
73
+ end
74
+ end
@@ -0,0 +1,96 @@
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
+ # TimeframeTimeframe Model.
8
+ class TimeframeTimeframe < BaseModel
9
+ SKIP = Object.new
10
+ private_constant :SKIP
11
+
12
+ # The start time of the expected delivery window
13
+ # @return [String]
14
+ attr_accessor :from
15
+
16
+ # The delivery option for which the timeframe is calculated. See [Delivery
17
+ # Options](https://developer.postnl.nl/docs/#/http/reference-data/reference-
18
+ # codes/delivery-options) for possible values.
19
+ # @return [Options]
20
+ attr_accessor :options
21
+
22
+ # The end time of the expected delivery window
23
+ # @return [String]
24
+ attr_accessor :to
25
+
26
+ # Sustainability score; see [Sustainability
27
+ # codes](https://developer.postnl.nl/docs/#/http/reference-data/reference-co
28
+ # des/sustainability-codes) for possible values.
29
+ # @return [Sustainability]
30
+ attr_accessor :sustainability
31
+
32
+ # A mapping from model property names to API property names.
33
+ def self.names
34
+ @_hash = {} if @_hash.nil?
35
+ @_hash['from'] = 'From'
36
+ @_hash['options'] = 'Options'
37
+ @_hash['to'] = 'To'
38
+ @_hash['sustainability'] = 'Sustainability'
39
+ @_hash
40
+ end
41
+
42
+ # An array for optional fields
43
+ def self.optionals
44
+ %w[
45
+ from
46
+ options
47
+ to
48
+ sustainability
49
+ ]
50
+ end
51
+
52
+ # An array for nullable fields
53
+ def self.nullables
54
+ []
55
+ end
56
+
57
+ def initialize(from = SKIP, options = SKIP, to = SKIP,
58
+ sustainability = SKIP)
59
+ @from = from unless from == SKIP
60
+ @options = options unless options == SKIP
61
+ @to = to unless to == SKIP
62
+ @sustainability = sustainability unless sustainability == SKIP
63
+ end
64
+
65
+ # Creates an instance of the object from a hash.
66
+ def self.from_hash(hash)
67
+ return nil unless hash
68
+
69
+ # Extract variables from the hash.
70
+ from = hash.key?('From') ? hash['From'] : SKIP
71
+ options = Options.from_hash(hash['Options']) if hash['Options']
72
+ to = hash.key?('To') ? hash['To'] : SKIP
73
+ sustainability = Sustainability.from_hash(hash['Sustainability']) if hash['Sustainability']
74
+
75
+ # Create object from extracted values.
76
+ TimeframeTimeframe.new(from,
77
+ options,
78
+ to,
79
+ sustainability)
80
+ end
81
+
82
+ # Provides a human-readable string representation of the object.
83
+ def to_s
84
+ class_name = self.class.name.split('::').last
85
+ "<#{class_name} from: #{@from}, options: #{@options}, to: #{@to}, sustainability:"\
86
+ " #{@sustainability}>"
87
+ end
88
+
89
+ # Provides a debugging-friendly string with detailed object information.
90
+ def inspect
91
+ class_name = self.class.name.split('::').last
92
+ "<#{class_name} from: #{@from.inspect}, options: #{@options.inspect}, to: #{@to.inspect},"\
93
+ " sustainability: #{@sustainability.inspect}>"
94
+ end
95
+ end
96
+ end