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,84 @@
|
|
|
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
|
+
# LabellingLabel Model.
|
|
8
|
+
class LabellingLabel < BaseModel
|
|
9
|
+
SKIP = Object.new
|
|
10
|
+
private_constant :SKIP
|
|
11
|
+
|
|
12
|
+
# Base64 encoded label content
|
|
13
|
+
# @return [String]
|
|
14
|
+
attr_accessor :content
|
|
15
|
+
|
|
16
|
+
# Type of the label. See possible [Label
|
|
17
|
+
# types](https://developer.postnl.nl/docs/#/http/reference-data/reference-co
|
|
18
|
+
# des/label-types)
|
|
19
|
+
# @return [String]
|
|
20
|
+
attr_accessor :labeltype
|
|
21
|
+
|
|
22
|
+
# Content type of the label, e.g. zebra of pdf.
|
|
23
|
+
# @return [String]
|
|
24
|
+
attr_accessor :output_type
|
|
25
|
+
|
|
26
|
+
# A mapping from model property names to API property names.
|
|
27
|
+
def self.names
|
|
28
|
+
@_hash = {} if @_hash.nil?
|
|
29
|
+
@_hash['content'] = 'Content'
|
|
30
|
+
@_hash['labeltype'] = 'Labeltype'
|
|
31
|
+
@_hash['output_type'] = 'OutputType'
|
|
32
|
+
@_hash
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
# An array for optional fields
|
|
36
|
+
def self.optionals
|
|
37
|
+
%w[
|
|
38
|
+
content
|
|
39
|
+
labeltype
|
|
40
|
+
output_type
|
|
41
|
+
]
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
# An array for nullable fields
|
|
45
|
+
def self.nullables
|
|
46
|
+
[]
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
def initialize(content = SKIP, labeltype = SKIP, output_type = SKIP)
|
|
50
|
+
@content = content unless content == SKIP
|
|
51
|
+
@labeltype = labeltype unless labeltype == SKIP
|
|
52
|
+
@output_type = output_type unless output_type == SKIP
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
# Creates an instance of the object from a hash.
|
|
56
|
+
def self.from_hash(hash)
|
|
57
|
+
return nil unless hash
|
|
58
|
+
|
|
59
|
+
# Extract variables from the hash.
|
|
60
|
+
content = hash.key?('Content') ? hash['Content'] : SKIP
|
|
61
|
+
labeltype = hash.key?('Labeltype') ? hash['Labeltype'] : SKIP
|
|
62
|
+
output_type = hash.key?('OutputType') ? hash['OutputType'] : SKIP
|
|
63
|
+
|
|
64
|
+
# Create object from extracted values.
|
|
65
|
+
LabellingLabel.new(content,
|
|
66
|
+
labeltype,
|
|
67
|
+
output_type)
|
|
68
|
+
end
|
|
69
|
+
|
|
70
|
+
# Provides a human-readable string representation of the object.
|
|
71
|
+
def to_s
|
|
72
|
+
class_name = self.class.name.split('::').last
|
|
73
|
+
"<#{class_name} content: #{@content}, labeltype: #{@labeltype}, output_type:"\
|
|
74
|
+
" #{@output_type}>"
|
|
75
|
+
end
|
|
76
|
+
|
|
77
|
+
# Provides a debugging-friendly string with detailed object information.
|
|
78
|
+
def inspect
|
|
79
|
+
class_name = self.class.name.split('::').last
|
|
80
|
+
"<#{class_name} content: #{@content.inspect}, labeltype: #{@labeltype.inspect},"\
|
|
81
|
+
" output_type: #{@output_type.inspect}>"
|
|
82
|
+
end
|
|
83
|
+
end
|
|
84
|
+
end
|
|
@@ -0,0 +1,80 @@
|
|
|
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
|
+
# LabellingMergedLabel Model.
|
|
8
|
+
class LabellingMergedLabel < BaseModel
|
|
9
|
+
SKIP = Object.new
|
|
10
|
+
private_constant :SKIP
|
|
11
|
+
|
|
12
|
+
# TODO: Write general description for this method
|
|
13
|
+
# @return [Array[String]]
|
|
14
|
+
attr_accessor :barcodes
|
|
15
|
+
|
|
16
|
+
# TODO: Write general description for this method
|
|
17
|
+
# @return [Array[LabellingLabel]]
|
|
18
|
+
attr_accessor :labels
|
|
19
|
+
|
|
20
|
+
# A mapping from model property names to API property names.
|
|
21
|
+
def self.names
|
|
22
|
+
@_hash = {} if @_hash.nil?
|
|
23
|
+
@_hash['barcodes'] = 'Barcodes'
|
|
24
|
+
@_hash['labels'] = 'Labels'
|
|
25
|
+
@_hash
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
# An array for optional fields
|
|
29
|
+
def self.optionals
|
|
30
|
+
%w[
|
|
31
|
+
barcodes
|
|
32
|
+
labels
|
|
33
|
+
]
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
# An array for nullable fields
|
|
37
|
+
def self.nullables
|
|
38
|
+
[]
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
def initialize(barcodes = SKIP, labels = SKIP)
|
|
42
|
+
@barcodes = barcodes unless barcodes == SKIP
|
|
43
|
+
@labels = labels unless labels == 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
|
+
barcodes = hash.key?('Barcodes') ? hash['Barcodes'] : SKIP
|
|
52
|
+
# Parameter is an array, so we need to iterate through it
|
|
53
|
+
labels = nil
|
|
54
|
+
unless hash['Labels'].nil?
|
|
55
|
+
labels = []
|
|
56
|
+
hash['Labels'].each do |structure|
|
|
57
|
+
labels << (LabellingLabel.from_hash(structure) if structure)
|
|
58
|
+
end
|
|
59
|
+
end
|
|
60
|
+
|
|
61
|
+
labels = SKIP unless hash.key?('Labels')
|
|
62
|
+
|
|
63
|
+
# Create object from extracted values.
|
|
64
|
+
LabellingMergedLabel.new(barcodes,
|
|
65
|
+
labels)
|
|
66
|
+
end
|
|
67
|
+
|
|
68
|
+
# Provides a human-readable string representation of the object.
|
|
69
|
+
def to_s
|
|
70
|
+
class_name = self.class.name.split('::').last
|
|
71
|
+
"<#{class_name} barcodes: #{@barcodes}, labels: #{@labels}>"
|
|
72
|
+
end
|
|
73
|
+
|
|
74
|
+
# Provides a debugging-friendly string with detailed object information.
|
|
75
|
+
def inspect
|
|
76
|
+
class_name = self.class.name.split('::').last
|
|
77
|
+
"<#{class_name} barcodes: #{@barcodes.inspect}, labels: #{@labels.inspect}>"
|
|
78
|
+
end
|
|
79
|
+
end
|
|
80
|
+
end
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
# postnl_ecommerce
|
|
2
|
+
#
|
|
3
|
+
# This file was automatically generated for PostNL by
|
|
4
|
+
# APIMATIC v3.0 ( https://www.apimatic.io ).
|
|
5
|
+
|
|
6
|
+
module PostnlEcommerce
|
|
7
|
+
# LabellingRequest Model.
|
|
8
|
+
class LabellingRequest < BaseModel
|
|
9
|
+
SKIP = Object.new
|
|
10
|
+
private_constant :SKIP
|
|
11
|
+
|
|
12
|
+
# TODO: Write general description for this method
|
|
13
|
+
# @return [LabellingCustomer]
|
|
14
|
+
attr_accessor :customer
|
|
15
|
+
|
|
16
|
+
# GIF image of the signature (as a base64 encoded string) max size: 280x60
|
|
17
|
+
# mm (1058x226 pixels). This can be used to automatically sign the customs
|
|
18
|
+
# forms. The value of this element can have a maximum size of 65536
|
|
19
|
+
# characters. Note that the total request can have a maximum size of 200KB.
|
|
20
|
+
# Larger requests will not be accepted by the server for performance
|
|
21
|
+
# reasons. Requests that exceed this limit will not return a validation
|
|
22
|
+
# error,but a HTTP 404 error.
|
|
23
|
+
# @return [String]
|
|
24
|
+
attr_accessor :label_signature
|
|
25
|
+
|
|
26
|
+
# GIF image of the signature (as a base64 encoded string) max size: 280x60
|
|
27
|
+
# mm (1058x226 pixels). This can be used to automatically sign the customs
|
|
28
|
+
# forms. The value of this element can have a maximum size of 65536
|
|
29
|
+
# characters. Note that the total request can have a maximum size of 200KB.
|
|
30
|
+
# Larger requests will not be accepted by the server for performance
|
|
31
|
+
# reasons. Requests that exceed this limit will not return a validation
|
|
32
|
+
# error,but a HTTP 404 error.
|
|
33
|
+
# @return [LabellingCustomerMessage]
|
|
34
|
+
attr_accessor :message
|
|
35
|
+
|
|
36
|
+
# List of 1 or more Shipments. At least 1 shipment is required.
|
|
37
|
+
# @return [Array[LabellingCustomerShipment]]
|
|
38
|
+
attr_accessor :shipments
|
|
39
|
+
|
|
40
|
+
# A mapping from model property names to API property names.
|
|
41
|
+
def self.names
|
|
42
|
+
@_hash = {} if @_hash.nil?
|
|
43
|
+
@_hash['customer'] = 'Customer'
|
|
44
|
+
@_hash['label_signature'] = 'LabelSignature'
|
|
45
|
+
@_hash['message'] = 'Message'
|
|
46
|
+
@_hash['shipments'] = 'Shipments'
|
|
47
|
+
@_hash
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
# An array for optional fields
|
|
51
|
+
def self.optionals
|
|
52
|
+
%w[
|
|
53
|
+
label_signature
|
|
54
|
+
]
|
|
55
|
+
end
|
|
56
|
+
|
|
57
|
+
# An array for nullable fields
|
|
58
|
+
def self.nullables
|
|
59
|
+
[]
|
|
60
|
+
end
|
|
61
|
+
|
|
62
|
+
def initialize(customer = nil, message = nil, shipments = nil,
|
|
63
|
+
label_signature = SKIP)
|
|
64
|
+
@customer = customer
|
|
65
|
+
@label_signature = label_signature unless label_signature == SKIP
|
|
66
|
+
@message = message
|
|
67
|
+
@shipments = shipments
|
|
68
|
+
end
|
|
69
|
+
|
|
70
|
+
# Creates an instance of the object from a hash.
|
|
71
|
+
def self.from_hash(hash)
|
|
72
|
+
return nil unless hash
|
|
73
|
+
|
|
74
|
+
# Extract variables from the hash.
|
|
75
|
+
customer = LabellingCustomer.from_hash(hash['Customer']) if hash['Customer']
|
|
76
|
+
message = LabellingCustomerMessage.from_hash(hash['Message']) if hash['Message']
|
|
77
|
+
# Parameter is an array, so we need to iterate through it
|
|
78
|
+
shipments = nil
|
|
79
|
+
unless hash['Shipments'].nil?
|
|
80
|
+
shipments = []
|
|
81
|
+
hash['Shipments'].each do |structure|
|
|
82
|
+
shipments << (LabellingCustomerShipment.from_hash(structure) if structure)
|
|
83
|
+
end
|
|
84
|
+
end
|
|
85
|
+
|
|
86
|
+
shipments = nil unless hash.key?('Shipments')
|
|
87
|
+
label_signature =
|
|
88
|
+
hash.key?('LabelSignature') ? hash['LabelSignature'] : SKIP
|
|
89
|
+
|
|
90
|
+
# Create object from extracted values.
|
|
91
|
+
LabellingRequest.new(customer,
|
|
92
|
+
message,
|
|
93
|
+
shipments,
|
|
94
|
+
label_signature)
|
|
95
|
+
end
|
|
96
|
+
|
|
97
|
+
# Provides a human-readable string representation of the object.
|
|
98
|
+
def to_s
|
|
99
|
+
class_name = self.class.name.split('::').last
|
|
100
|
+
"<#{class_name} customer: #{@customer}, label_signature: #{@label_signature}, message:"\
|
|
101
|
+
" #{@message}, shipments: #{@shipments}>"
|
|
102
|
+
end
|
|
103
|
+
|
|
104
|
+
# Provides a debugging-friendly string with detailed object information.
|
|
105
|
+
def inspect
|
|
106
|
+
class_name = self.class.name.split('::').last
|
|
107
|
+
"<#{class_name} customer: #{@customer.inspect}, label_signature:"\
|
|
108
|
+
" #{@label_signature.inspect}, message: #{@message.inspect}, shipments:"\
|
|
109
|
+
" #{@shipments.inspect}>"
|
|
110
|
+
end
|
|
111
|
+
end
|
|
112
|
+
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
|
+
# LabellingResponse Model.
|
|
8
|
+
class LabellingResponse < BaseModel
|
|
9
|
+
SKIP = Object.new
|
|
10
|
+
private_constant :SKIP
|
|
11
|
+
|
|
12
|
+
# The merged label output; only returned if the printer type selected in
|
|
13
|
+
# your request merges the pdf labels into a single file (e.g. using
|
|
14
|
+
# GraphicFile|Merge).
|
|
15
|
+
# @return [Array[LabellingMergedLabel]]
|
|
16
|
+
attr_accessor :merged_labels
|
|
17
|
+
|
|
18
|
+
# The merged label output; only returned if the printer type selected in
|
|
19
|
+
# your request merges the pdf labels into a single file (e.g. using
|
|
20
|
+
# GraphicFile|Merge).
|
|
21
|
+
# @return [Array[LabellingResponseShipment]]
|
|
22
|
+
attr_accessor :response_shipments
|
|
23
|
+
|
|
24
|
+
# A mapping from model property names to API property names.
|
|
25
|
+
def self.names
|
|
26
|
+
@_hash = {} if @_hash.nil?
|
|
27
|
+
@_hash['merged_labels'] = 'MergedLabels'
|
|
28
|
+
@_hash['response_shipments'] = 'ResponseShipments'
|
|
29
|
+
@_hash
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
# An array for optional fields
|
|
33
|
+
def self.optionals
|
|
34
|
+
%w[
|
|
35
|
+
merged_labels
|
|
36
|
+
response_shipments
|
|
37
|
+
]
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
# An array for nullable fields
|
|
41
|
+
def self.nullables
|
|
42
|
+
[]
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
def initialize(merged_labels = SKIP, response_shipments = SKIP)
|
|
46
|
+
@merged_labels = merged_labels unless merged_labels == SKIP
|
|
47
|
+
@response_shipments = response_shipments unless response_shipments == SKIP
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
# Creates an instance of the object from a hash.
|
|
51
|
+
def self.from_hash(hash)
|
|
52
|
+
return nil unless hash
|
|
53
|
+
|
|
54
|
+
# Extract variables from the hash.
|
|
55
|
+
# Parameter is an array, so we need to iterate through it
|
|
56
|
+
merged_labels = nil
|
|
57
|
+
unless hash['MergedLabels'].nil?
|
|
58
|
+
merged_labels = []
|
|
59
|
+
hash['MergedLabels'].each do |structure|
|
|
60
|
+
merged_labels << (LabellingMergedLabel.from_hash(structure) if structure)
|
|
61
|
+
end
|
|
62
|
+
end
|
|
63
|
+
|
|
64
|
+
merged_labels = SKIP unless hash.key?('MergedLabels')
|
|
65
|
+
# Parameter is an array, so we need to iterate through it
|
|
66
|
+
response_shipments = nil
|
|
67
|
+
unless hash['ResponseShipments'].nil?
|
|
68
|
+
response_shipments = []
|
|
69
|
+
hash['ResponseShipments'].each do |structure|
|
|
70
|
+
response_shipments << (LabellingResponseShipment.from_hash(structure) if structure)
|
|
71
|
+
end
|
|
72
|
+
end
|
|
73
|
+
|
|
74
|
+
response_shipments = SKIP unless hash.key?('ResponseShipments')
|
|
75
|
+
|
|
76
|
+
# Create object from extracted values.
|
|
77
|
+
LabellingResponse.new(merged_labels,
|
|
78
|
+
response_shipments)
|
|
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} merged_labels: #{@merged_labels}, response_shipments:"\
|
|
85
|
+
" #{@response_shipments}>"
|
|
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} merged_labels: #{@merged_labels.inspect}, response_shipments:"\
|
|
92
|
+
" #{@response_shipments.inspect}>"
|
|
93
|
+
end
|
|
94
|
+
end
|
|
95
|
+
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
|
+
# LabellingResponseShipment Model.
|
|
8
|
+
class LabellingResponseShipment < BaseModel
|
|
9
|
+
SKIP = Object.new
|
|
10
|
+
private_constant :SKIP
|
|
11
|
+
|
|
12
|
+
# The product code of the shipment
|
|
13
|
+
# @return [String]
|
|
14
|
+
attr_accessor :product_code_delivery
|
|
15
|
+
|
|
16
|
+
# All labels belonging to the selected product
|
|
17
|
+
# @return [Array[LabellingLabel]]
|
|
18
|
+
attr_accessor :labels
|
|
19
|
+
|
|
20
|
+
# The barcode used on the label
|
|
21
|
+
# @return [String]
|
|
22
|
+
attr_accessor :barcode
|
|
23
|
+
|
|
24
|
+
# The barcode used on the label
|
|
25
|
+
# @return [Array[Object]]
|
|
26
|
+
attr_accessor :errors
|
|
27
|
+
|
|
28
|
+
# Possible warnings. See the [Error
|
|
29
|
+
# Codes](https://developer.postnl.nl/docs/#/http/reference-data/error-codes)
|
|
30
|
+
# for possible values
|
|
31
|
+
# @return [Array[Warning]]
|
|
32
|
+
attr_accessor :warnings
|
|
33
|
+
|
|
34
|
+
# A mapping from model property names to API property names.
|
|
35
|
+
def self.names
|
|
36
|
+
@_hash = {} if @_hash.nil?
|
|
37
|
+
@_hash['product_code_delivery'] = 'ProductCodeDelivery'
|
|
38
|
+
@_hash['labels'] = 'Labels'
|
|
39
|
+
@_hash['barcode'] = 'Barcode'
|
|
40
|
+
@_hash['errors'] = 'Errors'
|
|
41
|
+
@_hash['warnings'] = 'Warnings'
|
|
42
|
+
@_hash
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
# An array for optional fields
|
|
46
|
+
def self.optionals
|
|
47
|
+
%w[
|
|
48
|
+
product_code_delivery
|
|
49
|
+
labels
|
|
50
|
+
barcode
|
|
51
|
+
errors
|
|
52
|
+
warnings
|
|
53
|
+
]
|
|
54
|
+
end
|
|
55
|
+
|
|
56
|
+
# An array for nullable fields
|
|
57
|
+
def self.nullables
|
|
58
|
+
[]
|
|
59
|
+
end
|
|
60
|
+
|
|
61
|
+
def initialize(product_code_delivery = SKIP, labels = SKIP, barcode = SKIP,
|
|
62
|
+
errors = SKIP, warnings = SKIP)
|
|
63
|
+
@product_code_delivery = product_code_delivery unless product_code_delivery == SKIP
|
|
64
|
+
@labels = labels unless labels == SKIP
|
|
65
|
+
@barcode = barcode unless barcode == SKIP
|
|
66
|
+
@errors = errors unless errors == SKIP
|
|
67
|
+
@warnings = warnings unless warnings == SKIP
|
|
68
|
+
end
|
|
69
|
+
|
|
70
|
+
# Creates an instance of the object from a hash.
|
|
71
|
+
def self.from_hash(hash)
|
|
72
|
+
return nil unless hash
|
|
73
|
+
|
|
74
|
+
# Extract variables from the hash.
|
|
75
|
+
product_code_delivery =
|
|
76
|
+
hash.key?('ProductCodeDelivery') ? hash['ProductCodeDelivery'] : SKIP
|
|
77
|
+
# Parameter is an array, so we need to iterate through it
|
|
78
|
+
labels = nil
|
|
79
|
+
unless hash['Labels'].nil?
|
|
80
|
+
labels = []
|
|
81
|
+
hash['Labels'].each do |structure|
|
|
82
|
+
labels << (LabellingLabel.from_hash(structure) if structure)
|
|
83
|
+
end
|
|
84
|
+
end
|
|
85
|
+
|
|
86
|
+
labels = SKIP unless hash.key?('Labels')
|
|
87
|
+
barcode = hash.key?('Barcode') ? hash['Barcode'] : SKIP
|
|
88
|
+
errors = hash.key?('Errors') ? hash['Errors'] : SKIP
|
|
89
|
+
# Parameter is an array, so we need to iterate through it
|
|
90
|
+
warnings = nil
|
|
91
|
+
unless hash['Warnings'].nil?
|
|
92
|
+
warnings = []
|
|
93
|
+
hash['Warnings'].each do |structure|
|
|
94
|
+
warnings << (Warning.from_hash(structure) if structure)
|
|
95
|
+
end
|
|
96
|
+
end
|
|
97
|
+
|
|
98
|
+
warnings = SKIP unless hash.key?('Warnings')
|
|
99
|
+
|
|
100
|
+
# Create object from extracted values.
|
|
101
|
+
LabellingResponseShipment.new(product_code_delivery,
|
|
102
|
+
labels,
|
|
103
|
+
barcode,
|
|
104
|
+
errors,
|
|
105
|
+
warnings)
|
|
106
|
+
end
|
|
107
|
+
|
|
108
|
+
# Provides a human-readable string representation of the object.
|
|
109
|
+
def to_s
|
|
110
|
+
class_name = self.class.name.split('::').last
|
|
111
|
+
"<#{class_name} product_code_delivery: #{@product_code_delivery}, labels: #{@labels},"\
|
|
112
|
+
" barcode: #{@barcode}, errors: #{@errors}, warnings: #{@warnings}>"
|
|
113
|
+
end
|
|
114
|
+
|
|
115
|
+
# Provides a debugging-friendly string with detailed object information.
|
|
116
|
+
def inspect
|
|
117
|
+
class_name = self.class.name.split('::').last
|
|
118
|
+
"<#{class_name} product_code_delivery: #{@product_code_delivery.inspect}, labels:"\
|
|
119
|
+
" #{@labels.inspect}, barcode: #{@barcode.inspect}, errors: #{@errors.inspect}, warnings:"\
|
|
120
|
+
" #{@warnings.inspect}>"
|
|
121
|
+
end
|
|
122
|
+
end
|
|
123
|
+
end
|
|
@@ -0,0 +1,48 @@
|
|
|
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
|
+
# language.
|
|
8
|
+
class LanguageEnum
|
|
9
|
+
LANGUAGE_ENUM = [
|
|
10
|
+
# TODO: Write general description for NL
|
|
11
|
+
NL = 'NL'.freeze,
|
|
12
|
+
|
|
13
|
+
# TODO: Write general description for EN
|
|
14
|
+
EN = 'EN'.freeze,
|
|
15
|
+
|
|
16
|
+
# TODO: Write general description for CN
|
|
17
|
+
CN = 'CN'.freeze,
|
|
18
|
+
|
|
19
|
+
# TODO: Write general description for DE
|
|
20
|
+
DE = 'DE'.freeze,
|
|
21
|
+
|
|
22
|
+
# TODO: Write general description for FR
|
|
23
|
+
FR = 'FR'.freeze
|
|
24
|
+
].freeze
|
|
25
|
+
|
|
26
|
+
def self.validate(value)
|
|
27
|
+
return false if value.nil?
|
|
28
|
+
|
|
29
|
+
LANGUAGE_ENUM.include?(value)
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
def self.from_value(value, default_value = NL)
|
|
33
|
+
return default_value if value.nil?
|
|
34
|
+
|
|
35
|
+
str = value.to_s.strip
|
|
36
|
+
|
|
37
|
+
case str.downcase
|
|
38
|
+
when 'nl' then NL
|
|
39
|
+
when 'en' then EN
|
|
40
|
+
when 'cn' then CN
|
|
41
|
+
when 'de' then DE
|
|
42
|
+
when 'fr' then FR
|
|
43
|
+
else
|
|
44
|
+
default_value
|
|
45
|
+
end
|
|
46
|
+
end
|
|
47
|
+
end
|
|
48
|
+
end
|