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,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
|
+
# The current status and old statuses of the shipment
|
|
8
|
+
class CurrentStatus < BaseModel
|
|
9
|
+
SKIP = Object.new
|
|
10
|
+
private_constant :SKIP
|
|
11
|
+
|
|
12
|
+
# TODO: Write general description for this method
|
|
13
|
+
# @return [CurrentStatusShipment]
|
|
14
|
+
attr_accessor :shipment
|
|
15
|
+
|
|
16
|
+
# A mapping from model property names to API property names.
|
|
17
|
+
def self.names
|
|
18
|
+
@_hash = {} if @_hash.nil?
|
|
19
|
+
@_hash['shipment'] = 'Shipment'
|
|
20
|
+
@_hash
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
# An array for optional fields
|
|
24
|
+
def self.optionals
|
|
25
|
+
%w[
|
|
26
|
+
shipment
|
|
27
|
+
]
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
# An array for nullable fields
|
|
31
|
+
def self.nullables
|
|
32
|
+
[]
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
def initialize(shipment = SKIP)
|
|
36
|
+
@shipment = shipment unless shipment == 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
|
+
shipment = CurrentStatusShipment.from_hash(hash['Shipment']) if hash['Shipment']
|
|
45
|
+
|
|
46
|
+
# Create object from extracted values.
|
|
47
|
+
CurrentStatus.new(shipment)
|
|
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} shipment: #{@shipment}>"
|
|
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} shipment: #{@shipment.inspect}>"
|
|
60
|
+
end
|
|
61
|
+
end
|
|
62
|
+
end
|
|
@@ -0,0 +1,207 @@
|
|
|
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
|
+
# CurrentStatusShipment Model.
|
|
8
|
+
class CurrentStatusShipment < BaseModel
|
|
9
|
+
SKIP = Object.new
|
|
10
|
+
private_constant :SKIP
|
|
11
|
+
|
|
12
|
+
# The main barcode of the shipment
|
|
13
|
+
# @return [String]
|
|
14
|
+
attr_accessor :main_barcode
|
|
15
|
+
|
|
16
|
+
# The barcode of the shipment
|
|
17
|
+
# @return [String]
|
|
18
|
+
attr_accessor :barcode
|
|
19
|
+
|
|
20
|
+
# The amount of parcels in the multi-collo shipment
|
|
21
|
+
# @return [String]
|
|
22
|
+
attr_accessor :shipment_amount
|
|
23
|
+
|
|
24
|
+
# The sequence of this parcel in the multi-collo shipment
|
|
25
|
+
# @return [String]
|
|
26
|
+
attr_accessor :shipment_counter
|
|
27
|
+
|
|
28
|
+
# The sequence of this parcel in the multi-collo shipment
|
|
29
|
+
# @return [ShippingstatusCustomer]
|
|
30
|
+
attr_accessor :customer
|
|
31
|
+
|
|
32
|
+
# The product code of the shipment
|
|
33
|
+
# @return [String]
|
|
34
|
+
attr_accessor :product_code
|
|
35
|
+
|
|
36
|
+
# The description of the product code
|
|
37
|
+
# @return [String]
|
|
38
|
+
attr_accessor :product_description
|
|
39
|
+
|
|
40
|
+
# The customer reference belonging to the shipment
|
|
41
|
+
# @return [String]
|
|
42
|
+
attr_accessor :reference
|
|
43
|
+
|
|
44
|
+
# The expected delivery date of the shipment
|
|
45
|
+
# @return [String]
|
|
46
|
+
attr_accessor :delivery_date
|
|
47
|
+
|
|
48
|
+
# The expected delivery date of the shipment
|
|
49
|
+
# @return [ShippingstatusDimension]
|
|
50
|
+
attr_accessor :dimension
|
|
51
|
+
|
|
52
|
+
# A list of addresses belonging to the shipment
|
|
53
|
+
# @return [Array[ShippingstatusAddress]]
|
|
54
|
+
attr_accessor :address
|
|
55
|
+
|
|
56
|
+
# A list of product options.
|
|
57
|
+
# @return [Array[ShippingstatusProductOptions]]
|
|
58
|
+
attr_accessor :product_options
|
|
59
|
+
|
|
60
|
+
# The current status of the shipment (see the [Status
|
|
61
|
+
# codes](https://developer.postnl.nl/docs/#/http/reference-data/t-t-status-c
|
|
62
|
+
# odes/event-codes) for possible values.
|
|
63
|
+
# @return [Status]
|
|
64
|
+
attr_accessor :status
|
|
65
|
+
|
|
66
|
+
# A mapping from model property names to API property names.
|
|
67
|
+
def self.names
|
|
68
|
+
@_hash = {} if @_hash.nil?
|
|
69
|
+
@_hash['main_barcode'] = 'MainBarcode'
|
|
70
|
+
@_hash['barcode'] = 'Barcode'
|
|
71
|
+
@_hash['shipment_amount'] = 'ShipmentAmount'
|
|
72
|
+
@_hash['shipment_counter'] = 'ShipmentCounter'
|
|
73
|
+
@_hash['customer'] = 'Customer'
|
|
74
|
+
@_hash['product_code'] = 'ProductCode'
|
|
75
|
+
@_hash['product_description'] = 'ProductDescription'
|
|
76
|
+
@_hash['reference'] = 'Reference'
|
|
77
|
+
@_hash['delivery_date'] = 'DeliveryDate'
|
|
78
|
+
@_hash['dimension'] = 'Dimension'
|
|
79
|
+
@_hash['address'] = 'Address'
|
|
80
|
+
@_hash['product_options'] = 'ProductOptions'
|
|
81
|
+
@_hash['status'] = 'Status'
|
|
82
|
+
@_hash
|
|
83
|
+
end
|
|
84
|
+
|
|
85
|
+
# An array for optional fields
|
|
86
|
+
def self.optionals
|
|
87
|
+
%w[
|
|
88
|
+
main_barcode
|
|
89
|
+
barcode
|
|
90
|
+
shipment_amount
|
|
91
|
+
shipment_counter
|
|
92
|
+
customer
|
|
93
|
+
product_code
|
|
94
|
+
product_description
|
|
95
|
+
reference
|
|
96
|
+
delivery_date
|
|
97
|
+
dimension
|
|
98
|
+
address
|
|
99
|
+
product_options
|
|
100
|
+
status
|
|
101
|
+
]
|
|
102
|
+
end
|
|
103
|
+
|
|
104
|
+
# An array for nullable fields
|
|
105
|
+
def self.nullables
|
|
106
|
+
[]
|
|
107
|
+
end
|
|
108
|
+
|
|
109
|
+
def initialize(main_barcode = SKIP, barcode = SKIP, shipment_amount = SKIP,
|
|
110
|
+
shipment_counter = SKIP, customer = SKIP,
|
|
111
|
+
product_code = SKIP, product_description = SKIP,
|
|
112
|
+
reference = SKIP, delivery_date = SKIP, dimension = SKIP,
|
|
113
|
+
address = SKIP, product_options = SKIP, status = SKIP)
|
|
114
|
+
@main_barcode = main_barcode unless main_barcode == SKIP
|
|
115
|
+
@barcode = barcode unless barcode == SKIP
|
|
116
|
+
@shipment_amount = shipment_amount unless shipment_amount == SKIP
|
|
117
|
+
@shipment_counter = shipment_counter unless shipment_counter == SKIP
|
|
118
|
+
@customer = customer unless customer == SKIP
|
|
119
|
+
@product_code = product_code unless product_code == SKIP
|
|
120
|
+
@product_description = product_description unless product_description == SKIP
|
|
121
|
+
@reference = reference unless reference == SKIP
|
|
122
|
+
@delivery_date = delivery_date unless delivery_date == SKIP
|
|
123
|
+
@dimension = dimension unless dimension == SKIP
|
|
124
|
+
@address = address unless address == SKIP
|
|
125
|
+
@product_options = product_options unless product_options == SKIP
|
|
126
|
+
@status = status unless status == SKIP
|
|
127
|
+
end
|
|
128
|
+
|
|
129
|
+
# Creates an instance of the object from a hash.
|
|
130
|
+
def self.from_hash(hash)
|
|
131
|
+
return nil unless hash
|
|
132
|
+
|
|
133
|
+
# Extract variables from the hash.
|
|
134
|
+
main_barcode = hash.key?('MainBarcode') ? hash['MainBarcode'] : SKIP
|
|
135
|
+
barcode = hash.key?('Barcode') ? hash['Barcode'] : SKIP
|
|
136
|
+
shipment_amount =
|
|
137
|
+
hash.key?('ShipmentAmount') ? hash['ShipmentAmount'] : SKIP
|
|
138
|
+
shipment_counter =
|
|
139
|
+
hash.key?('ShipmentCounter') ? hash['ShipmentCounter'] : SKIP
|
|
140
|
+
customer = ShippingstatusCustomer.from_hash(hash['Customer']) if hash['Customer']
|
|
141
|
+
product_code = hash.key?('ProductCode') ? hash['ProductCode'] : SKIP
|
|
142
|
+
product_description =
|
|
143
|
+
hash.key?('ProductDescription') ? hash['ProductDescription'] : SKIP
|
|
144
|
+
reference = hash.key?('Reference') ? hash['Reference'] : SKIP
|
|
145
|
+
delivery_date = hash.key?('DeliveryDate') ? hash['DeliveryDate'] : SKIP
|
|
146
|
+
dimension = ShippingstatusDimension.from_hash(hash['Dimension']) if hash['Dimension']
|
|
147
|
+
# Parameter is an array, so we need to iterate through it
|
|
148
|
+
address = nil
|
|
149
|
+
unless hash['Address'].nil?
|
|
150
|
+
address = []
|
|
151
|
+
hash['Address'].each do |structure|
|
|
152
|
+
address << (ShippingstatusAddress.from_hash(structure) if structure)
|
|
153
|
+
end
|
|
154
|
+
end
|
|
155
|
+
|
|
156
|
+
address = SKIP unless hash.key?('Address')
|
|
157
|
+
# Parameter is an array, so we need to iterate through it
|
|
158
|
+
product_options = nil
|
|
159
|
+
unless hash['ProductOptions'].nil?
|
|
160
|
+
product_options = []
|
|
161
|
+
hash['ProductOptions'].each do |structure|
|
|
162
|
+
product_options << (ShippingstatusProductOptions.from_hash(structure) if structure)
|
|
163
|
+
end
|
|
164
|
+
end
|
|
165
|
+
|
|
166
|
+
product_options = SKIP unless hash.key?('ProductOptions')
|
|
167
|
+
status = Status.from_hash(hash['Status']) if hash['Status']
|
|
168
|
+
|
|
169
|
+
# Create object from extracted values.
|
|
170
|
+
CurrentStatusShipment.new(main_barcode,
|
|
171
|
+
barcode,
|
|
172
|
+
shipment_amount,
|
|
173
|
+
shipment_counter,
|
|
174
|
+
customer,
|
|
175
|
+
product_code,
|
|
176
|
+
product_description,
|
|
177
|
+
reference,
|
|
178
|
+
delivery_date,
|
|
179
|
+
dimension,
|
|
180
|
+
address,
|
|
181
|
+
product_options,
|
|
182
|
+
status)
|
|
183
|
+
end
|
|
184
|
+
|
|
185
|
+
# Provides a human-readable string representation of the object.
|
|
186
|
+
def to_s
|
|
187
|
+
class_name = self.class.name.split('::').last
|
|
188
|
+
"<#{class_name} main_barcode: #{@main_barcode}, barcode: #{@barcode}, shipment_amount:"\
|
|
189
|
+
" #{@shipment_amount}, shipment_counter: #{@shipment_counter}, customer: #{@customer},"\
|
|
190
|
+
" product_code: #{@product_code}, product_description: #{@product_description}, reference:"\
|
|
191
|
+
" #{@reference}, delivery_date: #{@delivery_date}, dimension: #{@dimension}, address:"\
|
|
192
|
+
" #{@address}, product_options: #{@product_options}, status: #{@status}>"
|
|
193
|
+
end
|
|
194
|
+
|
|
195
|
+
# Provides a debugging-friendly string with detailed object information.
|
|
196
|
+
def inspect
|
|
197
|
+
class_name = self.class.name.split('::').last
|
|
198
|
+
"<#{class_name} main_barcode: #{@main_barcode.inspect}, barcode: #{@barcode.inspect},"\
|
|
199
|
+
" shipment_amount: #{@shipment_amount.inspect}, shipment_counter:"\
|
|
200
|
+
" #{@shipment_counter.inspect}, customer: #{@customer.inspect}, product_code:"\
|
|
201
|
+
" #{@product_code.inspect}, product_description: #{@product_description.inspect}, reference:"\
|
|
202
|
+
" #{@reference.inspect}, delivery_date: #{@delivery_date.inspect}, dimension:"\
|
|
203
|
+
" #{@dimension.inspect}, address: #{@address.inspect}, product_options:"\
|
|
204
|
+
" #{@product_options.inspect}, status: #{@status.inspect}>"
|
|
205
|
+
end
|
|
206
|
+
end
|
|
207
|
+
end
|
|
@@ -0,0 +1,123 @@
|
|
|
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
|
+
# Customer Model.
|
|
8
|
+
class Customer < BaseModel
|
|
9
|
+
SKIP = Object.new
|
|
10
|
+
private_constant :SKIP
|
|
11
|
+
|
|
12
|
+
# TODO: Write general description for this method
|
|
13
|
+
# @return [CustomerAddress]
|
|
14
|
+
attr_accessor :address
|
|
15
|
+
|
|
16
|
+
# Code of delivery location at PostNL Pakketten
|
|
17
|
+
# @return [String]
|
|
18
|
+
attr_accessor :collection_location
|
|
19
|
+
|
|
20
|
+
# Name of customer contact person
|
|
21
|
+
# @return [String]
|
|
22
|
+
attr_accessor :contact_person
|
|
23
|
+
|
|
24
|
+
# Customer code as known at PostNL Pakketten
|
|
25
|
+
# @return [String]
|
|
26
|
+
attr_accessor :customer_code
|
|
27
|
+
|
|
28
|
+
# Name of customer contact person
|
|
29
|
+
# @return [String]
|
|
30
|
+
attr_accessor :customer_number
|
|
31
|
+
|
|
32
|
+
# E-mail address of the customer. Mandatory for Non EU destinations.
|
|
33
|
+
# @return [String]
|
|
34
|
+
attr_accessor :email
|
|
35
|
+
|
|
36
|
+
# Customer name
|
|
37
|
+
# @return [String]
|
|
38
|
+
attr_accessor :name
|
|
39
|
+
|
|
40
|
+
# A mapping from model property names to API property names.
|
|
41
|
+
def self.names
|
|
42
|
+
@_hash = {} if @_hash.nil?
|
|
43
|
+
@_hash['address'] = 'Address'
|
|
44
|
+
@_hash['collection_location'] = 'CollectionLocation'
|
|
45
|
+
@_hash['contact_person'] = 'ContactPerson'
|
|
46
|
+
@_hash['customer_code'] = 'CustomerCode'
|
|
47
|
+
@_hash['customer_number'] = 'CustomerNumber'
|
|
48
|
+
@_hash['email'] = 'Email'
|
|
49
|
+
@_hash['name'] = 'Name'
|
|
50
|
+
@_hash
|
|
51
|
+
end
|
|
52
|
+
|
|
53
|
+
# An array for optional fields
|
|
54
|
+
def self.optionals
|
|
55
|
+
%w[
|
|
56
|
+
address
|
|
57
|
+
collection_location
|
|
58
|
+
contact_person
|
|
59
|
+
email
|
|
60
|
+
name
|
|
61
|
+
]
|
|
62
|
+
end
|
|
63
|
+
|
|
64
|
+
# An array for nullable fields
|
|
65
|
+
def self.nullables
|
|
66
|
+
[]
|
|
67
|
+
end
|
|
68
|
+
|
|
69
|
+
def initialize(customer_code = nil, customer_number = nil, address = SKIP,
|
|
70
|
+
collection_location = SKIP, contact_person = SKIP,
|
|
71
|
+
email = SKIP, name = SKIP)
|
|
72
|
+
@address = address unless address == SKIP
|
|
73
|
+
@collection_location = collection_location unless collection_location == SKIP
|
|
74
|
+
@contact_person = contact_person unless contact_person == SKIP
|
|
75
|
+
@customer_code = customer_code
|
|
76
|
+
@customer_number = customer_number
|
|
77
|
+
@email = email unless email == SKIP
|
|
78
|
+
@name = name unless name == SKIP
|
|
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
|
+
customer_code = hash.key?('CustomerCode') ? hash['CustomerCode'] : nil
|
|
87
|
+
customer_number =
|
|
88
|
+
hash.key?('CustomerNumber') ? hash['CustomerNumber'] : nil
|
|
89
|
+
address = CustomerAddress.from_hash(hash['Address']) if hash['Address']
|
|
90
|
+
collection_location =
|
|
91
|
+
hash.key?('CollectionLocation') ? hash['CollectionLocation'] : SKIP
|
|
92
|
+
contact_person = hash.key?('ContactPerson') ? hash['ContactPerson'] : SKIP
|
|
93
|
+
email = hash.key?('Email') ? hash['Email'] : SKIP
|
|
94
|
+
name = hash.key?('Name') ? hash['Name'] : SKIP
|
|
95
|
+
|
|
96
|
+
# Create object from extracted values.
|
|
97
|
+
Customer.new(customer_code,
|
|
98
|
+
customer_number,
|
|
99
|
+
address,
|
|
100
|
+
collection_location,
|
|
101
|
+
contact_person,
|
|
102
|
+
email,
|
|
103
|
+
name)
|
|
104
|
+
end
|
|
105
|
+
|
|
106
|
+
# Provides a human-readable string representation of the object.
|
|
107
|
+
def to_s
|
|
108
|
+
class_name = self.class.name.split('::').last
|
|
109
|
+
"<#{class_name} address: #{@address}, collection_location: #{@collection_location},"\
|
|
110
|
+
" contact_person: #{@contact_person}, customer_code: #{@customer_code}, customer_number:"\
|
|
111
|
+
" #{@customer_number}, email: #{@email}, name: #{@name}>"
|
|
112
|
+
end
|
|
113
|
+
|
|
114
|
+
# Provides a debugging-friendly string with detailed object information.
|
|
115
|
+
def inspect
|
|
116
|
+
class_name = self.class.name.split('::').last
|
|
117
|
+
"<#{class_name} address: #{@address.inspect}, collection_location:"\
|
|
118
|
+
" #{@collection_location.inspect}, contact_person: #{@contact_person.inspect},"\
|
|
119
|
+
" customer_code: #{@customer_code.inspect}, customer_number: #{@customer_number.inspect},"\
|
|
120
|
+
" email: #{@email.inspect}, name: #{@name.inspect}>"
|
|
121
|
+
end
|
|
122
|
+
end
|
|
123
|
+
end
|
|
@@ -0,0 +1,237 @@
|
|
|
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
|
+
# CustomerAddress Model.
|
|
8
|
+
class CustomerAddress < BaseModel
|
|
9
|
+
SKIP = Object.new
|
|
10
|
+
private_constant :SKIP
|
|
11
|
+
|
|
12
|
+
# Address 02 is mandatory. It can either be placed in the Customer segment
|
|
13
|
+
# or in the Shipment segment. Note that if you put it in the Shipment
|
|
14
|
+
# segment, it should go into all Shipment segments.
|
|
15
|
+
# @return [String]
|
|
16
|
+
attr_accessor :address_type
|
|
17
|
+
|
|
18
|
+
# Area of the address
|
|
19
|
+
# @return [String]
|
|
20
|
+
attr_accessor :area
|
|
21
|
+
|
|
22
|
+
# Building name of the address
|
|
23
|
+
# @return [String]
|
|
24
|
+
attr_accessor :buildingname
|
|
25
|
+
|
|
26
|
+
# City of the address
|
|
27
|
+
# @return [String]
|
|
28
|
+
attr_accessor :city
|
|
29
|
+
|
|
30
|
+
# This field has a dependency with the field Name. One of both fields must
|
|
31
|
+
# be filled mandatory; using both fields is also allowed. Mandatory when
|
|
32
|
+
# AddressType is 09.
|
|
33
|
+
# @return [String]
|
|
34
|
+
attr_accessor :company_name
|
|
35
|
+
|
|
36
|
+
# The ISO2 country codes
|
|
37
|
+
# @return [String]
|
|
38
|
+
attr_accessor :countrycode
|
|
39
|
+
|
|
40
|
+
# Send to specific department of a company
|
|
41
|
+
# @return [String]
|
|
42
|
+
attr_accessor :department
|
|
43
|
+
|
|
44
|
+
# Door code of address. Mandatory for some international shipments.
|
|
45
|
+
# @return [String]
|
|
46
|
+
attr_accessor :doorcode
|
|
47
|
+
|
|
48
|
+
# Remark: please add FirstName and Name (lastname) of the receiver to
|
|
49
|
+
# improve the parcel tracking experience of your customer.
|
|
50
|
+
# @return [String]
|
|
51
|
+
attr_accessor :first_name
|
|
52
|
+
|
|
53
|
+
# Send to specific floor of a company
|
|
54
|
+
# @return [String]
|
|
55
|
+
attr_accessor :floor
|
|
56
|
+
|
|
57
|
+
# Mandatory for shipments to Benelux. Max. length is 5 characters (only for
|
|
58
|
+
# Benelux addresses). For Benelux addresses,this field should always be
|
|
59
|
+
# numeric.
|
|
60
|
+
# @return [String]
|
|
61
|
+
attr_accessor :house_nr
|
|
62
|
+
|
|
63
|
+
# House number extension
|
|
64
|
+
# @return [String]
|
|
65
|
+
attr_accessor :house_nr_ext
|
|
66
|
+
|
|
67
|
+
# Last name of person. This field has a dependency with the field
|
|
68
|
+
# CompanyName. One of both fields must be filled mandatory; using both
|
|
69
|
+
# fields is also allowed. Remark: please add FirstName and Name (lastname)
|
|
70
|
+
# of the receiver to improve the parcel tracking experience of your
|
|
71
|
+
# customer.
|
|
72
|
+
# @return [String]
|
|
73
|
+
attr_accessor :name
|
|
74
|
+
|
|
75
|
+
# Region of the address
|
|
76
|
+
# @return [String]
|
|
77
|
+
attr_accessor :region
|
|
78
|
+
|
|
79
|
+
# This field has a dependency with the field StreetHouseNrExt. One of both
|
|
80
|
+
# fields must be filled mandatory; using both fields simultaneously is
|
|
81
|
+
# discouraged.
|
|
82
|
+
# @return [String]
|
|
83
|
+
attr_accessor :street
|
|
84
|
+
|
|
85
|
+
# Combination of Street, HouseNr and HouseNrExt. Please see
|
|
86
|
+
# [Guidelines](https://developer.postnl.nl/docs/#/http/api-endpoints/send-tr
|
|
87
|
+
# ack/confirming/guidelines) for the explanation.
|
|
88
|
+
# @return [String]
|
|
89
|
+
attr_accessor :street_house_nr_ext
|
|
90
|
+
|
|
91
|
+
# Zipcode of the address. Mandatory for shipments to Benelux. Max length
|
|
92
|
+
# (NL) 6 characters,(BE;LU) 4 numeric characters
|
|
93
|
+
# @return [String]
|
|
94
|
+
attr_accessor :zipcode
|
|
95
|
+
|
|
96
|
+
# A mapping from model property names to API property names.
|
|
97
|
+
def self.names
|
|
98
|
+
@_hash = {} if @_hash.nil?
|
|
99
|
+
@_hash['address_type'] = 'AddressType'
|
|
100
|
+
@_hash['area'] = 'Area'
|
|
101
|
+
@_hash['buildingname'] = 'Buildingname'
|
|
102
|
+
@_hash['city'] = 'City'
|
|
103
|
+
@_hash['company_name'] = 'CompanyName'
|
|
104
|
+
@_hash['countrycode'] = 'Countrycode'
|
|
105
|
+
@_hash['department'] = 'Department'
|
|
106
|
+
@_hash['doorcode'] = 'Doorcode'
|
|
107
|
+
@_hash['first_name'] = 'FirstName'
|
|
108
|
+
@_hash['floor'] = 'Floor'
|
|
109
|
+
@_hash['house_nr'] = 'HouseNr'
|
|
110
|
+
@_hash['house_nr_ext'] = 'HouseNrExt'
|
|
111
|
+
@_hash['name'] = 'Name'
|
|
112
|
+
@_hash['region'] = 'Region'
|
|
113
|
+
@_hash['street'] = 'Street'
|
|
114
|
+
@_hash['street_house_nr_ext'] = 'StreetHouseNrExt'
|
|
115
|
+
@_hash['zipcode'] = 'Zipcode'
|
|
116
|
+
@_hash
|
|
117
|
+
end
|
|
118
|
+
|
|
119
|
+
# An array for optional fields
|
|
120
|
+
def self.optionals
|
|
121
|
+
%w[
|
|
122
|
+
area
|
|
123
|
+
buildingname
|
|
124
|
+
company_name
|
|
125
|
+
department
|
|
126
|
+
doorcode
|
|
127
|
+
first_name
|
|
128
|
+
floor
|
|
129
|
+
house_nr
|
|
130
|
+
house_nr_ext
|
|
131
|
+
name
|
|
132
|
+
region
|
|
133
|
+
street
|
|
134
|
+
street_house_nr_ext
|
|
135
|
+
zipcode
|
|
136
|
+
]
|
|
137
|
+
end
|
|
138
|
+
|
|
139
|
+
# An array for nullable fields
|
|
140
|
+
def self.nullables
|
|
141
|
+
[]
|
|
142
|
+
end
|
|
143
|
+
|
|
144
|
+
def initialize(address_type = nil, city = nil, countrycode = nil,
|
|
145
|
+
area = SKIP, buildingname = SKIP, company_name = SKIP,
|
|
146
|
+
department = SKIP, doorcode = SKIP, first_name = SKIP,
|
|
147
|
+
floor = SKIP, house_nr = SKIP, house_nr_ext = SKIP,
|
|
148
|
+
name = SKIP, region = SKIP, street = SKIP,
|
|
149
|
+
street_house_nr_ext = SKIP, zipcode = SKIP)
|
|
150
|
+
@address_type = address_type
|
|
151
|
+
@area = area unless area == SKIP
|
|
152
|
+
@buildingname = buildingname unless buildingname == SKIP
|
|
153
|
+
@city = city
|
|
154
|
+
@company_name = company_name unless company_name == SKIP
|
|
155
|
+
@countrycode = countrycode
|
|
156
|
+
@department = department unless department == SKIP
|
|
157
|
+
@doorcode = doorcode unless doorcode == SKIP
|
|
158
|
+
@first_name = first_name unless first_name == SKIP
|
|
159
|
+
@floor = floor unless floor == SKIP
|
|
160
|
+
@house_nr = house_nr unless house_nr == SKIP
|
|
161
|
+
@house_nr_ext = house_nr_ext unless house_nr_ext == SKIP
|
|
162
|
+
@name = name unless name == SKIP
|
|
163
|
+
@region = region unless region == SKIP
|
|
164
|
+
@street = street unless street == SKIP
|
|
165
|
+
@street_house_nr_ext = street_house_nr_ext unless street_house_nr_ext == SKIP
|
|
166
|
+
@zipcode = zipcode unless zipcode == SKIP
|
|
167
|
+
end
|
|
168
|
+
|
|
169
|
+
# Creates an instance of the object from a hash.
|
|
170
|
+
def self.from_hash(hash)
|
|
171
|
+
return nil unless hash
|
|
172
|
+
|
|
173
|
+
# Extract variables from the hash.
|
|
174
|
+
address_type = hash.key?('AddressType') ? hash['AddressType'] : nil
|
|
175
|
+
city = hash.key?('City') ? hash['City'] : nil
|
|
176
|
+
countrycode = hash.key?('Countrycode') ? hash['Countrycode'] : nil
|
|
177
|
+
area = hash.key?('Area') ? hash['Area'] : SKIP
|
|
178
|
+
buildingname = hash.key?('Buildingname') ? hash['Buildingname'] : SKIP
|
|
179
|
+
company_name = hash.key?('CompanyName') ? hash['CompanyName'] : SKIP
|
|
180
|
+
department = hash.key?('Department') ? hash['Department'] : SKIP
|
|
181
|
+
doorcode = hash.key?('Doorcode') ? hash['Doorcode'] : SKIP
|
|
182
|
+
first_name = hash.key?('FirstName') ? hash['FirstName'] : SKIP
|
|
183
|
+
floor = hash.key?('Floor') ? hash['Floor'] : SKIP
|
|
184
|
+
house_nr = hash.key?('HouseNr') ? hash['HouseNr'] : SKIP
|
|
185
|
+
house_nr_ext = hash.key?('HouseNrExt') ? hash['HouseNrExt'] : SKIP
|
|
186
|
+
name = hash.key?('Name') ? hash['Name'] : SKIP
|
|
187
|
+
region = hash.key?('Region') ? hash['Region'] : SKIP
|
|
188
|
+
street = hash.key?('Street') ? hash['Street'] : SKIP
|
|
189
|
+
street_house_nr_ext =
|
|
190
|
+
hash.key?('StreetHouseNrExt') ? hash['StreetHouseNrExt'] : SKIP
|
|
191
|
+
zipcode = hash.key?('Zipcode') ? hash['Zipcode'] : SKIP
|
|
192
|
+
|
|
193
|
+
# Create object from extracted values.
|
|
194
|
+
CustomerAddress.new(address_type,
|
|
195
|
+
city,
|
|
196
|
+
countrycode,
|
|
197
|
+
area,
|
|
198
|
+
buildingname,
|
|
199
|
+
company_name,
|
|
200
|
+
department,
|
|
201
|
+
doorcode,
|
|
202
|
+
first_name,
|
|
203
|
+
floor,
|
|
204
|
+
house_nr,
|
|
205
|
+
house_nr_ext,
|
|
206
|
+
name,
|
|
207
|
+
region,
|
|
208
|
+
street,
|
|
209
|
+
street_house_nr_ext,
|
|
210
|
+
zipcode)
|
|
211
|
+
end
|
|
212
|
+
|
|
213
|
+
# Provides a human-readable string representation of the object.
|
|
214
|
+
def to_s
|
|
215
|
+
class_name = self.class.name.split('::').last
|
|
216
|
+
"<#{class_name} address_type: #{@address_type}, area: #{@area}, buildingname:"\
|
|
217
|
+
" #{@buildingname}, city: #{@city}, company_name: #{@company_name}, countrycode:"\
|
|
218
|
+
" #{@countrycode}, department: #{@department}, doorcode: #{@doorcode}, first_name:"\
|
|
219
|
+
" #{@first_name}, floor: #{@floor}, house_nr: #{@house_nr}, house_nr_ext: #{@house_nr_ext},"\
|
|
220
|
+
" name: #{@name}, region: #{@region}, street: #{@street}, street_house_nr_ext:"\
|
|
221
|
+
" #{@street_house_nr_ext}, zipcode: #{@zipcode}>"
|
|
222
|
+
end
|
|
223
|
+
|
|
224
|
+
# Provides a debugging-friendly string with detailed object information.
|
|
225
|
+
def inspect
|
|
226
|
+
class_name = self.class.name.split('::').last
|
|
227
|
+
"<#{class_name} address_type: #{@address_type.inspect}, area: #{@area.inspect},"\
|
|
228
|
+
" buildingname: #{@buildingname.inspect}, city: #{@city.inspect}, company_name:"\
|
|
229
|
+
" #{@company_name.inspect}, countrycode: #{@countrycode.inspect}, department:"\
|
|
230
|
+
" #{@department.inspect}, doorcode: #{@doorcode.inspect}, first_name:"\
|
|
231
|
+
" #{@first_name.inspect}, floor: #{@floor.inspect}, house_nr: #{@house_nr.inspect},"\
|
|
232
|
+
" house_nr_ext: #{@house_nr_ext.inspect}, name: #{@name.inspect}, region:"\
|
|
233
|
+
" #{@region.inspect}, street: #{@street.inspect}, street_house_nr_ext:"\
|
|
234
|
+
" #{@street_house_nr_ext.inspect}, zipcode: #{@zipcode.inspect}>"
|
|
235
|
+
end
|
|
236
|
+
end
|
|
237
|
+
end
|