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.
- checksums.yaml +7 -0
- data/LICENSE +28 -0
- data/README.md +164 -0
- data/bin/console +15 -0
- data/lib/postnl_ecommerce/api_helper.rb +10 -0
- data/lib/postnl_ecommerce/client.rb +126 -0
- data/lib/postnl_ecommerce/configuration.rb +195 -0
- data/lib/postnl_ecommerce/controllers/barcode_controller.rb +71 -0
- data/lib/postnl_ecommerce/controllers/base_controller.rb +60 -0
- data/lib/postnl_ecommerce/controllers/checkout_controller.rb +45 -0
- data/lib/postnl_ecommerce/controllers/confirming_controller.rb +45 -0
- data/lib/postnl_ecommerce/controllers/deliverydate_controller.rb +233 -0
- data/lib/postnl_ecommerce/controllers/labelling_controller.rb +52 -0
- data/lib/postnl_ecommerce/controllers/locations_controller.rb +271 -0
- data/lib/postnl_ecommerce/controllers/postalcode_check_controller.rb +60 -0
- data/lib/postnl_ecommerce/controllers/shipment_controller.rb +52 -0
- data/lib/postnl_ecommerce/controllers/shipping_status_controller.rb +222 -0
- data/lib/postnl_ecommerce/controllers/timeframes_controller.rb +90 -0
- data/lib/postnl_ecommerce/exceptions/api_exception.rb +21 -0
- data/lib/postnl_ecommerce/exceptions/barcode_response_invalid_exception.rb +57 -0
- data/lib/postnl_ecommerce/exceptions/confirming_response_error_exception.rb +55 -0
- data/lib/postnl_ecommerce/exceptions/internal_server_error_exception.rb +46 -0
- data/lib/postnl_ecommerce/exceptions/invalid_request_exception.rb +62 -0
- data/lib/postnl_ecommerce/exceptions/labelling_response_invalid_exception.rb +57 -0
- data/lib/postnl_ecommerce/exceptions/method_not_allowed_only_get_exception.rb +53 -0
- data/lib/postnl_ecommerce/exceptions/method_not_allowed_only_get_post_exception.rb +53 -0
- data/lib/postnl_ecommerce/exceptions/method_not_allowed_only_post_exception.rb +53 -0
- data/lib/postnl_ecommerce/exceptions/postalcode_check_response_invalid_exception.rb +55 -0
- data/lib/postnl_ecommerce/exceptions/too_many_requests_exception.rb +53 -0
- data/lib/postnl_ecommerce/exceptions/unauthorized_exception.rb +53 -0
- data/lib/postnl_ecommerce/http/api_response.rb +19 -0
- data/lib/postnl_ecommerce/http/auth/custom_header_authentication.rb +52 -0
- data/lib/postnl_ecommerce/http/http_call_back.rb +10 -0
- data/lib/postnl_ecommerce/http/http_method_enum.rb +10 -0
- data/lib/postnl_ecommerce/http/http_request.rb +10 -0
- data/lib/postnl_ecommerce/http/http_response.rb +10 -0
- data/lib/postnl_ecommerce/http/proxy_settings.rb +22 -0
- data/lib/postnl_ecommerce/models/address.rb +240 -0
- data/lib/postnl_ecommerce/models/address_type_enum.rb +36 -0
- data/lib/postnl_ecommerce/models/amount.rb +138 -0
- data/lib/postnl_ecommerce/models/barcode_error.rb +71 -0
- data/lib/postnl_ecommerce/models/barcode_response.rb +62 -0
- data/lib/postnl_ecommerce/models/base_model.rb +110 -0
- data/lib/postnl_ecommerce/models/checkout_address.rb +120 -0
- data/lib/postnl_ecommerce/models/checkout_cut_off_day_enum.rb +61 -0
- data/lib/postnl_ecommerce/models/checkout_cut_off_time.rb +91 -0
- data/lib/postnl_ecommerce/models/checkout_cut_off_type_enum.rb +40 -0
- data/lib/postnl_ecommerce/models/checkout_delivery_option.rb +81 -0
- data/lib/postnl_ecommerce/models/checkout_location.rb +126 -0
- data/lib/postnl_ecommerce/models/checkout_option_enum.rb +64 -0
- data/lib/postnl_ecommerce/models/checkout_pickup_address.rb +112 -0
- data/lib/postnl_ecommerce/models/checkout_pickup_option.rb +103 -0
- data/lib/postnl_ecommerce/models/checkout_request.rb +152 -0
- data/lib/postnl_ecommerce/models/checkout_response.rb +110 -0
- data/lib/postnl_ecommerce/models/checkout_time_frame.rb +108 -0
- data/lib/postnl_ecommerce/models/checkout_warning.rb +95 -0
- data/lib/postnl_ecommerce/models/checkout_warning_option_enum.rb +68 -0
- data/lib/postnl_ecommerce/models/code_enum.rb +44 -0
- data/lib/postnl_ecommerce/models/complete_status.rb +62 -0
- data/lib/postnl_ecommerce/models/complete_status_shipment.rb +270 -0
- data/lib/postnl_ecommerce/models/confirming_custom.rb +239 -0
- data/lib/postnl_ecommerce/models/confirming_custom_content.rb +113 -0
- data/lib/postnl_ecommerce/models/confirming_error.rb +71 -0
- data/lib/postnl_ecommerce/models/confirming_message.rb +70 -0
- data/lib/postnl_ecommerce/models/confirming_request.rb +86 -0
- data/lib/postnl_ecommerce/models/confirming_response.rb +71 -0
- data/lib/postnl_ecommerce/models/confirming_response_shipment.rb +103 -0
- data/lib/postnl_ecommerce/models/confirming_shipment.rb +472 -0
- data/lib/postnl_ecommerce/models/contact.rb +101 -0
- data/lib/postnl_ecommerce/models/countrycode_enum.rb +36 -0
- data/lib/postnl_ecommerce/models/currency_enum.rb +44 -0
- data/lib/postnl_ecommerce/models/currency_labelling_api_enum.rb +36 -0
- data/lib/postnl_ecommerce/models/current_status.rb +62 -0
- data/lib/postnl_ecommerce/models/current_status_shipment.rb +207 -0
- data/lib/postnl_ecommerce/models/customer.rb +123 -0
- data/lib/postnl_ecommerce/models/customer_address.rb +237 -0
- data/lib/postnl_ecommerce/models/customs.rb +238 -0
- data/lib/postnl_ecommerce/models/customs_labelling_api.rb +238 -0
- data/lib/postnl_ecommerce/models/delivery_options.rb +64 -0
- data/lib/postnl_ecommerce/models/deliverydate_delivery_response.rb +87 -0
- data/lib/postnl_ecommerce/models/deliverydate_option_enum.rb +56 -0
- data/lib/postnl_ecommerce/models/deliverydate_options.rb +65 -0
- data/lib/postnl_ecommerce/models/deliverydate_shipping_response.rb +62 -0
- data/lib/postnl_ecommerce/models/detail.rb +62 -0
- data/lib/postnl_ecommerce/models/dimension.rb +106 -0
- data/lib/postnl_ecommerce/models/error.rb +73 -0
- data/lib/postnl_ecommerce/models/event.rb +127 -0
- data/lib/postnl_ecommerce/models/expectation.rb +71 -0
- data/lib/postnl_ecommerce/models/extra_field.rb +71 -0
- data/lib/postnl_ecommerce/models/fault.rb +71 -0
- data/lib/postnl_ecommerce/models/fault_shipping_status_api.rb +71 -0
- data/lib/postnl_ecommerce/models/friday.rb +62 -0
- data/lib/postnl_ecommerce/models/get_locations_result_multiple.rb +71 -0
- data/lib/postnl_ecommerce/models/get_locations_result_single.rb +62 -0
- data/lib/postnl_ecommerce/models/group.rb +97 -0
- data/lib/postnl_ecommerce/models/hazardous_material.rb +178 -0
- data/lib/postnl_ecommerce/models/labelling_customer.rb +123 -0
- data/lib/postnl_ecommerce/models/labelling_customer_labelling_api.rb +123 -0
- data/lib/postnl_ecommerce/models/labelling_customer_message.rb +83 -0
- data/lib/postnl_ecommerce/models/labelling_customer_shipment.rb +484 -0
- data/lib/postnl_ecommerce/models/labelling_customer_shipment_labelling_api.rb +484 -0
- data/lib/postnl_ecommerce/models/labelling_customs_content.rb +111 -0
- data/lib/postnl_ecommerce/models/labelling_error.rb +81 -0
- data/lib/postnl_ecommerce/models/labelling_label.rb +84 -0
- data/lib/postnl_ecommerce/models/labelling_merged_label.rb +80 -0
- data/lib/postnl_ecommerce/models/labelling_request.rb +112 -0
- data/lib/postnl_ecommerce/models/labelling_response.rb +95 -0
- data/lib/postnl_ecommerce/models/labelling_response_shipment.rb +123 -0
- data/lib/postnl_ecommerce/models/language_enum.rb +48 -0
- data/lib/postnl_ecommerce/models/location.rb +174 -0
- data/lib/postnl_ecommerce/models/location_response_single.rb +63 -0
- data/lib/postnl_ecommerce/models/locations_address.rb +122 -0
- data/lib/postnl_ecommerce/models/locations_delivery_option_enum.rb +40 -0
- data/lib/postnl_ecommerce/models/locations_opening_hours.rb +121 -0
- data/lib/postnl_ecommerce/models/locations_response_multiple.rb +63 -0
- data/lib/postnl_ecommerce/models/monday.rb +62 -0
- data/lib/postnl_ecommerce/models/no_timeframes_options.rb +62 -0
- data/lib/postnl_ecommerce/models/old_status.rb +106 -0
- data/lib/postnl_ecommerce/models/opening_hours.rb +121 -0
- data/lib/postnl_ecommerce/models/opening_hours_per_day.rb +71 -0
- data/lib/postnl_ecommerce/models/options.rb +64 -0
- data/lib/postnl_ecommerce/models/origin_country_code_enum.rb +36 -0
- data/lib/postnl_ecommerce/models/postalcode_check_address.rb +116 -0
- data/lib/postnl_ecommerce/models/postalcode_check_error.rb +81 -0
- data/lib/postnl_ecommerce/models/product_option.rb +74 -0
- data/lib/postnl_ecommerce/models/reason_no_timeframe.rb +104 -0
- data/lib/postnl_ecommerce/models/reason_no_timeframes.rb +71 -0
- data/lib/postnl_ecommerce/models/saturday.rb +62 -0
- data/lib/postnl_ecommerce/models/shipment_type_enum.rb +50 -0
- data/lib/postnl_ecommerce/models/shippingstatus_address.rb +204 -0
- data/lib/postnl_ecommerce/models/shippingstatus_amount.rb +75 -0
- data/lib/postnl_ecommerce/models/shippingstatus_customer.rb +83 -0
- data/lib/postnl_ecommerce/models/shippingstatus_dimension.rb +101 -0
- data/lib/postnl_ecommerce/models/shippingstatus_product_option.rb +74 -0
- data/lib/postnl_ecommerce/models/shippingstatus_product_options.rb +63 -0
- data/lib/postnl_ecommerce/models/shippingstatus_response.rb +94 -0
- data/lib/postnl_ecommerce/models/shippingstatus_response_signature.rb +71 -0
- data/lib/postnl_ecommerce/models/shippingstatus_response_updated_shipment.rb +105 -0
- data/lib/postnl_ecommerce/models/shippingstatus_warning.rb +71 -0
- data/lib/postnl_ecommerce/models/signature.rb +84 -0
- data/lib/postnl_ecommerce/models/status.rb +108 -0
- data/lib/postnl_ecommerce/models/sunday.rb +62 -0
- data/lib/postnl_ecommerce/models/sustainability.rb +73 -0
- data/lib/postnl_ecommerce/models/thursday.rb +62 -0
- data/lib/postnl_ecommerce/models/timeframe.rb +71 -0
- data/lib/postnl_ecommerce/models/timeframe_options_enum.rb +60 -0
- data/lib/postnl_ecommerce/models/timeframe_response.rb +74 -0
- data/lib/postnl_ecommerce/models/timeframe_timeframe.rb +96 -0
- data/lib/postnl_ecommerce/models/timeframes.rb +71 -0
- data/lib/postnl_ecommerce/models/timeframes_response_object.rb +71 -0
- data/lib/postnl_ecommerce/models/tuesday.rb +62 -0
- data/lib/postnl_ecommerce/models/type_enum.rb +64 -0
- data/lib/postnl_ecommerce/models/updated_shipment_status.rb +108 -0
- data/lib/postnl_ecommerce/models/warning.rb +71 -0
- data/lib/postnl_ecommerce/models/warnings.rb +62 -0
- data/lib/postnl_ecommerce/models/wednesday.rb +62 -0
- data/lib/postnl_ecommerce/utilities/date_time_helper.rb +11 -0
- data/lib/postnl_ecommerce/utilities/file_wrapper.rb +28 -0
- data/lib/postnl_ecommerce.rb +188 -0
- data/test/controllers/controller_test_base.rb +23 -0
- data/test/controllers/test_barcode_controller.rb +52 -0
- data/test/controllers/test_checkout_controller.rb +63 -0
- data/test/controllers/test_confirming_controller.rb +54 -0
- data/test/controllers/test_deliverydate_controller.rb +60 -0
- data/test/controllers/test_labelling_controller.rb +57 -0
- data/test/controllers/test_locations_controller.rb +185 -0
- data/test/controllers/test_postalcode_check_controller.rb +55 -0
- data/test/controllers/test_shipment_controller.rb +57 -0
- data/test/controllers/test_shipping_status_controller.rb +209 -0
- data/test/controllers/test_timeframes_controller.rb +67 -0
- data/test/http_response_catcher.rb +19 -0
- metadata +283 -0
|
@@ -0,0 +1,103 @@
|
|
|
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
|
+
# CheckoutPickupOption Model.
|
|
8
|
+
class CheckoutPickupOption < BaseModel
|
|
9
|
+
SKIP = Object.new
|
|
10
|
+
private_constant :SKIP
|
|
11
|
+
|
|
12
|
+
# Date from which the parcel can be picked up at the PostNL location
|
|
13
|
+
# @return [String]
|
|
14
|
+
attr_accessor :pickup_date
|
|
15
|
+
|
|
16
|
+
# The date when you need to deliver the shipment to PostNL to ensure the
|
|
17
|
+
# expected delivery date is achieved. Will be returned as 'null' if not
|
|
18
|
+
# calculated
|
|
19
|
+
# @return [String]
|
|
20
|
+
attr_accessor :shipping_date
|
|
21
|
+
|
|
22
|
+
# The pickup option
|
|
23
|
+
# @return [String]
|
|
24
|
+
attr_accessor :option
|
|
25
|
+
|
|
26
|
+
# Array of pickup locations
|
|
27
|
+
# @return [Array[CheckoutLocation]]
|
|
28
|
+
attr_accessor :locations
|
|
29
|
+
|
|
30
|
+
# A mapping from model property names to API property names.
|
|
31
|
+
def self.names
|
|
32
|
+
@_hash = {} if @_hash.nil?
|
|
33
|
+
@_hash['pickup_date'] = 'PickupDate'
|
|
34
|
+
@_hash['shipping_date'] = 'ShippingDate'
|
|
35
|
+
@_hash['option'] = 'Option'
|
|
36
|
+
@_hash['locations'] = 'Locations'
|
|
37
|
+
@_hash
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
# An array for optional fields
|
|
41
|
+
def self.optionals
|
|
42
|
+
%w[
|
|
43
|
+
pickup_date
|
|
44
|
+
shipping_date
|
|
45
|
+
option
|
|
46
|
+
locations
|
|
47
|
+
]
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
# An array for nullable fields
|
|
51
|
+
def self.nullables
|
|
52
|
+
[]
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
def initialize(pickup_date = SKIP, shipping_date = SKIP, option = SKIP,
|
|
56
|
+
locations = SKIP)
|
|
57
|
+
@pickup_date = pickup_date unless pickup_date == SKIP
|
|
58
|
+
@shipping_date = shipping_date unless shipping_date == SKIP
|
|
59
|
+
@option = option unless option == SKIP
|
|
60
|
+
@locations = locations unless locations == SKIP
|
|
61
|
+
end
|
|
62
|
+
|
|
63
|
+
# Creates an instance of the object from a hash.
|
|
64
|
+
def self.from_hash(hash)
|
|
65
|
+
return nil unless hash
|
|
66
|
+
|
|
67
|
+
# Extract variables from the hash.
|
|
68
|
+
pickup_date = hash.key?('PickupDate') ? hash['PickupDate'] : SKIP
|
|
69
|
+
shipping_date = hash.key?('ShippingDate') ? hash['ShippingDate'] : SKIP
|
|
70
|
+
option = hash.key?('Option') ? hash['Option'] : SKIP
|
|
71
|
+
# Parameter is an array, so we need to iterate through it
|
|
72
|
+
locations = nil
|
|
73
|
+
unless hash['Locations'].nil?
|
|
74
|
+
locations = []
|
|
75
|
+
hash['Locations'].each do |structure|
|
|
76
|
+
locations << (CheckoutLocation.from_hash(structure) if structure)
|
|
77
|
+
end
|
|
78
|
+
end
|
|
79
|
+
|
|
80
|
+
locations = SKIP unless hash.key?('Locations')
|
|
81
|
+
|
|
82
|
+
# Create object from extracted values.
|
|
83
|
+
CheckoutPickupOption.new(pickup_date,
|
|
84
|
+
shipping_date,
|
|
85
|
+
option,
|
|
86
|
+
locations)
|
|
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} pickup_date: #{@pickup_date}, shipping_date: #{@shipping_date}, option:"\
|
|
93
|
+
" #{@option}, locations: #{@locations}>"
|
|
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} pickup_date: #{@pickup_date.inspect}, shipping_date:"\
|
|
100
|
+
" #{@shipping_date.inspect}, option: #{@option.inspect}, locations: #{@locations.inspect}>"
|
|
101
|
+
end
|
|
102
|
+
end
|
|
103
|
+
end
|
|
@@ -0,0 +1,152 @@
|
|
|
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
|
+
# CheckoutRequest Model.
|
|
8
|
+
class CheckoutRequest < BaseModel
|
|
9
|
+
SKIP = Object.new
|
|
10
|
+
private_constant :SKIP
|
|
11
|
+
|
|
12
|
+
# The order date of the shipment. Format dd-MM-YYYY HH:mm:ss
|
|
13
|
+
# @return [String]
|
|
14
|
+
attr_accessor :order_date
|
|
15
|
+
|
|
16
|
+
# The amount of days it takes for a parcel to be received by PostN. If you
|
|
17
|
+
# delivery the parcel the same day as the order is placed on the webshop,
|
|
18
|
+
# please use the value of 1. A value of 2 means the parcel will arrive at
|
|
19
|
+
# PostNL a day later etc.
|
|
20
|
+
# @return [Integer]
|
|
21
|
+
attr_accessor :shipping_duration
|
|
22
|
+
|
|
23
|
+
# Array of CutOffTimes
|
|
24
|
+
# @return [Array[CheckoutCutOffTime]]
|
|
25
|
+
attr_accessor :cut_off_times
|
|
26
|
+
|
|
27
|
+
# Specifies whether you are available to ship parcels to PostNL during
|
|
28
|
+
# holidays
|
|
29
|
+
# @return [TrueClass | FalseClass]
|
|
30
|
+
attr_accessor :holiday_sorting
|
|
31
|
+
|
|
32
|
+
# Specifies the delivery and pickup options.
|
|
33
|
+
# @return [Array[CheckoutOptionEnum]]
|
|
34
|
+
attr_accessor :options
|
|
35
|
+
|
|
36
|
+
# Specifies the number of locations you want returned. This can be a value
|
|
37
|
+
# of 1-3
|
|
38
|
+
# @return [Integer]
|
|
39
|
+
attr_accessor :locations
|
|
40
|
+
|
|
41
|
+
# Specifies the number of days for which the timeframes are returned. This
|
|
42
|
+
# can be a value of 1-9
|
|
43
|
+
# @return [Integer]
|
|
44
|
+
attr_accessor :days
|
|
45
|
+
|
|
46
|
+
# Array of addresses
|
|
47
|
+
# @return [Array[CheckoutAddress]]
|
|
48
|
+
attr_accessor :addresses
|
|
49
|
+
|
|
50
|
+
# A mapping from model property names to API property names.
|
|
51
|
+
def self.names
|
|
52
|
+
@_hash = {} if @_hash.nil?
|
|
53
|
+
@_hash['order_date'] = 'OrderDate'
|
|
54
|
+
@_hash['shipping_duration'] = 'ShippingDuration'
|
|
55
|
+
@_hash['cut_off_times'] = 'CutOffTimes'
|
|
56
|
+
@_hash['holiday_sorting'] = 'HolidaySorting'
|
|
57
|
+
@_hash['options'] = 'Options'
|
|
58
|
+
@_hash['locations'] = 'Locations'
|
|
59
|
+
@_hash['days'] = 'Days'
|
|
60
|
+
@_hash['addresses'] = 'Addresses'
|
|
61
|
+
@_hash
|
|
62
|
+
end
|
|
63
|
+
|
|
64
|
+
# An array for optional fields
|
|
65
|
+
def self.optionals
|
|
66
|
+
%w[
|
|
67
|
+
shipping_duration
|
|
68
|
+
holiday_sorting
|
|
69
|
+
]
|
|
70
|
+
end
|
|
71
|
+
|
|
72
|
+
# An array for nullable fields
|
|
73
|
+
def self.nullables
|
|
74
|
+
[]
|
|
75
|
+
end
|
|
76
|
+
|
|
77
|
+
def initialize(order_date = nil, cut_off_times = nil, options = nil,
|
|
78
|
+
locations = nil, days = nil, addresses = nil,
|
|
79
|
+
shipping_duration = SKIP, holiday_sorting = SKIP)
|
|
80
|
+
@order_date = order_date
|
|
81
|
+
@shipping_duration = shipping_duration unless shipping_duration == SKIP
|
|
82
|
+
@cut_off_times = cut_off_times
|
|
83
|
+
@holiday_sorting = holiday_sorting unless holiday_sorting == SKIP
|
|
84
|
+
@options = options
|
|
85
|
+
@locations = locations
|
|
86
|
+
@days = days
|
|
87
|
+
@addresses = addresses
|
|
88
|
+
end
|
|
89
|
+
|
|
90
|
+
# Creates an instance of the object from a hash.
|
|
91
|
+
def self.from_hash(hash)
|
|
92
|
+
return nil unless hash
|
|
93
|
+
|
|
94
|
+
# Extract variables from the hash.
|
|
95
|
+
order_date = hash.key?('OrderDate') ? hash['OrderDate'] : nil
|
|
96
|
+
# Parameter is an array, so we need to iterate through it
|
|
97
|
+
cut_off_times = nil
|
|
98
|
+
unless hash['CutOffTimes'].nil?
|
|
99
|
+
cut_off_times = []
|
|
100
|
+
hash['CutOffTimes'].each do |structure|
|
|
101
|
+
cut_off_times << (CheckoutCutOffTime.from_hash(structure) if structure)
|
|
102
|
+
end
|
|
103
|
+
end
|
|
104
|
+
|
|
105
|
+
cut_off_times = nil unless hash.key?('CutOffTimes')
|
|
106
|
+
options = hash.key?('Options') ? hash['Options'] : nil
|
|
107
|
+
locations = hash.key?('Locations') ? hash['Locations'] : nil
|
|
108
|
+
days = hash.key?('Days') ? hash['Days'] : nil
|
|
109
|
+
# Parameter is an array, so we need to iterate through it
|
|
110
|
+
addresses = nil
|
|
111
|
+
unless hash['Addresses'].nil?
|
|
112
|
+
addresses = []
|
|
113
|
+
hash['Addresses'].each do |structure|
|
|
114
|
+
addresses << (CheckoutAddress.from_hash(structure) if structure)
|
|
115
|
+
end
|
|
116
|
+
end
|
|
117
|
+
|
|
118
|
+
addresses = nil unless hash.key?('Addresses')
|
|
119
|
+
shipping_duration =
|
|
120
|
+
hash.key?('ShippingDuration') ? hash['ShippingDuration'] : SKIP
|
|
121
|
+
holiday_sorting =
|
|
122
|
+
hash.key?('HolidaySorting') ? hash['HolidaySorting'] : SKIP
|
|
123
|
+
|
|
124
|
+
# Create object from extracted values.
|
|
125
|
+
CheckoutRequest.new(order_date,
|
|
126
|
+
cut_off_times,
|
|
127
|
+
options,
|
|
128
|
+
locations,
|
|
129
|
+
days,
|
|
130
|
+
addresses,
|
|
131
|
+
shipping_duration,
|
|
132
|
+
holiday_sorting)
|
|
133
|
+
end
|
|
134
|
+
|
|
135
|
+
# Provides a human-readable string representation of the object.
|
|
136
|
+
def to_s
|
|
137
|
+
class_name = self.class.name.split('::').last
|
|
138
|
+
"<#{class_name} order_date: #{@order_date}, shipping_duration: #{@shipping_duration},"\
|
|
139
|
+
" cut_off_times: #{@cut_off_times}, holiday_sorting: #{@holiday_sorting}, options:"\
|
|
140
|
+
" #{@options}, locations: #{@locations}, days: #{@days}, addresses: #{@addresses}>"
|
|
141
|
+
end
|
|
142
|
+
|
|
143
|
+
# Provides a debugging-friendly string with detailed object information.
|
|
144
|
+
def inspect
|
|
145
|
+
class_name = self.class.name.split('::').last
|
|
146
|
+
"<#{class_name} order_date: #{@order_date.inspect}, shipping_duration:"\
|
|
147
|
+
" #{@shipping_duration.inspect}, cut_off_times: #{@cut_off_times.inspect}, holiday_sorting:"\
|
|
148
|
+
" #{@holiday_sorting.inspect}, options: #{@options.inspect}, locations:"\
|
|
149
|
+
" #{@locations.inspect}, days: #{@days.inspect}, addresses: #{@addresses.inspect}>"
|
|
150
|
+
end
|
|
151
|
+
end
|
|
152
|
+
end
|
|
@@ -0,0 +1,110 @@
|
|
|
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
|
+
# CheckoutResponse Model.
|
|
8
|
+
class CheckoutResponse < BaseModel
|
|
9
|
+
SKIP = Object.new
|
|
10
|
+
private_constant :SKIP
|
|
11
|
+
|
|
12
|
+
# Array of delivery options
|
|
13
|
+
# @return [Array[CheckoutDeliveryOption]]
|
|
14
|
+
attr_accessor :delivery_options
|
|
15
|
+
|
|
16
|
+
# Array of possible pickup options
|
|
17
|
+
# @return [Array[CheckoutPickupOption]]
|
|
18
|
+
attr_accessor :pickup_options
|
|
19
|
+
|
|
20
|
+
# An array of warnings
|
|
21
|
+
# @return [Array[CheckoutWarning]]
|
|
22
|
+
attr_accessor :warnings
|
|
23
|
+
|
|
24
|
+
# A mapping from model property names to API property names.
|
|
25
|
+
def self.names
|
|
26
|
+
@_hash = {} if @_hash.nil?
|
|
27
|
+
@_hash['delivery_options'] = 'DeliveryOptions'
|
|
28
|
+
@_hash['pickup_options'] = 'PickupOptions'
|
|
29
|
+
@_hash['warnings'] = 'Warnings'
|
|
30
|
+
@_hash
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
# An array for optional fields
|
|
34
|
+
def self.optionals
|
|
35
|
+
%w[
|
|
36
|
+
delivery_options
|
|
37
|
+
pickup_options
|
|
38
|
+
warnings
|
|
39
|
+
]
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
# An array for nullable fields
|
|
43
|
+
def self.nullables
|
|
44
|
+
[]
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
def initialize(delivery_options = SKIP, pickup_options = SKIP,
|
|
48
|
+
warnings = SKIP)
|
|
49
|
+
@delivery_options = delivery_options unless delivery_options == SKIP
|
|
50
|
+
@pickup_options = pickup_options unless pickup_options == SKIP
|
|
51
|
+
@warnings = warnings unless warnings == 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
|
+
# Parameter is an array, so we need to iterate through it
|
|
60
|
+
delivery_options = nil
|
|
61
|
+
unless hash['DeliveryOptions'].nil?
|
|
62
|
+
delivery_options = []
|
|
63
|
+
hash['DeliveryOptions'].each do |structure|
|
|
64
|
+
delivery_options << (CheckoutDeliveryOption.from_hash(structure) if structure)
|
|
65
|
+
end
|
|
66
|
+
end
|
|
67
|
+
|
|
68
|
+
delivery_options = SKIP unless hash.key?('DeliveryOptions')
|
|
69
|
+
# Parameter is an array, so we need to iterate through it
|
|
70
|
+
pickup_options = nil
|
|
71
|
+
unless hash['PickupOptions'].nil?
|
|
72
|
+
pickup_options = []
|
|
73
|
+
hash['PickupOptions'].each do |structure|
|
|
74
|
+
pickup_options << (CheckoutPickupOption.from_hash(structure) if structure)
|
|
75
|
+
end
|
|
76
|
+
end
|
|
77
|
+
|
|
78
|
+
pickup_options = SKIP unless hash.key?('PickupOptions')
|
|
79
|
+
# Parameter is an array, so we need to iterate through it
|
|
80
|
+
warnings = nil
|
|
81
|
+
unless hash['Warnings'].nil?
|
|
82
|
+
warnings = []
|
|
83
|
+
hash['Warnings'].each do |structure|
|
|
84
|
+
warnings << (CheckoutWarning.from_hash(structure) if structure)
|
|
85
|
+
end
|
|
86
|
+
end
|
|
87
|
+
|
|
88
|
+
warnings = SKIP unless hash.key?('Warnings')
|
|
89
|
+
|
|
90
|
+
# Create object from extracted values.
|
|
91
|
+
CheckoutResponse.new(delivery_options,
|
|
92
|
+
pickup_options,
|
|
93
|
+
warnings)
|
|
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} delivery_options: #{@delivery_options}, pickup_options: #{@pickup_options},"\
|
|
100
|
+
" warnings: #{@warnings}>"
|
|
101
|
+
end
|
|
102
|
+
|
|
103
|
+
# Provides a debugging-friendly string with detailed object information.
|
|
104
|
+
def inspect
|
|
105
|
+
class_name = self.class.name.split('::').last
|
|
106
|
+
"<#{class_name} delivery_options: #{@delivery_options.inspect}, pickup_options:"\
|
|
107
|
+
" #{@pickup_options.inspect}, warnings: #{@warnings.inspect}>"
|
|
108
|
+
end
|
|
109
|
+
end
|
|
110
|
+
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
|
+
# CheckoutTimeFrame Model.
|
|
8
|
+
class CheckoutTimeFrame < BaseModel
|
|
9
|
+
SKIP = Object.new
|
|
10
|
+
private_constant :SKIP
|
|
11
|
+
|
|
12
|
+
# Format hh:mm:ss
|
|
13
|
+
# @return [String]
|
|
14
|
+
attr_accessor :from
|
|
15
|
+
|
|
16
|
+
# Format hh:mm:ss
|
|
17
|
+
# @return [String]
|
|
18
|
+
attr_accessor :to
|
|
19
|
+
|
|
20
|
+
# The delivery options applicable to the timeframe information. See
|
|
21
|
+
# [Delivery
|
|
22
|
+
# Options](https://developer.postnl.nl/docs/#/http/reference-data/reference-
|
|
23
|
+
# codes/delivery-options) for possible values.
|
|
24
|
+
# @return [Array[CheckoutOptionEnum]]
|
|
25
|
+
attr_accessor :options
|
|
26
|
+
|
|
27
|
+
# The date when you need to deliver the shipment to PostNL to ensure the
|
|
28
|
+
# expected delivery date is achieved. Will be returned as 'null' if not
|
|
29
|
+
# calculated
|
|
30
|
+
# @return [String]
|
|
31
|
+
attr_accessor :shipping_date
|
|
32
|
+
|
|
33
|
+
# Sustainability score; see [Sustainability
|
|
34
|
+
# codes](https://developer.postnl.nl/docs/#/http/reference-data/reference-co
|
|
35
|
+
# des/sustainability-codes) for possible values.
|
|
36
|
+
# @return [Sustainability]
|
|
37
|
+
attr_accessor :sustainability
|
|
38
|
+
|
|
39
|
+
# A mapping from model property names to API property names.
|
|
40
|
+
def self.names
|
|
41
|
+
@_hash = {} if @_hash.nil?
|
|
42
|
+
@_hash['from'] = 'From'
|
|
43
|
+
@_hash['to'] = 'To'
|
|
44
|
+
@_hash['options'] = 'Options'
|
|
45
|
+
@_hash['shipping_date'] = 'ShippingDate'
|
|
46
|
+
@_hash['sustainability'] = 'Sustainability'
|
|
47
|
+
@_hash
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
# An array for optional fields
|
|
51
|
+
def self.optionals
|
|
52
|
+
%w[
|
|
53
|
+
from
|
|
54
|
+
to
|
|
55
|
+
options
|
|
56
|
+
shipping_date
|
|
57
|
+
sustainability
|
|
58
|
+
]
|
|
59
|
+
end
|
|
60
|
+
|
|
61
|
+
# An array for nullable fields
|
|
62
|
+
def self.nullables
|
|
63
|
+
[]
|
|
64
|
+
end
|
|
65
|
+
|
|
66
|
+
def initialize(from = SKIP, to = SKIP, options = SKIP, shipping_date = SKIP,
|
|
67
|
+
sustainability = SKIP)
|
|
68
|
+
@from = from unless from == SKIP
|
|
69
|
+
@to = to unless to == SKIP
|
|
70
|
+
@options = options unless options == SKIP
|
|
71
|
+
@shipping_date = shipping_date unless shipping_date == SKIP
|
|
72
|
+
@sustainability = sustainability unless sustainability == 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
|
+
from = hash.key?('From') ? hash['From'] : SKIP
|
|
81
|
+
to = hash.key?('To') ? hash['To'] : SKIP
|
|
82
|
+
options = hash.key?('Options') ? hash['Options'] : SKIP
|
|
83
|
+
shipping_date = hash.key?('ShippingDate') ? hash['ShippingDate'] : SKIP
|
|
84
|
+
sustainability = Sustainability.from_hash(hash['Sustainability']) if hash['Sustainability']
|
|
85
|
+
|
|
86
|
+
# Create object from extracted values.
|
|
87
|
+
CheckoutTimeFrame.new(from,
|
|
88
|
+
to,
|
|
89
|
+
options,
|
|
90
|
+
shipping_date,
|
|
91
|
+
sustainability)
|
|
92
|
+
end
|
|
93
|
+
|
|
94
|
+
# Provides a human-readable string representation of the object.
|
|
95
|
+
def to_s
|
|
96
|
+
class_name = self.class.name.split('::').last
|
|
97
|
+
"<#{class_name} from: #{@from}, to: #{@to}, options: #{@options}, shipping_date:"\
|
|
98
|
+
" #{@shipping_date}, sustainability: #{@sustainability}>"
|
|
99
|
+
end
|
|
100
|
+
|
|
101
|
+
# Provides a debugging-friendly string with detailed object information.
|
|
102
|
+
def inspect
|
|
103
|
+
class_name = self.class.name.split('::').last
|
|
104
|
+
"<#{class_name} from: #{@from.inspect}, to: #{@to.inspect}, options: #{@options.inspect},"\
|
|
105
|
+
" shipping_date: #{@shipping_date.inspect}, sustainability: #{@sustainability.inspect}>"
|
|
106
|
+
end
|
|
107
|
+
end
|
|
108
|
+
end
|
|
@@ -0,0 +1,95 @@
|
|
|
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
|
+
# CheckoutWarning Model.
|
|
8
|
+
class CheckoutWarning < BaseModel
|
|
9
|
+
SKIP = Object.new
|
|
10
|
+
private_constant :SKIP
|
|
11
|
+
|
|
12
|
+
# Deliverydate that triggered the warning
|
|
13
|
+
# @return [String]
|
|
14
|
+
attr_accessor :delivery_date
|
|
15
|
+
|
|
16
|
+
# Warning code (for a possible list of warnings, see the generic error codes
|
|
17
|
+
# page)
|
|
18
|
+
# @return [String]
|
|
19
|
+
attr_accessor :code
|
|
20
|
+
|
|
21
|
+
# Warning description (for a possible list of warnings, see the generic
|
|
22
|
+
# error codes page)
|
|
23
|
+
# @return [String]
|
|
24
|
+
attr_accessor :description
|
|
25
|
+
|
|
26
|
+
# Warning description (for a possible list of warnings, see the generic
|
|
27
|
+
# error codes page)
|
|
28
|
+
# @return [CheckoutWarningOptionEnum]
|
|
29
|
+
attr_accessor :options
|
|
30
|
+
|
|
31
|
+
# A mapping from model property names to API property names.
|
|
32
|
+
def self.names
|
|
33
|
+
@_hash = {} if @_hash.nil?
|
|
34
|
+
@_hash['delivery_date'] = 'DeliveryDate'
|
|
35
|
+
@_hash['code'] = 'Code'
|
|
36
|
+
@_hash['description'] = 'Description'
|
|
37
|
+
@_hash['options'] = 'Options'
|
|
38
|
+
@_hash
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
# An array for optional fields
|
|
42
|
+
def self.optionals
|
|
43
|
+
%w[
|
|
44
|
+
delivery_date
|
|
45
|
+
code
|
|
46
|
+
description
|
|
47
|
+
options
|
|
48
|
+
]
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
# An array for nullable fields
|
|
52
|
+
def self.nullables
|
|
53
|
+
[]
|
|
54
|
+
end
|
|
55
|
+
|
|
56
|
+
def initialize(delivery_date = SKIP, code = SKIP, description = SKIP,
|
|
57
|
+
options = SKIP)
|
|
58
|
+
@delivery_date = delivery_date unless delivery_date == SKIP
|
|
59
|
+
@code = code unless code == SKIP
|
|
60
|
+
@description = description unless description == SKIP
|
|
61
|
+
@options = options unless options == SKIP
|
|
62
|
+
end
|
|
63
|
+
|
|
64
|
+
# Creates an instance of the object from a hash.
|
|
65
|
+
def self.from_hash(hash)
|
|
66
|
+
return nil unless hash
|
|
67
|
+
|
|
68
|
+
# Extract variables from the hash.
|
|
69
|
+
delivery_date = hash.key?('DeliveryDate') ? hash['DeliveryDate'] : SKIP
|
|
70
|
+
code = hash.key?('Code') ? hash['Code'] : SKIP
|
|
71
|
+
description = hash.key?('Description') ? hash['Description'] : SKIP
|
|
72
|
+
options = hash.key?('Options') ? hash['Options'] : SKIP
|
|
73
|
+
|
|
74
|
+
# Create object from extracted values.
|
|
75
|
+
CheckoutWarning.new(delivery_date,
|
|
76
|
+
code,
|
|
77
|
+
description,
|
|
78
|
+
options)
|
|
79
|
+
end
|
|
80
|
+
|
|
81
|
+
# Provides a human-readable string representation of the object.
|
|
82
|
+
def to_s
|
|
83
|
+
class_name = self.class.name.split('::').last
|
|
84
|
+
"<#{class_name} delivery_date: #{@delivery_date}, code: #{@code}, description:"\
|
|
85
|
+
" #{@description}, options: #{@options}>"
|
|
86
|
+
end
|
|
87
|
+
|
|
88
|
+
# Provides a debugging-friendly string with detailed object information.
|
|
89
|
+
def inspect
|
|
90
|
+
class_name = self.class.name.split('::').last
|
|
91
|
+
"<#{class_name} delivery_date: #{@delivery_date.inspect}, code: #{@code.inspect},"\
|
|
92
|
+
" description: #{@description.inspect}, options: #{@options.inspect}>"
|
|
93
|
+
end
|
|
94
|
+
end
|
|
95
|
+
end
|
|
@@ -0,0 +1,68 @@
|
|
|
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
|
+
# checkoutWarningOption.
|
|
8
|
+
class CheckoutWarningOptionEnum
|
|
9
|
+
CHECKOUT_WARNING_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 SAMEDAY
|
|
17
|
+
SAMEDAY = 'Sameday'.freeze,
|
|
18
|
+
|
|
19
|
+
# TODO: Write general description for SUNDAY
|
|
20
|
+
SUNDAY = 'Sunday'.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 ENUM_08000900
|
|
35
|
+
ENUM_08000900 = '08:00-09:00'.freeze,
|
|
36
|
+
|
|
37
|
+
# TODO: Write general description for PICKUP
|
|
38
|
+
PICKUP = 'Pickup'.freeze
|
|
39
|
+
].freeze
|
|
40
|
+
|
|
41
|
+
def self.validate(value)
|
|
42
|
+
return false if value.nil?
|
|
43
|
+
|
|
44
|
+
CHECKOUT_WARNING_OPTION_ENUM.include?(value)
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
def self.from_value(value, default_value = DAYTIME)
|
|
48
|
+
return default_value if value.nil?
|
|
49
|
+
|
|
50
|
+
str = value.to_s.strip
|
|
51
|
+
|
|
52
|
+
case str.downcase
|
|
53
|
+
when 'daytime' then DAYTIME
|
|
54
|
+
when 'evening' then EVENING
|
|
55
|
+
when 'sameday' then SAMEDAY
|
|
56
|
+
when 'sunday' then SUNDAY
|
|
57
|
+
when 'today' then TODAY
|
|
58
|
+
when 'enum_08001000' then ENUM_08001000
|
|
59
|
+
when 'enum_08001200' then ENUM_08001200
|
|
60
|
+
when 'enum_08001700' then ENUM_08001700
|
|
61
|
+
when 'enum_08000900' then ENUM_08000900
|
|
62
|
+
when 'pickup' then PICKUP
|
|
63
|
+
else
|
|
64
|
+
default_value
|
|
65
|
+
end
|
|
66
|
+
end
|
|
67
|
+
end
|
|
68
|
+
end
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
# postnl_ecommerce
|
|
2
|
+
#
|
|
3
|
+
# This file was automatically generated for PostNL by
|
|
4
|
+
# APIMATIC v3.0 ( https://www.apimatic.io ).
|
|
5
|
+
|
|
6
|
+
module PostnlEcommerce
|
|
7
|
+
# Sustainability score code
|
|
8
|
+
class CodeEnum
|
|
9
|
+
CODE_ENUM = [
|
|
10
|
+
# TODO: Write general description for ENUM_00
|
|
11
|
+
ENUM_00 = '00'.freeze,
|
|
12
|
+
|
|
13
|
+
# TODO: Write general description for ENUM_01
|
|
14
|
+
ENUM_01 = '01'.freeze,
|
|
15
|
+
|
|
16
|
+
# TODO: Write general description for ENUM_02
|
|
17
|
+
ENUM_02 = '02'.freeze,
|
|
18
|
+
|
|
19
|
+
# TODO: Write general description for ENUM_03
|
|
20
|
+
ENUM_03 = '03'.freeze
|
|
21
|
+
].freeze
|
|
22
|
+
|
|
23
|
+
def self.validate(value)
|
|
24
|
+
return false if value.nil?
|
|
25
|
+
|
|
26
|
+
CODE_ENUM.include?(value)
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
def self.from_value(value, default_value = ENUM_00)
|
|
30
|
+
return default_value if value.nil?
|
|
31
|
+
|
|
32
|
+
str = value.to_s.strip
|
|
33
|
+
|
|
34
|
+
case str.downcase
|
|
35
|
+
when 'enum_00' then ENUM_00
|
|
36
|
+
when 'enum_01' then ENUM_01
|
|
37
|
+
when 'enum_02' then ENUM_02
|
|
38
|
+
when 'enum_03' then ENUM_03
|
|
39
|
+
else
|
|
40
|
+
default_value
|
|
41
|
+
end
|
|
42
|
+
end
|
|
43
|
+
end
|
|
44
|
+
end
|