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,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
+ # ProductOption Model.
8
+ class ProductOption < BaseModel
9
+ SKIP = Object.new
10
+ private_constant :SKIP
11
+
12
+ # The characteristic of the ProductOption. Mandatory for some products,
13
+ # please see the [Products
14
+ # page](https://developer.postnl.nl/docs/#/http/reference-data/product-codes
15
+ # -dutch-domestic)
16
+ # @return [String]
17
+ attr_accessor :characteristic
18
+
19
+ # The product option code for this ProductOption. Mandatory for some
20
+ # products, please see the [Products
21
+ # page](https://developer.postnl.nl/docs/#/http/reference-data/product-codes
22
+ # -dutch-domestic)
23
+ # @return [String]
24
+ attr_accessor :option
25
+
26
+ # A mapping from model property names to API property names.
27
+ def self.names
28
+ @_hash = {} if @_hash.nil?
29
+ @_hash['characteristic'] = 'Characteristic'
30
+ @_hash['option'] = 'Option'
31
+ @_hash
32
+ end
33
+
34
+ # An array for optional fields
35
+ def self.optionals
36
+ []
37
+ end
38
+
39
+ # An array for nullable fields
40
+ def self.nullables
41
+ []
42
+ end
43
+
44
+ def initialize(characteristic = '118', option = '006')
45
+ @characteristic = characteristic
46
+ @option = option
47
+ end
48
+
49
+ # Creates an instance of the object from a hash.
50
+ def self.from_hash(hash)
51
+ return nil unless hash
52
+
53
+ # Extract variables from the hash.
54
+ characteristic = hash['Characteristic'] ||= '118'
55
+ option = hash['Option'] ||= '006'
56
+
57
+ # Create object from extracted values.
58
+ ProductOption.new(characteristic,
59
+ option)
60
+ end
61
+
62
+ # Provides a human-readable string representation of the object.
63
+ def to_s
64
+ class_name = self.class.name.split('::').last
65
+ "<#{class_name} characteristic: #{@characteristic}, option: #{@option}>"
66
+ end
67
+
68
+ # Provides a debugging-friendly string with detailed object information.
69
+ def inspect
70
+ class_name = self.class.name.split('::').last
71
+ "<#{class_name} characteristic: #{@characteristic.inspect}, option: #{@option.inspect}>"
72
+ end
73
+ end
74
+ end
@@ -0,0 +1,104 @@
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
+ # ReasonNoTimeframe Model.
8
+ class ReasonNoTimeframe < BaseModel
9
+ SKIP = Object.new
10
+ private_constant :SKIP
11
+
12
+ # The reason code
13
+ # @return [String]
14
+ attr_accessor :code
15
+
16
+ # The date associated with the reason no timeframe was calculated
17
+ # @return [String]
18
+ attr_accessor :date
19
+
20
+ # The description associated with the reason no timeframe was calculated
21
+ # @return [String]
22
+ attr_accessor :description
23
+
24
+ # The option for which no timeframe was calculated for a specific date
25
+ # @return [NoTimeframesOptions]
26
+ attr_accessor :options
27
+
28
+ # Sustainability score; see [Sustainability
29
+ # codes](https://developer.postnl.nl/docs/#/http/reference-data/reference-co
30
+ # des/sustainability-codes) for possible values.
31
+ # @return [Sustainability]
32
+ attr_accessor :sustainability
33
+
34
+ # A mapping from model property names to API property names.
35
+ def self.names
36
+ @_hash = {} if @_hash.nil?
37
+ @_hash['code'] = 'Code'
38
+ @_hash['date'] = 'Date'
39
+ @_hash['description'] = 'Description'
40
+ @_hash['options'] = 'Options'
41
+ @_hash['sustainability'] = 'Sustainability'
42
+ @_hash
43
+ end
44
+
45
+ # An array for optional fields
46
+ def self.optionals
47
+ %w[
48
+ code
49
+ date
50
+ description
51
+ options
52
+ sustainability
53
+ ]
54
+ end
55
+
56
+ # An array for nullable fields
57
+ def self.nullables
58
+ []
59
+ end
60
+
61
+ def initialize(code = SKIP, date = SKIP, description = SKIP, options = SKIP,
62
+ sustainability = SKIP)
63
+ @code = code unless code == SKIP
64
+ @date = date unless date == SKIP
65
+ @description = description unless description == SKIP
66
+ @options = options unless options == SKIP
67
+ @sustainability = sustainability unless sustainability == 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
+ code = hash.key?('Code') ? hash['Code'] : SKIP
76
+ date = hash.key?('Date') ? hash['Date'] : SKIP
77
+ description = hash.key?('Description') ? hash['Description'] : SKIP
78
+ options = NoTimeframesOptions.from_hash(hash['Options']) if hash['Options']
79
+ sustainability = Sustainability.from_hash(hash['Sustainability']) if hash['Sustainability']
80
+
81
+ # Create object from extracted values.
82
+ ReasonNoTimeframe.new(code,
83
+ date,
84
+ description,
85
+ options,
86
+ sustainability)
87
+ end
88
+
89
+ # Provides a human-readable string representation of the object.
90
+ def to_s
91
+ class_name = self.class.name.split('::').last
92
+ "<#{class_name} code: #{@code}, date: #{@date}, description: #{@description}, options:"\
93
+ " #{@options}, sustainability: #{@sustainability}>"
94
+ end
95
+
96
+ # Provides a debugging-friendly string with detailed object information.
97
+ def inspect
98
+ class_name = self.class.name.split('::').last
99
+ "<#{class_name} code: #{@code.inspect}, date: #{@date.inspect}, description:"\
100
+ " #{@description.inspect}, options: #{@options.inspect}, sustainability:"\
101
+ " #{@sustainability.inspect}>"
102
+ end
103
+ end
104
+ 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
+ # ReasonNoTimeframes Model.
8
+ class ReasonNoTimeframes < BaseModel
9
+ SKIP = Object.new
10
+ private_constant :SKIP
11
+
12
+ # The reason why no timeframe was returned
13
+ # @return [Array[ReasonNoTimeframe]]
14
+ attr_accessor :reason_no_timeframe
15
+
16
+ # A mapping from model property names to API property names.
17
+ def self.names
18
+ @_hash = {} if @_hash.nil?
19
+ @_hash['reason_no_timeframe'] = 'ReasonNoTimeframe'
20
+ @_hash
21
+ end
22
+
23
+ # An array for optional fields
24
+ def self.optionals
25
+ %w[
26
+ reason_no_timeframe
27
+ ]
28
+ end
29
+
30
+ # An array for nullable fields
31
+ def self.nullables
32
+ []
33
+ end
34
+
35
+ def initialize(reason_no_timeframe = SKIP)
36
+ @reason_no_timeframe = reason_no_timeframe unless reason_no_timeframe == 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
+ # Parameter is an array, so we need to iterate through it
45
+ reason_no_timeframe = nil
46
+ unless hash['ReasonNoTimeframe'].nil?
47
+ reason_no_timeframe = []
48
+ hash['ReasonNoTimeframe'].each do |structure|
49
+ reason_no_timeframe << (ReasonNoTimeframe.from_hash(structure) if structure)
50
+ end
51
+ end
52
+
53
+ reason_no_timeframe = SKIP unless hash.key?('ReasonNoTimeframe')
54
+
55
+ # Create object from extracted values.
56
+ ReasonNoTimeframes.new(reason_no_timeframe)
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} reason_no_timeframe: #{@reason_no_timeframe}>"
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} reason_no_timeframe: #{@reason_no_timeframe.inspect}>"
69
+ end
70
+ end
71
+ 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
+ # Saturday Model.
8
+ class Saturday < 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
+ Saturday.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,50 @@
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
+ # Type of shipment, possible values: Gift, Documents, Commercial Goods,
8
+ # Commercial Sample, Returned Goods. Is used to fill in the checkbox on the
9
+ # customs form on the shipment label.
10
+ class ShipmentTypeEnum
11
+ SHIPMENT_TYPE_ENUM = [
12
+ # TODO: Write general description for GIFT
13
+ GIFT = 'Gift'.freeze,
14
+
15
+ # TODO: Write general description for DOCUMENTS
16
+ DOCUMENTS = 'Documents'.freeze,
17
+
18
+ # TODO: Write general description for ENUM_COMMERCIAL_GOODS
19
+ ENUM_COMMERCIAL_GOODS = 'Commercial Goods'.freeze,
20
+
21
+ # TODO: Write general description for ENUM_COMMERCIAL_SAMPLE
22
+ ENUM_COMMERCIAL_SAMPLE = 'Commercial Sample'.freeze,
23
+
24
+ # TODO: Write general description for ENUM_RETURNED_GOODS
25
+ ENUM_RETURNED_GOODS = 'Returned Goods'.freeze
26
+ ].freeze
27
+
28
+ def self.validate(value)
29
+ return false if value.nil?
30
+
31
+ SHIPMENT_TYPE_ENUM.include?(value)
32
+ end
33
+
34
+ def self.from_value(value, default_value = GIFT)
35
+ return default_value if value.nil?
36
+
37
+ str = value.to_s.strip
38
+
39
+ case str.downcase
40
+ when 'gift' then GIFT
41
+ when 'documents' then DOCUMENTS
42
+ when 'enum_commercial_goods' then ENUM_COMMERCIAL_GOODS
43
+ when 'enum_commercial_sample' then ENUM_COMMERCIAL_SAMPLE
44
+ when 'enum_returned_goods' then ENUM_RETURNED_GOODS
45
+ else
46
+ default_value
47
+ end
48
+ end
49
+ end
50
+ end
@@ -0,0 +1,204 @@
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
+ # ShippingstatusAddress Model.
8
+ class ShippingstatusAddress < BaseModel
9
+ SKIP = Object.new
10
+ private_constant :SKIP
11
+
12
+ # The first name
13
+ # @return [String]
14
+ attr_accessor :first_name
15
+
16
+ # The last name
17
+ # @return [String]
18
+ attr_accessor :last_name
19
+
20
+ # The company name
21
+ # @return [String]
22
+ attr_accessor :company_name
23
+
24
+ # The department name
25
+ # @return [String]
26
+ attr_accessor :department_name
27
+
28
+ # The ISO2 country code
29
+ # @return [String]
30
+ attr_accessor :country_code
31
+
32
+ # The zipcode
33
+ # @return [String]
34
+ attr_accessor :zipcode
35
+
36
+ # The region name
37
+ # @return [String]
38
+ attr_accessor :region
39
+
40
+ # The district name
41
+ # @return [String]
42
+ attr_accessor :district
43
+
44
+ # The city name
45
+ # @return [String]
46
+ attr_accessor :city
47
+
48
+ # The street name
49
+ # @return [String]
50
+ attr_accessor :street
51
+
52
+ # The house number
53
+ # @return [String]
54
+ attr_accessor :house_number
55
+
56
+ # The house number suffix
57
+ # @return [String]
58
+ attr_accessor :house_number_suffix
59
+
60
+ # The building name
61
+ # @return [String]
62
+ attr_accessor :building
63
+
64
+ # The floor of the building
65
+ # @return [String]
66
+ attr_accessor :floor
67
+
68
+ # An additional remark
69
+ # @return [String]
70
+ attr_accessor :remark
71
+
72
+ # A mapping from model property names to API property names.
73
+ def self.names
74
+ @_hash = {} if @_hash.nil?
75
+ @_hash['first_name'] = 'FirstName'
76
+ @_hash['last_name'] = 'LastName'
77
+ @_hash['company_name'] = 'CompanyName'
78
+ @_hash['department_name'] = 'DepartmentName'
79
+ @_hash['country_code'] = 'CountryCode'
80
+ @_hash['zipcode'] = 'Zipcode'
81
+ @_hash['region'] = 'Region'
82
+ @_hash['district'] = 'District'
83
+ @_hash['city'] = 'City'
84
+ @_hash['street'] = 'Street'
85
+ @_hash['house_number'] = 'HouseNumber'
86
+ @_hash['house_number_suffix'] = 'HouseNumberSuffix'
87
+ @_hash['building'] = 'Building'
88
+ @_hash['floor'] = 'Floor'
89
+ @_hash['remark'] = 'Remark'
90
+ @_hash
91
+ end
92
+
93
+ # An array for optional fields
94
+ def self.optionals
95
+ %w[
96
+ first_name
97
+ last_name
98
+ company_name
99
+ department_name
100
+ country_code
101
+ zipcode
102
+ region
103
+ district
104
+ city
105
+ street
106
+ house_number
107
+ house_number_suffix
108
+ building
109
+ floor
110
+ remark
111
+ ]
112
+ end
113
+
114
+ # An array for nullable fields
115
+ def self.nullables
116
+ []
117
+ end
118
+
119
+ def initialize(first_name = SKIP, last_name = SKIP, company_name = SKIP,
120
+ department_name = SKIP, country_code = SKIP, zipcode = SKIP,
121
+ region = SKIP, district = SKIP, city = SKIP, street = SKIP,
122
+ house_number = SKIP, house_number_suffix = SKIP,
123
+ building = SKIP, floor = SKIP, remark = SKIP)
124
+ @first_name = first_name unless first_name == SKIP
125
+ @last_name = last_name unless last_name == SKIP
126
+ @company_name = company_name unless company_name == SKIP
127
+ @department_name = department_name unless department_name == SKIP
128
+ @country_code = country_code unless country_code == SKIP
129
+ @zipcode = zipcode unless zipcode == SKIP
130
+ @region = region unless region == SKIP
131
+ @district = district unless district == SKIP
132
+ @city = city unless city == SKIP
133
+ @street = street unless street == SKIP
134
+ @house_number = house_number unless house_number == SKIP
135
+ @house_number_suffix = house_number_suffix unless house_number_suffix == SKIP
136
+ @building = building unless building == SKIP
137
+ @floor = floor unless floor == SKIP
138
+ @remark = remark unless remark == SKIP
139
+ end
140
+
141
+ # Creates an instance of the object from a hash.
142
+ def self.from_hash(hash)
143
+ return nil unless hash
144
+
145
+ # Extract variables from the hash.
146
+ first_name = hash.key?('FirstName') ? hash['FirstName'] : SKIP
147
+ last_name = hash.key?('LastName') ? hash['LastName'] : SKIP
148
+ company_name = hash.key?('CompanyName') ? hash['CompanyName'] : SKIP
149
+ department_name =
150
+ hash.key?('DepartmentName') ? hash['DepartmentName'] : SKIP
151
+ country_code = hash.key?('CountryCode') ? hash['CountryCode'] : SKIP
152
+ zipcode = hash.key?('Zipcode') ? hash['Zipcode'] : SKIP
153
+ region = hash.key?('Region') ? hash['Region'] : SKIP
154
+ district = hash.key?('District') ? hash['District'] : SKIP
155
+ city = hash.key?('City') ? hash['City'] : SKIP
156
+ street = hash.key?('Street') ? hash['Street'] : SKIP
157
+ house_number = hash.key?('HouseNumber') ? hash['HouseNumber'] : SKIP
158
+ house_number_suffix =
159
+ hash.key?('HouseNumberSuffix') ? hash['HouseNumberSuffix'] : SKIP
160
+ building = hash.key?('Building') ? hash['Building'] : SKIP
161
+ floor = hash.key?('Floor') ? hash['Floor'] : SKIP
162
+ remark = hash.key?('Remark') ? hash['Remark'] : SKIP
163
+
164
+ # Create object from extracted values.
165
+ ShippingstatusAddress.new(first_name,
166
+ last_name,
167
+ company_name,
168
+ department_name,
169
+ country_code,
170
+ zipcode,
171
+ region,
172
+ district,
173
+ city,
174
+ street,
175
+ house_number,
176
+ house_number_suffix,
177
+ building,
178
+ floor,
179
+ remark)
180
+ end
181
+
182
+ # Provides a human-readable string representation of the object.
183
+ def to_s
184
+ class_name = self.class.name.split('::').last
185
+ "<#{class_name} first_name: #{@first_name}, last_name: #{@last_name}, company_name:"\
186
+ " #{@company_name}, department_name: #{@department_name}, country_code: #{@country_code},"\
187
+ " zipcode: #{@zipcode}, region: #{@region}, district: #{@district}, city: #{@city}, street:"\
188
+ " #{@street}, house_number: #{@house_number}, house_number_suffix: #{@house_number_suffix},"\
189
+ " building: #{@building}, floor: #{@floor}, remark: #{@remark}>"
190
+ end
191
+
192
+ # Provides a debugging-friendly string with detailed object information.
193
+ def inspect
194
+ class_name = self.class.name.split('::').last
195
+ "<#{class_name} first_name: #{@first_name.inspect}, last_name: #{@last_name.inspect},"\
196
+ " company_name: #{@company_name.inspect}, department_name: #{@department_name.inspect},"\
197
+ " country_code: #{@country_code.inspect}, zipcode: #{@zipcode.inspect}, region:"\
198
+ " #{@region.inspect}, district: #{@district.inspect}, city: #{@city.inspect}, street:"\
199
+ " #{@street.inspect}, house_number: #{@house_number.inspect}, house_number_suffix:"\
200
+ " #{@house_number_suffix.inspect}, building: #{@building.inspect}, floor: #{@floor.inspect},"\
201
+ " remark: #{@remark.inspect}>"
202
+ end
203
+ end
204
+ end
@@ -0,0 +1,75 @@
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 amounts belonging to the shipment
8
+ class ShippingstatusAmount < BaseModel
9
+ SKIP = Object.new
10
+ private_constant :SKIP
11
+
12
+ # The cash-on-delivery (COD) amount
13
+ # @return [String]
14
+ attr_accessor :rembours_bedrag
15
+
16
+ # The insurance amount of the shipment
17
+ # @return [String]
18
+ attr_accessor :verzekerd_bedrag
19
+
20
+ # A mapping from model property names to API property names.
21
+ def self.names
22
+ @_hash = {} if @_hash.nil?
23
+ @_hash['rembours_bedrag'] = 'RemboursBedrag'
24
+ @_hash['verzekerd_bedrag'] = 'VerzekerdBedrag'
25
+ @_hash
26
+ end
27
+
28
+ # An array for optional fields
29
+ def self.optionals
30
+ %w[
31
+ rembours_bedrag
32
+ verzekerd_bedrag
33
+ ]
34
+ end
35
+
36
+ # An array for nullable fields
37
+ def self.nullables
38
+ []
39
+ end
40
+
41
+ def initialize(rembours_bedrag = SKIP, verzekerd_bedrag = SKIP)
42
+ @rembours_bedrag = rembours_bedrag unless rembours_bedrag == SKIP
43
+ @verzekerd_bedrag = verzekerd_bedrag unless verzekerd_bedrag == 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
+ rembours_bedrag =
52
+ hash.key?('RemboursBedrag') ? hash['RemboursBedrag'] : SKIP
53
+ verzekerd_bedrag =
54
+ hash.key?('VerzekerdBedrag') ? hash['VerzekerdBedrag'] : SKIP
55
+
56
+ # Create object from extracted values.
57
+ ShippingstatusAmount.new(rembours_bedrag,
58
+ verzekerd_bedrag)
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} rembours_bedrag: #{@rembours_bedrag}, verzekerd_bedrag:"\
65
+ " #{@verzekerd_bedrag}>"
66
+ end
67
+
68
+ # Provides a debugging-friendly string with detailed object information.
69
+ def inspect
70
+ class_name = self.class.name.split('::').last
71
+ "<#{class_name} rembours_bedrag: #{@rembours_bedrag.inspect}, verzekerd_bedrag:"\
72
+ " #{@verzekerd_bedrag.inspect}>"
73
+ end
74
+ end
75
+ end