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,120 @@
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
+ # CheckoutAddress Model.
8
+ class CheckoutAddress < BaseModel
9
+ SKIP = Object.new
10
+ private_constant :SKIP
11
+
12
+ # Address type. 01 is for the receiver address, 02 is for the sender
13
+ # address.
14
+ # @return [AddressTypeEnum]
15
+ attr_accessor :address_type
16
+
17
+ # Street name; for Belgian addresses, it is strongly recommended to fill in
18
+ # the street value
19
+ # @return [String]
20
+ attr_accessor :street
21
+
22
+ # The house number of the delivery address
23
+ # @return [Integer]
24
+ attr_accessor :house_nr
25
+
26
+ # House number extension
27
+ # @return [String]
28
+ attr_accessor :house_nr_ext
29
+
30
+ # Zipcode of the address
31
+ # @return [String]
32
+ attr_accessor :zipcode
33
+
34
+ # City of the address
35
+ # @return [String]
36
+ attr_accessor :city
37
+
38
+ # ISO2 country code. Limited to NL and BE.
39
+ # @return [CountrycodeEnum]
40
+ attr_accessor :countrycode
41
+
42
+ # A mapping from model property names to API property names.
43
+ def self.names
44
+ @_hash = {} if @_hash.nil?
45
+ @_hash['address_type'] = 'AddressType'
46
+ @_hash['street'] = 'Street'
47
+ @_hash['house_nr'] = 'HouseNr'
48
+ @_hash['house_nr_ext'] = 'HouseNrExt'
49
+ @_hash['zipcode'] = 'Zipcode'
50
+ @_hash['city'] = 'City'
51
+ @_hash['countrycode'] = 'Countrycode'
52
+ @_hash
53
+ end
54
+
55
+ # An array for optional fields
56
+ def self.optionals
57
+ %w[
58
+ street
59
+ house_nr_ext
60
+ city
61
+ ]
62
+ end
63
+
64
+ # An array for nullable fields
65
+ def self.nullables
66
+ []
67
+ end
68
+
69
+ def initialize(address_type = nil, house_nr = nil, zipcode = nil,
70
+ countrycode = nil, street = SKIP, house_nr_ext = SKIP,
71
+ city = SKIP)
72
+ @address_type = address_type
73
+ @street = street unless street == SKIP
74
+ @house_nr = house_nr
75
+ @house_nr_ext = house_nr_ext unless house_nr_ext == SKIP
76
+ @zipcode = zipcode
77
+ @city = city unless city == SKIP
78
+ @countrycode = countrycode
79
+ end
80
+
81
+ # Creates an instance of the object from a hash.
82
+ def self.from_hash(hash)
83
+ return nil unless hash
84
+
85
+ # Extract variables from the hash.
86
+ address_type = hash.key?('AddressType') ? hash['AddressType'] : nil
87
+ house_nr = hash.key?('HouseNr') ? hash['HouseNr'] : nil
88
+ zipcode = hash.key?('Zipcode') ? hash['Zipcode'] : nil
89
+ countrycode = hash.key?('Countrycode') ? hash['Countrycode'] : nil
90
+ street = hash.key?('Street') ? hash['Street'] : SKIP
91
+ house_nr_ext = hash.key?('HouseNrExt') ? hash['HouseNrExt'] : SKIP
92
+ city = hash.key?('City') ? hash['City'] : SKIP
93
+
94
+ # Create object from extracted values.
95
+ CheckoutAddress.new(address_type,
96
+ house_nr,
97
+ zipcode,
98
+ countrycode,
99
+ street,
100
+ house_nr_ext,
101
+ city)
102
+ end
103
+
104
+ # Provides a human-readable string representation of the object.
105
+ def to_s
106
+ class_name = self.class.name.split('::').last
107
+ "<#{class_name} address_type: #{@address_type}, street: #{@street}, house_nr: #{@house_nr},"\
108
+ " house_nr_ext: #{@house_nr_ext}, zipcode: #{@zipcode}, city: #{@city}, countrycode:"\
109
+ " #{@countrycode}>"
110
+ end
111
+
112
+ # Provides a debugging-friendly string with detailed object information.
113
+ def inspect
114
+ class_name = self.class.name.split('::').last
115
+ "<#{class_name} address_type: #{@address_type.inspect}, street: #{@street.inspect},"\
116
+ " house_nr: #{@house_nr.inspect}, house_nr_ext: #{@house_nr_ext.inspect}, zipcode:"\
117
+ " #{@zipcode.inspect}, city: #{@city.inspect}, countrycode: #{@countrycode.inspect}>"
118
+ end
119
+ end
120
+ end
@@ -0,0 +1,61 @@
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 day for which the cutoff time applies. 00 is your default cutoff that
8
+ # applies to all otherwise not specified days, 01 to 07 is Monday to Sunday.
9
+ class CheckoutCutOffDayEnum
10
+ CHECKOUT_CUT_OFF_DAY_ENUM = [
11
+ # TODO: Write general description for ENUM_00
12
+ ENUM_00 = '00'.freeze,
13
+
14
+ # TODO: Write general description for ENUM_01
15
+ ENUM_01 = '01'.freeze,
16
+
17
+ # TODO: Write general description for ENUM_02
18
+ ENUM_02 = '02'.freeze,
19
+
20
+ # TODO: Write general description for ENUM_03
21
+ ENUM_03 = '03'.freeze,
22
+
23
+ # TODO: Write general description for ENUM_04
24
+ ENUM_04 = '04'.freeze,
25
+
26
+ # TODO: Write general description for ENUM_05
27
+ ENUM_05 = '05'.freeze,
28
+
29
+ # TODO: Write general description for ENUM_06
30
+ ENUM_06 = '06'.freeze,
31
+
32
+ # TODO: Write general description for ENUM_07
33
+ ENUM_07 = '07'.freeze
34
+ ].freeze
35
+
36
+ def self.validate(value)
37
+ return false if value.nil?
38
+
39
+ CHECKOUT_CUT_OFF_DAY_ENUM.include?(value)
40
+ end
41
+
42
+ def self.from_value(value, default_value = ENUM_00)
43
+ return default_value if value.nil?
44
+
45
+ str = value.to_s.strip
46
+
47
+ case str.downcase
48
+ when 'enum_00' then ENUM_00
49
+ when 'enum_01' then ENUM_01
50
+ when 'enum_02' then ENUM_02
51
+ when 'enum_03' then ENUM_03
52
+ when 'enum_04' then ENUM_04
53
+ when 'enum_05' then ENUM_05
54
+ when 'enum_06' then ENUM_06
55
+ when 'enum_07' then ENUM_07
56
+ else
57
+ default_value
58
+ end
59
+ end
60
+ end
61
+ end
@@ -0,0 +1,91 @@
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
+ # CheckoutCutOffTime Model.
8
+ class CheckoutCutOffTime < BaseModel
9
+ SKIP = Object.new
10
+ private_constant :SKIP
11
+
12
+ # The day for which the cutoff time applies. 00 is your default cutoff that
13
+ # applies to all otherwise not specified days, 01 to 07 is Monday to Sunday.
14
+ # @return [CheckoutCutOffDayEnum]
15
+ attr_accessor :day
16
+
17
+ # Specifies whether you are available to process shipments during the
18
+ # selected day
19
+ # @return [TrueClass | FalseClass]
20
+ attr_accessor :available
21
+
22
+ # Specifies the type belonging to the cutoff time.
23
+ # @return [CheckoutCutOffTypeEnum]
24
+ attr_accessor :type
25
+
26
+ # Specifies the cutoff time (mandatory when Available is true)
27
+ # @return [String]
28
+ attr_accessor :time
29
+
30
+ # A mapping from model property names to API property names.
31
+ def self.names
32
+ @_hash = {} if @_hash.nil?
33
+ @_hash['day'] = 'Day'
34
+ @_hash['available'] = 'Available'
35
+ @_hash['type'] = 'Type'
36
+ @_hash['time'] = 'Time'
37
+ @_hash
38
+ end
39
+
40
+ # An array for optional fields
41
+ def self.optionals
42
+ %w[
43
+ available
44
+ type
45
+ time
46
+ ]
47
+ end
48
+
49
+ # An array for nullable fields
50
+ def self.nullables
51
+ []
52
+ end
53
+
54
+ def initialize(day = nil, available = SKIP, type = SKIP, time = SKIP)
55
+ @day = day
56
+ @available = available unless available == SKIP
57
+ @type = type unless type == SKIP
58
+ @time = time unless time == SKIP
59
+ end
60
+
61
+ # Creates an instance of the object from a hash.
62
+ def self.from_hash(hash)
63
+ return nil unless hash
64
+
65
+ # Extract variables from the hash.
66
+ day = hash.key?('Day') ? hash['Day'] : nil
67
+ available = hash.key?('Available') ? hash['Available'] : SKIP
68
+ type = hash.key?('Type') ? hash['Type'] : SKIP
69
+ time = hash.key?('Time') ? hash['Time'] : SKIP
70
+
71
+ # Create object from extracted values.
72
+ CheckoutCutOffTime.new(day,
73
+ available,
74
+ type,
75
+ time)
76
+ end
77
+
78
+ # Provides a human-readable string representation of the object.
79
+ def to_s
80
+ class_name = self.class.name.split('::').last
81
+ "<#{class_name} day: #{@day}, available: #{@available}, type: #{@type}, time: #{@time}>"
82
+ end
83
+
84
+ # Provides a debugging-friendly string with detailed object information.
85
+ def inspect
86
+ class_name = self.class.name.split('::').last
87
+ "<#{class_name} day: #{@day.inspect}, available: #{@available.inspect}, type:"\
88
+ " #{@type.inspect}, time: #{@time.inspect}>"
89
+ end
90
+ end
91
+ end
@@ -0,0 +1,40 @@
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
+ # Specifies the type belonging to the cutoff time.
8
+ class CheckoutCutOffTypeEnum
9
+ CHECKOUT_CUT_OFF_TYPE_ENUM = [
10
+ # TODO: Write general description for REGULAR
11
+ REGULAR = 'Regular'.freeze,
12
+
13
+ # TODO: Write general description for SAMEDAY
14
+ SAMEDAY = 'Sameday'.freeze,
15
+
16
+ # TODO: Write general description for TODAY
17
+ TODAY = 'Today'.freeze
18
+ ].freeze
19
+
20
+ def self.validate(value)
21
+ return false if value.nil?
22
+
23
+ CHECKOUT_CUT_OFF_TYPE_ENUM.include?(value)
24
+ end
25
+
26
+ def self.from_value(value, default_value = REGULAR)
27
+ return default_value if value.nil?
28
+
29
+ str = value.to_s.strip
30
+
31
+ case str.downcase
32
+ when 'regular' then REGULAR
33
+ when 'sameday' then SAMEDAY
34
+ when 'today' then TODAY
35
+ else
36
+ default_value
37
+ end
38
+ end
39
+ end
40
+ end
@@ -0,0 +1,81 @@
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
+ # CheckoutDeliveryOption Model.
8
+ class CheckoutDeliveryOption < BaseModel
9
+ SKIP = Object.new
10
+ private_constant :SKIP
11
+
12
+ # The possible delivery date
13
+ # @return [String]
14
+ attr_accessor :delivery_date
15
+
16
+ # Array of timeframes
17
+ # @return [Array[CheckoutTimeFrame]]
18
+ attr_accessor :timeframe
19
+
20
+ # A mapping from model property names to API property names.
21
+ def self.names
22
+ @_hash = {} if @_hash.nil?
23
+ @_hash['delivery_date'] = 'DeliveryDate'
24
+ @_hash['timeframe'] = 'Timeframe'
25
+ @_hash
26
+ end
27
+
28
+ # An array for optional fields
29
+ def self.optionals
30
+ %w[
31
+ delivery_date
32
+ timeframe
33
+ ]
34
+ end
35
+
36
+ # An array for nullable fields
37
+ def self.nullables
38
+ []
39
+ end
40
+
41
+ def initialize(delivery_date = SKIP, timeframe = SKIP)
42
+ @delivery_date = delivery_date unless delivery_date == SKIP
43
+ @timeframe = timeframe unless timeframe == 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
+ delivery_date = hash.key?('DeliveryDate') ? hash['DeliveryDate'] : SKIP
52
+ # Parameter is an array, so we need to iterate through it
53
+ timeframe = nil
54
+ unless hash['Timeframe'].nil?
55
+ timeframe = []
56
+ hash['Timeframe'].each do |structure|
57
+ timeframe << (CheckoutTimeFrame.from_hash(structure) if structure)
58
+ end
59
+ end
60
+
61
+ timeframe = SKIP unless hash.key?('Timeframe')
62
+
63
+ # Create object from extracted values.
64
+ CheckoutDeliveryOption.new(delivery_date,
65
+ timeframe)
66
+ end
67
+
68
+ # Provides a human-readable string representation of the object.
69
+ def to_s
70
+ class_name = self.class.name.split('::').last
71
+ "<#{class_name} delivery_date: #{@delivery_date}, timeframe: #{@timeframe}>"
72
+ end
73
+
74
+ # Provides a debugging-friendly string with detailed object information.
75
+ def inspect
76
+ class_name = self.class.name.split('::').last
77
+ "<#{class_name} delivery_date: #{@delivery_date.inspect}, timeframe:"\
78
+ " #{@timeframe.inspect}>"
79
+ end
80
+ end
81
+ end
@@ -0,0 +1,126 @@
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
+ # CheckoutLocation Model.
8
+ class CheckoutLocation < BaseModel
9
+ SKIP = Object.new
10
+ private_constant :SKIP
11
+
12
+ # The pickup location address
13
+ # @return [CheckoutPickupAddress]
14
+ attr_accessor :address
15
+
16
+ # Time from when the parcel can be retrieved at the pickup location
17
+ # @return [String]
18
+ attr_accessor :pickup_time
19
+
20
+ # The standard opening hours of the pickup location
21
+ # @return [OpeningHours]
22
+ attr_accessor :opening_hours
23
+
24
+ # The calculated distance (in meters) between the location specified and the
25
+ # address provided in the request
26
+ # @return [Integer]
27
+ attr_accessor :distance
28
+
29
+ # The location identifier
30
+ # @return [String]
31
+ attr_accessor :location_code
32
+
33
+ # The partner identifier; not used anymore
34
+ # @return [String]
35
+ attr_accessor :partner_id
36
+
37
+ # Sustainability score; see [Sustainability
38
+ # codes](https://developer.postnl.nl/docs/#/http/reference-data/reference-co
39
+ # des/sustainability-codes) for possible values.
40
+ # @return [Sustainability]
41
+ attr_accessor :sustainability
42
+
43
+ # A mapping from model property names to API property names.
44
+ def self.names
45
+ @_hash = {} if @_hash.nil?
46
+ @_hash['address'] = 'Address'
47
+ @_hash['pickup_time'] = 'PickupTime'
48
+ @_hash['opening_hours'] = 'OpeningHours'
49
+ @_hash['distance'] = 'Distance'
50
+ @_hash['location_code'] = 'LocationCode'
51
+ @_hash['partner_id'] = 'PartnerID'
52
+ @_hash['sustainability'] = 'Sustainability'
53
+ @_hash
54
+ end
55
+
56
+ # An array for optional fields
57
+ def self.optionals
58
+ %w[
59
+ address
60
+ pickup_time
61
+ opening_hours
62
+ distance
63
+ location_code
64
+ partner_id
65
+ sustainability
66
+ ]
67
+ end
68
+
69
+ # An array for nullable fields
70
+ def self.nullables
71
+ []
72
+ end
73
+
74
+ def initialize(address = SKIP, pickup_time = SKIP, opening_hours = SKIP,
75
+ distance = SKIP, location_code = SKIP, partner_id = SKIP,
76
+ sustainability = SKIP)
77
+ @address = address unless address == SKIP
78
+ @pickup_time = pickup_time unless pickup_time == SKIP
79
+ @opening_hours = opening_hours unless opening_hours == SKIP
80
+ @distance = distance unless distance == SKIP
81
+ @location_code = location_code unless location_code == SKIP
82
+ @partner_id = partner_id unless partner_id == SKIP
83
+ @sustainability = sustainability unless sustainability == 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
+ address = CheckoutPickupAddress.from_hash(hash['Address']) if hash['Address']
92
+ pickup_time = hash.key?('PickupTime') ? hash['PickupTime'] : SKIP
93
+ opening_hours = OpeningHours.from_hash(hash['OpeningHours']) if hash['OpeningHours']
94
+ distance = hash.key?('Distance') ? hash['Distance'] : SKIP
95
+ location_code = hash.key?('LocationCode') ? hash['LocationCode'] : SKIP
96
+ partner_id = hash.key?('PartnerID') ? hash['PartnerID'] : SKIP
97
+ sustainability = Sustainability.from_hash(hash['Sustainability']) if hash['Sustainability']
98
+
99
+ # Create object from extracted values.
100
+ CheckoutLocation.new(address,
101
+ pickup_time,
102
+ opening_hours,
103
+ distance,
104
+ location_code,
105
+ partner_id,
106
+ sustainability)
107
+ end
108
+
109
+ # Provides a human-readable string representation of the object.
110
+ def to_s
111
+ class_name = self.class.name.split('::').last
112
+ "<#{class_name} address: #{@address}, pickup_time: #{@pickup_time}, opening_hours:"\
113
+ " #{@opening_hours}, distance: #{@distance}, location_code: #{@location_code}, partner_id:"\
114
+ " #{@partner_id}, sustainability: #{@sustainability}>"
115
+ end
116
+
117
+ # Provides a debugging-friendly string with detailed object information.
118
+ def inspect
119
+ class_name = self.class.name.split('::').last
120
+ "<#{class_name} address: #{@address.inspect}, pickup_time: #{@pickup_time.inspect},"\
121
+ " opening_hours: #{@opening_hours.inspect}, distance: #{@distance.inspect}, location_code:"\
122
+ " #{@location_code.inspect}, partner_id: #{@partner_id.inspect}, sustainability:"\
123
+ " #{@sustainability.inspect}>"
124
+ end
125
+ end
126
+ end
@@ -0,0 +1,64 @@
1
+ # postnl_ecommerce
2
+ #
3
+ # This file was automatically generated for PostNL by
4
+ # APIMATIC v3.0 ( https://www.apimatic.io ).
5
+
6
+ module PostnlEcommerce
7
+ # checkoutOption.
8
+ class CheckoutOptionEnum
9
+ CHECKOUT_OPTION_ENUM = [
10
+ # TODO: Write general description for DAYTIME
11
+ DAYTIME = 'Daytime'.freeze,
12
+
13
+ # TODO: Write general description for EVENING
14
+ EVENING = 'Evening'.freeze,
15
+
16
+ # TODO: Write general description for SUNDAY
17
+ SUNDAY = 'Sunday'.freeze,
18
+
19
+ # TODO: Write general description for SAMEDAY
20
+ SAMEDAY = 'Sameday'.freeze,
21
+
22
+ # TODO: Write general description for TODAY
23
+ TODAY = 'Today'.freeze,
24
+
25
+ # TODO: Write general description for ENUM_08001000
26
+ ENUM_08001000 = '08:00-10:00'.freeze,
27
+
28
+ # TODO: Write general description for ENUM_08001200
29
+ ENUM_08001200 = '08:00-12:00'.freeze,
30
+
31
+ # TODO: Write general description for ENUM_08001700
32
+ ENUM_08001700 = '08:00-17:00'.freeze,
33
+
34
+ # TODO: Write general description for PICKUP
35
+ PICKUP = 'Pickup'.freeze
36
+ ].freeze
37
+
38
+ def self.validate(value)
39
+ return false if value.nil?
40
+
41
+ CHECKOUT_OPTION_ENUM.include?(value)
42
+ end
43
+
44
+ def self.from_value(value, default_value = DAYTIME)
45
+ return default_value if value.nil?
46
+
47
+ str = value.to_s.strip
48
+
49
+ case str.downcase
50
+ when 'daytime' then DAYTIME
51
+ when 'evening' then EVENING
52
+ when 'sunday' then SUNDAY
53
+ when 'sameday' then SAMEDAY
54
+ when 'today' then TODAY
55
+ when 'enum_08001000' then ENUM_08001000
56
+ when 'enum_08001200' then ENUM_08001200
57
+ when 'enum_08001700' then ENUM_08001700
58
+ when 'pickup' then PICKUP
59
+ else
60
+ default_value
61
+ end
62
+ end
63
+ end
64
+ end
@@ -0,0 +1,112 @@
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 pickup location address
8
+ class CheckoutPickupAddress < BaseModel
9
+ SKIP = Object.new
10
+ private_constant :SKIP
11
+
12
+ # The pickup location street
13
+ # @return [String]
14
+ attr_accessor :street
15
+
16
+ # The pickup location zipcode
17
+ # @return [String]
18
+ attr_accessor :zipcode
19
+
20
+ # The pickup location housenumber
21
+ # @return [Integer]
22
+ attr_accessor :house_nr
23
+
24
+ # The pickup location housenumber extension
25
+ # @return [String]
26
+ attr_accessor :house_nr_ext
27
+
28
+ # The pickup location country
29
+ # @return [String]
30
+ attr_accessor :countrycode
31
+
32
+ # The pickup location company name
33
+ # @return [String]
34
+ attr_accessor :company_name
35
+
36
+ # A mapping from model property names to API property names.
37
+ def self.names
38
+ @_hash = {} if @_hash.nil?
39
+ @_hash['street'] = 'Street'
40
+ @_hash['zipcode'] = 'Zipcode'
41
+ @_hash['house_nr'] = 'HouseNr'
42
+ @_hash['house_nr_ext'] = 'HouseNrExt'
43
+ @_hash['countrycode'] = 'Countrycode'
44
+ @_hash['company_name'] = 'CompanyName'
45
+ @_hash
46
+ end
47
+
48
+ # An array for optional fields
49
+ def self.optionals
50
+ %w[
51
+ street
52
+ zipcode
53
+ house_nr
54
+ house_nr_ext
55
+ countrycode
56
+ company_name
57
+ ]
58
+ end
59
+
60
+ # An array for nullable fields
61
+ def self.nullables
62
+ []
63
+ end
64
+
65
+ def initialize(street = SKIP, zipcode = SKIP, house_nr = SKIP,
66
+ house_nr_ext = SKIP, countrycode = SKIP, company_name = SKIP)
67
+ @street = street unless street == SKIP
68
+ @zipcode = zipcode unless zipcode == SKIP
69
+ @house_nr = house_nr unless house_nr == SKIP
70
+ @house_nr_ext = house_nr_ext unless house_nr_ext == SKIP
71
+ @countrycode = countrycode unless countrycode == SKIP
72
+ @company_name = company_name unless company_name == SKIP
73
+ end
74
+
75
+ # Creates an instance of the object from a hash.
76
+ def self.from_hash(hash)
77
+ return nil unless hash
78
+
79
+ # Extract variables from the hash.
80
+ street = hash.key?('Street') ? hash['Street'] : SKIP
81
+ zipcode = hash.key?('Zipcode') ? hash['Zipcode'] : SKIP
82
+ house_nr = hash.key?('HouseNr') ? hash['HouseNr'] : SKIP
83
+ house_nr_ext = hash.key?('HouseNrExt') ? hash['HouseNrExt'] : SKIP
84
+ countrycode = hash.key?('Countrycode') ? hash['Countrycode'] : SKIP
85
+ company_name = hash.key?('CompanyName') ? hash['CompanyName'] : SKIP
86
+
87
+ # Create object from extracted values.
88
+ CheckoutPickupAddress.new(street,
89
+ zipcode,
90
+ house_nr,
91
+ house_nr_ext,
92
+ countrycode,
93
+ company_name)
94
+ end
95
+
96
+ # Provides a human-readable string representation of the object.
97
+ def to_s
98
+ class_name = self.class.name.split('::').last
99
+ "<#{class_name} street: #{@street}, zipcode: #{@zipcode}, house_nr: #{@house_nr},"\
100
+ " house_nr_ext: #{@house_nr_ext}, countrycode: #{@countrycode}, company_name:"\
101
+ " #{@company_name}>"
102
+ end
103
+
104
+ # Provides a debugging-friendly string with detailed object information.
105
+ def inspect
106
+ class_name = self.class.name.split('::').last
107
+ "<#{class_name} street: #{@street.inspect}, zipcode: #{@zipcode.inspect}, house_nr:"\
108
+ " #{@house_nr.inspect}, house_nr_ext: #{@house_nr_ext.inspect}, countrycode:"\
109
+ " #{@countrycode.inspect}, company_name: #{@company_name.inspect}>"
110
+ end
111
+ end
112
+ end