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,240 @@
|
|
|
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
|
+
# Address Model.
|
|
8
|
+
class Address < BaseModel
|
|
9
|
+
SKIP = Object.new
|
|
10
|
+
private_constant :SKIP
|
|
11
|
+
|
|
12
|
+
# Type of the address. This is a code. You can find the possible values at
|
|
13
|
+
# [Address
|
|
14
|
+
# types](https://developer.postnl.nl/docs/#/http/reference-data/reference-co
|
|
15
|
+
# des/address-types)
|
|
16
|
+
# @return [String]
|
|
17
|
+
attr_accessor :address_type
|
|
18
|
+
|
|
19
|
+
# Area of the address
|
|
20
|
+
# @return [String]
|
|
21
|
+
attr_accessor :area
|
|
22
|
+
|
|
23
|
+
# Building name of the address
|
|
24
|
+
# @return [String]
|
|
25
|
+
attr_accessor :buildingname
|
|
26
|
+
|
|
27
|
+
# City of the address
|
|
28
|
+
# @return [String]
|
|
29
|
+
attr_accessor :city
|
|
30
|
+
|
|
31
|
+
# This field has a dependency with the field Name. One of both fields must
|
|
32
|
+
# be filled mandatory; using both fields is also allowed. Mandatory when
|
|
33
|
+
# AddressType is 09.
|
|
34
|
+
# @return [String]
|
|
35
|
+
attr_accessor :company_name
|
|
36
|
+
|
|
37
|
+
# The ISO2 country codes
|
|
38
|
+
# @return [String]
|
|
39
|
+
attr_accessor :countrycode
|
|
40
|
+
|
|
41
|
+
# Send to specific department of a company
|
|
42
|
+
# @return [String]
|
|
43
|
+
attr_accessor :department
|
|
44
|
+
|
|
45
|
+
# Door code of address. Mandatory for some international shipments.
|
|
46
|
+
# @return [String]
|
|
47
|
+
attr_accessor :doorcode
|
|
48
|
+
|
|
49
|
+
# Remark: please add FirstName and Name (lastname) of the receiver to
|
|
50
|
+
# improve the parcel tracking experience of your customer.
|
|
51
|
+
# @return [String]
|
|
52
|
+
attr_accessor :first_name
|
|
53
|
+
|
|
54
|
+
# Send to specific floor of a company
|
|
55
|
+
# @return [String]
|
|
56
|
+
attr_accessor :floor
|
|
57
|
+
|
|
58
|
+
# Mandatory for shipments to Benelux. Max. length is 5 characters (only for
|
|
59
|
+
# Benelux addresses). For Benelux addresses,this field should always be
|
|
60
|
+
# numeric.
|
|
61
|
+
# @return [String]
|
|
62
|
+
attr_accessor :house_nr
|
|
63
|
+
|
|
64
|
+
# House number extension
|
|
65
|
+
# @return [String]
|
|
66
|
+
attr_accessor :house_nr_ext
|
|
67
|
+
|
|
68
|
+
# Last name of person. This field has a dependency with the field
|
|
69
|
+
# CompanyName. One of both fields must be filled mandatory; using both
|
|
70
|
+
# fields is also allowed. Remark: please add FirstName and Name (lastname)
|
|
71
|
+
# of the receiver to improve the parcel tracking experience of your
|
|
72
|
+
# customer.
|
|
73
|
+
# @return [String]
|
|
74
|
+
attr_accessor :name
|
|
75
|
+
|
|
76
|
+
# Region of the address. Mandatory for Non EU destinations where a region is
|
|
77
|
+
# applicable.
|
|
78
|
+
# @return [String]
|
|
79
|
+
attr_accessor :region
|
|
80
|
+
|
|
81
|
+
# This field has a dependency with the field StreetHouseNrExt. One of both
|
|
82
|
+
# fields must be filled mandatory. Using both fields simultaneously is
|
|
83
|
+
# discouraged.
|
|
84
|
+
# @return [String]
|
|
85
|
+
attr_accessor :street
|
|
86
|
+
|
|
87
|
+
# Combination of Street, HouseNr and HouseNrExt. Please see
|
|
88
|
+
# [Guidelines](https://developer.postnl.nl/docs/#/http/api-endpoints/send-tr
|
|
89
|
+
# ack/confirming/guidelines) for the explanation.
|
|
90
|
+
# @return [String]
|
|
91
|
+
attr_accessor :street_house_nr_ext
|
|
92
|
+
|
|
93
|
+
# Zipcode of the address. Mandatory for shipments to Benelux. Max length
|
|
94
|
+
# (NL) 6 characters,(BE;LU) 4 numeric characters
|
|
95
|
+
# @return [String]
|
|
96
|
+
attr_accessor :zipcode
|
|
97
|
+
|
|
98
|
+
# A mapping from model property names to API property names.
|
|
99
|
+
def self.names
|
|
100
|
+
@_hash = {} if @_hash.nil?
|
|
101
|
+
@_hash['address_type'] = 'AddressType'
|
|
102
|
+
@_hash['area'] = 'Area'
|
|
103
|
+
@_hash['buildingname'] = 'Buildingname'
|
|
104
|
+
@_hash['city'] = 'City'
|
|
105
|
+
@_hash['company_name'] = 'CompanyName'
|
|
106
|
+
@_hash['countrycode'] = 'Countrycode'
|
|
107
|
+
@_hash['department'] = 'Department'
|
|
108
|
+
@_hash['doorcode'] = 'Doorcode'
|
|
109
|
+
@_hash['first_name'] = 'FirstName'
|
|
110
|
+
@_hash['floor'] = 'Floor'
|
|
111
|
+
@_hash['house_nr'] = 'HouseNr'
|
|
112
|
+
@_hash['house_nr_ext'] = 'HouseNrExt'
|
|
113
|
+
@_hash['name'] = 'Name'
|
|
114
|
+
@_hash['region'] = 'Region'
|
|
115
|
+
@_hash['street'] = 'Street'
|
|
116
|
+
@_hash['street_house_nr_ext'] = 'StreetHouseNrExt'
|
|
117
|
+
@_hash['zipcode'] = 'Zipcode'
|
|
118
|
+
@_hash
|
|
119
|
+
end
|
|
120
|
+
|
|
121
|
+
# An array for optional fields
|
|
122
|
+
def self.optionals
|
|
123
|
+
%w[
|
|
124
|
+
area
|
|
125
|
+
buildingname
|
|
126
|
+
city
|
|
127
|
+
company_name
|
|
128
|
+
department
|
|
129
|
+
doorcode
|
|
130
|
+
first_name
|
|
131
|
+
floor
|
|
132
|
+
house_nr
|
|
133
|
+
house_nr_ext
|
|
134
|
+
name
|
|
135
|
+
region
|
|
136
|
+
street
|
|
137
|
+
street_house_nr_ext
|
|
138
|
+
zipcode
|
|
139
|
+
]
|
|
140
|
+
end
|
|
141
|
+
|
|
142
|
+
# An array for nullable fields
|
|
143
|
+
def self.nullables
|
|
144
|
+
[]
|
|
145
|
+
end
|
|
146
|
+
|
|
147
|
+
def initialize(address_type = '01', countrycode = nil, area = SKIP,
|
|
148
|
+
buildingname = SKIP, city = SKIP, company_name = SKIP,
|
|
149
|
+
department = SKIP, doorcode = SKIP, first_name = SKIP,
|
|
150
|
+
floor = SKIP, house_nr = SKIP, house_nr_ext = SKIP,
|
|
151
|
+
name = SKIP, region = SKIP, street = SKIP,
|
|
152
|
+
street_house_nr_ext = SKIP, zipcode = SKIP)
|
|
153
|
+
@address_type = address_type
|
|
154
|
+
@area = area unless area == SKIP
|
|
155
|
+
@buildingname = buildingname unless buildingname == SKIP
|
|
156
|
+
@city = city unless city == SKIP
|
|
157
|
+
@company_name = company_name unless company_name == SKIP
|
|
158
|
+
@countrycode = countrycode
|
|
159
|
+
@department = department unless department == SKIP
|
|
160
|
+
@doorcode = doorcode unless doorcode == SKIP
|
|
161
|
+
@first_name = first_name unless first_name == SKIP
|
|
162
|
+
@floor = floor unless floor == SKIP
|
|
163
|
+
@house_nr = house_nr unless house_nr == SKIP
|
|
164
|
+
@house_nr_ext = house_nr_ext unless house_nr_ext == SKIP
|
|
165
|
+
@name = name unless name == SKIP
|
|
166
|
+
@region = region unless region == SKIP
|
|
167
|
+
@street = street unless street == SKIP
|
|
168
|
+
@street_house_nr_ext = street_house_nr_ext unless street_house_nr_ext == SKIP
|
|
169
|
+
@zipcode = zipcode unless zipcode == SKIP
|
|
170
|
+
end
|
|
171
|
+
|
|
172
|
+
# Creates an instance of the object from a hash.
|
|
173
|
+
def self.from_hash(hash)
|
|
174
|
+
return nil unless hash
|
|
175
|
+
|
|
176
|
+
# Extract variables from the hash.
|
|
177
|
+
address_type = hash['AddressType'] ||= '01'
|
|
178
|
+
countrycode = hash.key?('Countrycode') ? hash['Countrycode'] : nil
|
|
179
|
+
area = hash.key?('Area') ? hash['Area'] : SKIP
|
|
180
|
+
buildingname = hash.key?('Buildingname') ? hash['Buildingname'] : SKIP
|
|
181
|
+
city = hash.key?('City') ? hash['City'] : SKIP
|
|
182
|
+
company_name = hash.key?('CompanyName') ? hash['CompanyName'] : SKIP
|
|
183
|
+
department = hash.key?('Department') ? hash['Department'] : SKIP
|
|
184
|
+
doorcode = hash.key?('Doorcode') ? hash['Doorcode'] : SKIP
|
|
185
|
+
first_name = hash.key?('FirstName') ? hash['FirstName'] : SKIP
|
|
186
|
+
floor = hash.key?('Floor') ? hash['Floor'] : SKIP
|
|
187
|
+
house_nr = hash.key?('HouseNr') ? hash['HouseNr'] : SKIP
|
|
188
|
+
house_nr_ext = hash.key?('HouseNrExt') ? hash['HouseNrExt'] : SKIP
|
|
189
|
+
name = hash.key?('Name') ? hash['Name'] : SKIP
|
|
190
|
+
region = hash.key?('Region') ? hash['Region'] : SKIP
|
|
191
|
+
street = hash.key?('Street') ? hash['Street'] : SKIP
|
|
192
|
+
street_house_nr_ext =
|
|
193
|
+
hash.key?('StreetHouseNrExt') ? hash['StreetHouseNrExt'] : SKIP
|
|
194
|
+
zipcode = hash.key?('Zipcode') ? hash['Zipcode'] : SKIP
|
|
195
|
+
|
|
196
|
+
# Create object from extracted values.
|
|
197
|
+
Address.new(address_type,
|
|
198
|
+
countrycode,
|
|
199
|
+
area,
|
|
200
|
+
buildingname,
|
|
201
|
+
city,
|
|
202
|
+
company_name,
|
|
203
|
+
department,
|
|
204
|
+
doorcode,
|
|
205
|
+
first_name,
|
|
206
|
+
floor,
|
|
207
|
+
house_nr,
|
|
208
|
+
house_nr_ext,
|
|
209
|
+
name,
|
|
210
|
+
region,
|
|
211
|
+
street,
|
|
212
|
+
street_house_nr_ext,
|
|
213
|
+
zipcode)
|
|
214
|
+
end
|
|
215
|
+
|
|
216
|
+
# Provides a human-readable string representation of the object.
|
|
217
|
+
def to_s
|
|
218
|
+
class_name = self.class.name.split('::').last
|
|
219
|
+
"<#{class_name} address_type: #{@address_type}, area: #{@area}, buildingname:"\
|
|
220
|
+
" #{@buildingname}, city: #{@city}, company_name: #{@company_name}, countrycode:"\
|
|
221
|
+
" #{@countrycode}, department: #{@department}, doorcode: #{@doorcode}, first_name:"\
|
|
222
|
+
" #{@first_name}, floor: #{@floor}, house_nr: #{@house_nr}, house_nr_ext: #{@house_nr_ext},"\
|
|
223
|
+
" name: #{@name}, region: #{@region}, street: #{@street}, street_house_nr_ext:"\
|
|
224
|
+
" #{@street_house_nr_ext}, zipcode: #{@zipcode}>"
|
|
225
|
+
end
|
|
226
|
+
|
|
227
|
+
# Provides a debugging-friendly string with detailed object information.
|
|
228
|
+
def inspect
|
|
229
|
+
class_name = self.class.name.split('::').last
|
|
230
|
+
"<#{class_name} address_type: #{@address_type.inspect}, area: #{@area.inspect},"\
|
|
231
|
+
" buildingname: #{@buildingname.inspect}, city: #{@city.inspect}, company_name:"\
|
|
232
|
+
" #{@company_name.inspect}, countrycode: #{@countrycode.inspect}, department:"\
|
|
233
|
+
" #{@department.inspect}, doorcode: #{@doorcode.inspect}, first_name:"\
|
|
234
|
+
" #{@first_name.inspect}, floor: #{@floor.inspect}, house_nr: #{@house_nr.inspect},"\
|
|
235
|
+
" house_nr_ext: #{@house_nr_ext.inspect}, name: #{@name.inspect}, region:"\
|
|
236
|
+
" #{@region.inspect}, street: #{@street.inspect}, street_house_nr_ext:"\
|
|
237
|
+
" #{@street_house_nr_ext.inspect}, zipcode: #{@zipcode.inspect}>"
|
|
238
|
+
end
|
|
239
|
+
end
|
|
240
|
+
end
|
|
@@ -0,0 +1,36 @@
|
|
|
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
|
+
# Address type. 01 is for the receiver address, 02 is for the sender address.
|
|
8
|
+
class AddressTypeEnum
|
|
9
|
+
ADDRESS_TYPE_ENUM = [
|
|
10
|
+
# TODO: Write general description for ENUM_01
|
|
11
|
+
ENUM_01 = '01'.freeze,
|
|
12
|
+
|
|
13
|
+
# TODO: Write general description for ENUM_02
|
|
14
|
+
ENUM_02 = '02'.freeze
|
|
15
|
+
].freeze
|
|
16
|
+
|
|
17
|
+
def self.validate(value)
|
|
18
|
+
return false if value.nil?
|
|
19
|
+
|
|
20
|
+
ADDRESS_TYPE_ENUM.include?(value)
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
def self.from_value(value, default_value = ENUM_01)
|
|
24
|
+
return default_value if value.nil?
|
|
25
|
+
|
|
26
|
+
str = value.to_s.strip
|
|
27
|
+
|
|
28
|
+
case str.downcase
|
|
29
|
+
when 'enum_01' then ENUM_01
|
|
30
|
+
when 'enum_02' then ENUM_02
|
|
31
|
+
else
|
|
32
|
+
default_value
|
|
33
|
+
end
|
|
34
|
+
end
|
|
35
|
+
end
|
|
36
|
+
end
|
|
@@ -0,0 +1,138 @@
|
|
|
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
|
+
# Amount Model.
|
|
8
|
+
class Amount < BaseModel
|
|
9
|
+
SKIP = Object.new
|
|
10
|
+
private_constant :SKIP
|
|
11
|
+
|
|
12
|
+
# Amount type. Please see [Amount
|
|
13
|
+
# types](https://developer.postnl.nl/docs/#/http/reference-data/reference-co
|
|
14
|
+
# des/amount-types) for the available types.
|
|
15
|
+
# @return [String]
|
|
16
|
+
attr_accessor :amount_type
|
|
17
|
+
|
|
18
|
+
# Name of bank account owner
|
|
19
|
+
# @return [String]
|
|
20
|
+
attr_accessor :account_name
|
|
21
|
+
|
|
22
|
+
# BIC number,optional for COD shipments (mandatory for bank account number
|
|
23
|
+
# other than originating in The Netherlands)
|
|
24
|
+
# @return [String]
|
|
25
|
+
attr_accessor :bic
|
|
26
|
+
|
|
27
|
+
# Currency code. only EUR, GBP, USD and CNY are allowed.
|
|
28
|
+
# @return [String]
|
|
29
|
+
attr_accessor :currency
|
|
30
|
+
|
|
31
|
+
# IBAN bank account number,mandatory for COD shipments. Dutch IBAN numbers
|
|
32
|
+
# are 18 characters
|
|
33
|
+
# @return [String]
|
|
34
|
+
attr_accessor :iban
|
|
35
|
+
|
|
36
|
+
# Personal payment reference
|
|
37
|
+
# @return [String]
|
|
38
|
+
attr_accessor :reference
|
|
39
|
+
|
|
40
|
+
# Transaction number
|
|
41
|
+
# @return [String]
|
|
42
|
+
attr_accessor :transaction_number
|
|
43
|
+
|
|
44
|
+
# Money value in EUR (unless value Currency is specified for another
|
|
45
|
+
# currency). Value format (N6.2): #####0.00 (2 digits behind decimal dot).
|
|
46
|
+
# Mandatory for COD, Insured products (with the exception of certain
|
|
47
|
+
# productcodes with a standard insured amount).
|
|
48
|
+
# @return [Float]
|
|
49
|
+
attr_accessor :value
|
|
50
|
+
|
|
51
|
+
# A mapping from model property names to API property names.
|
|
52
|
+
def self.names
|
|
53
|
+
@_hash = {} if @_hash.nil?
|
|
54
|
+
@_hash['amount_type'] = 'AmountType'
|
|
55
|
+
@_hash['account_name'] = 'AccountName'
|
|
56
|
+
@_hash['bic'] = 'BIC'
|
|
57
|
+
@_hash['currency'] = 'Currency'
|
|
58
|
+
@_hash['iban'] = 'IBAN'
|
|
59
|
+
@_hash['reference'] = 'Reference'
|
|
60
|
+
@_hash['transaction_number'] = 'TransactionNumber'
|
|
61
|
+
@_hash['value'] = 'Value'
|
|
62
|
+
@_hash
|
|
63
|
+
end
|
|
64
|
+
|
|
65
|
+
# An array for optional fields
|
|
66
|
+
def self.optionals
|
|
67
|
+
%w[
|
|
68
|
+
account_name
|
|
69
|
+
bic
|
|
70
|
+
currency
|
|
71
|
+
iban
|
|
72
|
+
reference
|
|
73
|
+
transaction_number
|
|
74
|
+
]
|
|
75
|
+
end
|
|
76
|
+
|
|
77
|
+
# An array for nullable fields
|
|
78
|
+
def self.nullables
|
|
79
|
+
[]
|
|
80
|
+
end
|
|
81
|
+
|
|
82
|
+
def initialize(amount_type = nil, value = nil, account_name = SKIP,
|
|
83
|
+
bic = SKIP, currency = SKIP, iban = SKIP, reference = SKIP,
|
|
84
|
+
transaction_number = SKIP)
|
|
85
|
+
@amount_type = amount_type
|
|
86
|
+
@account_name = account_name unless account_name == SKIP
|
|
87
|
+
@bic = bic unless bic == SKIP
|
|
88
|
+
@currency = currency unless currency == SKIP
|
|
89
|
+
@iban = iban unless iban == SKIP
|
|
90
|
+
@reference = reference unless reference == SKIP
|
|
91
|
+
@transaction_number = transaction_number unless transaction_number == SKIP
|
|
92
|
+
@value = value
|
|
93
|
+
end
|
|
94
|
+
|
|
95
|
+
# Creates an instance of the object from a hash.
|
|
96
|
+
def self.from_hash(hash)
|
|
97
|
+
return nil unless hash
|
|
98
|
+
|
|
99
|
+
# Extract variables from the hash.
|
|
100
|
+
amount_type = hash.key?('AmountType') ? hash['AmountType'] : nil
|
|
101
|
+
value = hash.key?('Value') ? hash['Value'] : nil
|
|
102
|
+
account_name = hash.key?('AccountName') ? hash['AccountName'] : SKIP
|
|
103
|
+
bic = hash.key?('BIC') ? hash['BIC'] : SKIP
|
|
104
|
+
currency = hash.key?('Currency') ? hash['Currency'] : SKIP
|
|
105
|
+
iban = hash.key?('IBAN') ? hash['IBAN'] : SKIP
|
|
106
|
+
reference = hash.key?('Reference') ? hash['Reference'] : SKIP
|
|
107
|
+
transaction_number =
|
|
108
|
+
hash.key?('TransactionNumber') ? hash['TransactionNumber'] : SKIP
|
|
109
|
+
|
|
110
|
+
# Create object from extracted values.
|
|
111
|
+
Amount.new(amount_type,
|
|
112
|
+
value,
|
|
113
|
+
account_name,
|
|
114
|
+
bic,
|
|
115
|
+
currency,
|
|
116
|
+
iban,
|
|
117
|
+
reference,
|
|
118
|
+
transaction_number)
|
|
119
|
+
end
|
|
120
|
+
|
|
121
|
+
# Provides a human-readable string representation of the object.
|
|
122
|
+
def to_s
|
|
123
|
+
class_name = self.class.name.split('::').last
|
|
124
|
+
"<#{class_name} amount_type: #{@amount_type}, account_name: #{@account_name}, bic: #{@bic},"\
|
|
125
|
+
" currency: #{@currency}, iban: #{@iban}, reference: #{@reference}, transaction_number:"\
|
|
126
|
+
" #{@transaction_number}, value: #{@value}>"
|
|
127
|
+
end
|
|
128
|
+
|
|
129
|
+
# Provides a debugging-friendly string with detailed object information.
|
|
130
|
+
def inspect
|
|
131
|
+
class_name = self.class.name.split('::').last
|
|
132
|
+
"<#{class_name} amount_type: #{@amount_type.inspect}, account_name:"\
|
|
133
|
+
" #{@account_name.inspect}, bic: #{@bic.inspect}, currency: #{@currency.inspect}, iban:"\
|
|
134
|
+
" #{@iban.inspect}, reference: #{@reference.inspect}, transaction_number:"\
|
|
135
|
+
" #{@transaction_number.inspect}, value: #{@value.inspect}>"
|
|
136
|
+
end
|
|
137
|
+
end
|
|
138
|
+
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
|
+
# BarcodeError Model.
|
|
8
|
+
class BarcodeError < BaseModel
|
|
9
|
+
SKIP = Object.new
|
|
10
|
+
private_constant :SKIP
|
|
11
|
+
|
|
12
|
+
# The error message
|
|
13
|
+
# @return [String]
|
|
14
|
+
attr_accessor :error_msg
|
|
15
|
+
|
|
16
|
+
# The error code
|
|
17
|
+
# @return [String]
|
|
18
|
+
attr_accessor :error_number
|
|
19
|
+
|
|
20
|
+
# A mapping from model property names to API property names.
|
|
21
|
+
def self.names
|
|
22
|
+
@_hash = {} if @_hash.nil?
|
|
23
|
+
@_hash['error_msg'] = 'ErrorMsg'
|
|
24
|
+
@_hash['error_number'] = 'ErrorNumber'
|
|
25
|
+
@_hash
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
# An array for optional fields
|
|
29
|
+
def self.optionals
|
|
30
|
+
%w[
|
|
31
|
+
error_msg
|
|
32
|
+
error_number
|
|
33
|
+
]
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
# An array for nullable fields
|
|
37
|
+
def self.nullables
|
|
38
|
+
[]
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
def initialize(error_msg = SKIP, error_number = SKIP)
|
|
42
|
+
@error_msg = error_msg unless error_msg == SKIP
|
|
43
|
+
@error_number = error_number unless error_number == SKIP
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
# Creates an instance of the object from a hash.
|
|
47
|
+
def self.from_hash(hash)
|
|
48
|
+
return nil unless hash
|
|
49
|
+
|
|
50
|
+
# Extract variables from the hash.
|
|
51
|
+
error_msg = hash.key?('ErrorMsg') ? hash['ErrorMsg'] : SKIP
|
|
52
|
+
error_number = hash.key?('ErrorNumber') ? hash['ErrorNumber'] : SKIP
|
|
53
|
+
|
|
54
|
+
# Create object from extracted values.
|
|
55
|
+
BarcodeError.new(error_msg,
|
|
56
|
+
error_number)
|
|
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} error_msg: #{@error_msg}, error_number: #{@error_number}>"
|
|
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} error_msg: #{@error_msg.inspect}, error_number: #{@error_number.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
|
+
# BarcodeResponse Model.
|
|
8
|
+
class BarcodeResponse < BaseModel
|
|
9
|
+
SKIP = Object.new
|
|
10
|
+
private_constant :SKIP
|
|
11
|
+
|
|
12
|
+
# TODO: Write general description for this method
|
|
13
|
+
# @return [String]
|
|
14
|
+
attr_accessor :barcode
|
|
15
|
+
|
|
16
|
+
# A mapping from model property names to API property names.
|
|
17
|
+
def self.names
|
|
18
|
+
@_hash = {} if @_hash.nil?
|
|
19
|
+
@_hash['barcode'] = 'Barcode'
|
|
20
|
+
@_hash
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
# An array for optional fields
|
|
24
|
+
def self.optionals
|
|
25
|
+
%w[
|
|
26
|
+
barcode
|
|
27
|
+
]
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
# An array for nullable fields
|
|
31
|
+
def self.nullables
|
|
32
|
+
[]
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
def initialize(barcode = SKIP)
|
|
36
|
+
@barcode = barcode unless barcode == 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
|
+
barcode = hash.key?('Barcode') ? hash['Barcode'] : SKIP
|
|
45
|
+
|
|
46
|
+
# Create object from extracted values.
|
|
47
|
+
BarcodeResponse.new(barcode)
|
|
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} barcode: #{@barcode}>"
|
|
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} barcode: #{@barcode.inspect}>"
|
|
60
|
+
end
|
|
61
|
+
end
|
|
62
|
+
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
|
+
# Base model.
|
|
8
|
+
# rubocop:disable all
|
|
9
|
+
class BaseModel < CoreLibrary::BaseModel
|
|
10
|
+
# Returns a Hash representation of the current object.
|
|
11
|
+
def to_hash
|
|
12
|
+
# validating the model being serialized
|
|
13
|
+
self.class.validate(self) if self.class.respond_to?(:validate)
|
|
14
|
+
|
|
15
|
+
hash = {}
|
|
16
|
+
instance_variables.each do |name|
|
|
17
|
+
value = instance_variable_get(name)
|
|
18
|
+
name = name[1..]
|
|
19
|
+
if name == 'additional_properties'
|
|
20
|
+
additional_properties = process_additional_properties(value, self.class.names)
|
|
21
|
+
hash.merge!(additional_properties)
|
|
22
|
+
else
|
|
23
|
+
key = self.class.names.key?(name) ? self.class.names[name] : name
|
|
24
|
+
optional_fields = self.class.optionals
|
|
25
|
+
nullable_fields = self.class.nullables
|
|
26
|
+
if value.nil?
|
|
27
|
+
next unless nullable_fields.include?(name)
|
|
28
|
+
|
|
29
|
+
if !optional_fields.include?(name) && !nullable_fields.include?(name)
|
|
30
|
+
raise ArgumentError,
|
|
31
|
+
"`#{name}` cannot be nil in `#{self.class}`. Please specify a valid value."
|
|
32
|
+
end
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
hash[key] = nil
|
|
36
|
+
unless value.nil?
|
|
37
|
+
if respond_to?("to_custom_#{name}")
|
|
38
|
+
if (value.instance_of? Array) || (value.instance_of? Hash)
|
|
39
|
+
params = [hash, key]
|
|
40
|
+
hash[key] = send("to_custom_#{name}", *params)
|
|
41
|
+
else
|
|
42
|
+
hash[key] = send("to_custom_#{name}")
|
|
43
|
+
end
|
|
44
|
+
elsif respond_to?("to_union_type_#{name}")
|
|
45
|
+
hash[key] = send("to_union_type_#{name}")
|
|
46
|
+
elsif value.instance_of? Array
|
|
47
|
+
hash[key] = value.map { |v| v.is_a?(BaseModel) ? v.to_hash : v }
|
|
48
|
+
elsif value.instance_of? Hash
|
|
49
|
+
hash[key] = {}
|
|
50
|
+
value.each do |k, v|
|
|
51
|
+
hash[key][k] = v.is_a?(BaseModel) ? v.to_hash : v
|
|
52
|
+
end
|
|
53
|
+
else
|
|
54
|
+
hash[key] = value.is_a?(BaseModel) ? value.to_hash : value
|
|
55
|
+
end
|
|
56
|
+
end
|
|
57
|
+
end
|
|
58
|
+
end
|
|
59
|
+
hash
|
|
60
|
+
end
|
|
61
|
+
|
|
62
|
+
# Processes additional properties, ensuring no conflicts with existing properties.
|
|
63
|
+
def process_additional_properties(additional_properties, existing_prop_names)
|
|
64
|
+
hash = {}
|
|
65
|
+
additional_properties.each do |name, value|
|
|
66
|
+
check_for_conflict(name, existing_prop_names)
|
|
67
|
+
|
|
68
|
+
hash[name] = if value.is_a?(Array)
|
|
69
|
+
process_array(value)
|
|
70
|
+
elsif value.is_a?(Hash)
|
|
71
|
+
process_hash(value)
|
|
72
|
+
else
|
|
73
|
+
process_basic_value(value)
|
|
74
|
+
end
|
|
75
|
+
end
|
|
76
|
+
hash
|
|
77
|
+
end
|
|
78
|
+
|
|
79
|
+
# Checks if an additional property conflicts with a model's existing property.
|
|
80
|
+
def check_for_conflict(name, existing_prop_names)
|
|
81
|
+
return unless existing_prop_names.key?(name)
|
|
82
|
+
|
|
83
|
+
raise ArgumentError, "An additional property key, '#{name}' conflicts with one of the model's properties"
|
|
84
|
+
end
|
|
85
|
+
|
|
86
|
+
# Processes an array of values, recursively calling `to_hash` on BaseModel objects.
|
|
87
|
+
def process_array(value)
|
|
88
|
+
value.map { |v| v.is_a?(BaseModel) ? v.to_hash : v }
|
|
89
|
+
end
|
|
90
|
+
|
|
91
|
+
# Processes a hash of values, recursively calling `to_hash` on BaseModel objects.
|
|
92
|
+
def process_hash(value)
|
|
93
|
+
value.transform_values do |v|
|
|
94
|
+
v.is_a?(BaseModel) ? v.to_hash : v
|
|
95
|
+
end
|
|
96
|
+
end
|
|
97
|
+
|
|
98
|
+
# Processes a basic value (non-array, non-hash).
|
|
99
|
+
def process_basic_value(value)
|
|
100
|
+
value.is_a?(BaseModel) ? value.to_hash : value
|
|
101
|
+
end
|
|
102
|
+
|
|
103
|
+
# Returns a JSON representation of the curent object.
|
|
104
|
+
def to_json(options = {})
|
|
105
|
+
hash = to_hash
|
|
106
|
+
hash.to_json(options)
|
|
107
|
+
end
|
|
108
|
+
end
|
|
109
|
+
# rubocop:enable all
|
|
110
|
+
end
|