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,57 @@
|
|
|
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
|
+
# labellingResponseInvalid class.
|
|
8
|
+
class LabellingResponseInvalidException < APIException
|
|
9
|
+
SKIP = Object.new
|
|
10
|
+
private_constant :SKIP
|
|
11
|
+
|
|
12
|
+
# A list of errors returned from the webservice. See the [Error
|
|
13
|
+
# codes](https://developer.postnl.nl/docs/#/http/reference-data/error-codes)
|
|
14
|
+
# for possible values.
|
|
15
|
+
# @return [Array[LabellingError]]
|
|
16
|
+
attr_accessor :errors
|
|
17
|
+
|
|
18
|
+
# The constructor.
|
|
19
|
+
# @param [String] reason The reason for raising an exception.
|
|
20
|
+
# @param [HttpResponse] response The HttpReponse of the API call.
|
|
21
|
+
def initialize(reason, response)
|
|
22
|
+
super(reason, response)
|
|
23
|
+
hash = APIHelper.json_deserialize(@response.raw_body)
|
|
24
|
+
unbox(hash)
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
# Populates this object by extracting properties from a hash.
|
|
28
|
+
# @param [Hash] hash The deserialized response sent by the server in the
|
|
29
|
+
# response body.
|
|
30
|
+
def unbox(hash)
|
|
31
|
+
return nil unless hash
|
|
32
|
+
|
|
33
|
+
# Parameter is an array, so we need to iterate through it
|
|
34
|
+
@errors = nil
|
|
35
|
+
unless hash['Errors'].nil?
|
|
36
|
+
@errors = []
|
|
37
|
+
hash['Errors'].each do |structure|
|
|
38
|
+
@errors << (LabellingError.from_hash(structure) if structure)
|
|
39
|
+
end
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
@errors = SKIP unless hash.key?('Errors')
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
# Provides a human-readable string representation of the object.
|
|
46
|
+
def to_s
|
|
47
|
+
class_name = self.class.name.split('::').last
|
|
48
|
+
"<#{class_name} errors: #{@errors}>"
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
# Provides a debugging-friendly string with detailed object information.
|
|
52
|
+
def inspect
|
|
53
|
+
class_name = self.class.name.split('::').last
|
|
54
|
+
"<#{class_name} errors: #{@errors.inspect}>"
|
|
55
|
+
end
|
|
56
|
+
end
|
|
57
|
+
end
|
|
@@ -0,0 +1,53 @@
|
|
|
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
|
+
# MethodNotAllowedOnlyGet class.
|
|
8
|
+
class MethodNotAllowedOnlyGetException < APIException
|
|
9
|
+
SKIP = Object.new
|
|
10
|
+
private_constant :SKIP
|
|
11
|
+
|
|
12
|
+
# TODO: Write general description for this method
|
|
13
|
+
# @return [String]
|
|
14
|
+
attr_accessor :message
|
|
15
|
+
|
|
16
|
+
# TODO: Write general description for this method
|
|
17
|
+
# @return [Float]
|
|
18
|
+
attr_accessor :http_status_code
|
|
19
|
+
|
|
20
|
+
# The constructor.
|
|
21
|
+
# @param [String] reason The reason for raising an exception.
|
|
22
|
+
# @param [HttpResponse] response The HttpReponse of the API call.
|
|
23
|
+
def initialize(reason, response)
|
|
24
|
+
super(reason, response)
|
|
25
|
+
hash = APIHelper.json_deserialize(@response.raw_body)
|
|
26
|
+
unbox(hash)
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
# Populates this object by extracting properties from a hash.
|
|
30
|
+
# @param [Hash] hash The deserialized response sent by the server in the
|
|
31
|
+
# response body.
|
|
32
|
+
def unbox(hash)
|
|
33
|
+
return nil unless hash
|
|
34
|
+
|
|
35
|
+
@message = hash.key?('message') ? hash['message'] : SKIP
|
|
36
|
+
@http_status_code =
|
|
37
|
+
hash.key?('http_status_code') ? hash['http_status_code'] : SKIP
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
# Provides a human-readable string representation of the object.
|
|
41
|
+
def to_s
|
|
42
|
+
class_name = self.class.name.split('::').last
|
|
43
|
+
"<#{class_name} message: #{@message}, http_status_code: #{@http_status_code}>"
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
# Provides a debugging-friendly string with detailed object information.
|
|
47
|
+
def inspect
|
|
48
|
+
class_name = self.class.name.split('::').last
|
|
49
|
+
"<#{class_name} message: #{@message.inspect}, http_status_code:"\
|
|
50
|
+
" #{@http_status_code.inspect}>"
|
|
51
|
+
end
|
|
52
|
+
end
|
|
53
|
+
end
|
|
@@ -0,0 +1,53 @@
|
|
|
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
|
+
# MethodNotAllowedOnlyGetPost class.
|
|
8
|
+
class MethodNotAllowedOnlyGetPostException < APIException
|
|
9
|
+
SKIP = Object.new
|
|
10
|
+
private_constant :SKIP
|
|
11
|
+
|
|
12
|
+
# TODO: Write general description for this method
|
|
13
|
+
# @return [String]
|
|
14
|
+
attr_accessor :message
|
|
15
|
+
|
|
16
|
+
# TODO: Write general description for this method
|
|
17
|
+
# @return [Float]
|
|
18
|
+
attr_accessor :http_status_code
|
|
19
|
+
|
|
20
|
+
# The constructor.
|
|
21
|
+
# @param [String] reason The reason for raising an exception.
|
|
22
|
+
# @param [HttpResponse] response The HttpReponse of the API call.
|
|
23
|
+
def initialize(reason, response)
|
|
24
|
+
super(reason, response)
|
|
25
|
+
hash = APIHelper.json_deserialize(@response.raw_body)
|
|
26
|
+
unbox(hash)
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
# Populates this object by extracting properties from a hash.
|
|
30
|
+
# @param [Hash] hash The deserialized response sent by the server in the
|
|
31
|
+
# response body.
|
|
32
|
+
def unbox(hash)
|
|
33
|
+
return nil unless hash
|
|
34
|
+
|
|
35
|
+
@message = hash.key?('message') ? hash['message'] : SKIP
|
|
36
|
+
@http_status_code =
|
|
37
|
+
hash.key?('http_status_code') ? hash['http_status_code'] : SKIP
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
# Provides a human-readable string representation of the object.
|
|
41
|
+
def to_s
|
|
42
|
+
class_name = self.class.name.split('::').last
|
|
43
|
+
"<#{class_name} message: #{@message}, http_status_code: #{@http_status_code}>"
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
# Provides a debugging-friendly string with detailed object information.
|
|
47
|
+
def inspect
|
|
48
|
+
class_name = self.class.name.split('::').last
|
|
49
|
+
"<#{class_name} message: #{@message.inspect}, http_status_code:"\
|
|
50
|
+
" #{@http_status_code.inspect}>"
|
|
51
|
+
end
|
|
52
|
+
end
|
|
53
|
+
end
|
|
@@ -0,0 +1,53 @@
|
|
|
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
|
+
# MethodNotAllowedOnlyPost class.
|
|
8
|
+
class MethodNotAllowedOnlyPostException < APIException
|
|
9
|
+
SKIP = Object.new
|
|
10
|
+
private_constant :SKIP
|
|
11
|
+
|
|
12
|
+
# TODO: Write general description for this method
|
|
13
|
+
# @return [String]
|
|
14
|
+
attr_accessor :message
|
|
15
|
+
|
|
16
|
+
# TODO: Write general description for this method
|
|
17
|
+
# @return [Float]
|
|
18
|
+
attr_accessor :http_status_code
|
|
19
|
+
|
|
20
|
+
# The constructor.
|
|
21
|
+
# @param [String] reason The reason for raising an exception.
|
|
22
|
+
# @param [HttpResponse] response The HttpReponse of the API call.
|
|
23
|
+
def initialize(reason, response)
|
|
24
|
+
super(reason, response)
|
|
25
|
+
hash = APIHelper.json_deserialize(@response.raw_body)
|
|
26
|
+
unbox(hash)
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
# Populates this object by extracting properties from a hash.
|
|
30
|
+
# @param [Hash] hash The deserialized response sent by the server in the
|
|
31
|
+
# response body.
|
|
32
|
+
def unbox(hash)
|
|
33
|
+
return nil unless hash
|
|
34
|
+
|
|
35
|
+
@message = hash.key?('message') ? hash['message'] : SKIP
|
|
36
|
+
@http_status_code =
|
|
37
|
+
hash.key?('http_status_code') ? hash['http_status_code'] : SKIP
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
# Provides a human-readable string representation of the object.
|
|
41
|
+
def to_s
|
|
42
|
+
class_name = self.class.name.split('::').last
|
|
43
|
+
"<#{class_name} message: #{@message}, http_status_code: #{@http_status_code}>"
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
# Provides a debugging-friendly string with detailed object information.
|
|
47
|
+
def inspect
|
|
48
|
+
class_name = self.class.name.split('::').last
|
|
49
|
+
"<#{class_name} message: #{@message.inspect}, http_status_code:"\
|
|
50
|
+
" #{@http_status_code.inspect}>"
|
|
51
|
+
end
|
|
52
|
+
end
|
|
53
|
+
end
|
|
@@ -0,0 +1,55 @@
|
|
|
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
|
+
# postalcodeCheckResponseInvalid class.
|
|
8
|
+
class PostalcodeCheckResponseInvalidException < APIException
|
|
9
|
+
SKIP = Object.new
|
|
10
|
+
private_constant :SKIP
|
|
11
|
+
|
|
12
|
+
# TODO: Write general description for this method
|
|
13
|
+
# @return [Array[PostalcodeCheckError]]
|
|
14
|
+
attr_accessor :errors
|
|
15
|
+
|
|
16
|
+
# The constructor.
|
|
17
|
+
# @param [String] reason The reason for raising an exception.
|
|
18
|
+
# @param [HttpResponse] response The HttpReponse of the API call.
|
|
19
|
+
def initialize(reason, response)
|
|
20
|
+
super(reason, response)
|
|
21
|
+
hash = APIHelper.json_deserialize(@response.raw_body)
|
|
22
|
+
unbox(hash)
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
# Populates this object by extracting properties from a hash.
|
|
26
|
+
# @param [Hash] hash The deserialized response sent by the server in the
|
|
27
|
+
# response body.
|
|
28
|
+
def unbox(hash)
|
|
29
|
+
return nil unless hash
|
|
30
|
+
|
|
31
|
+
# Parameter is an array, so we need to iterate through it
|
|
32
|
+
@errors = nil
|
|
33
|
+
unless hash['errors'].nil?
|
|
34
|
+
@errors = []
|
|
35
|
+
hash['errors'].each do |structure|
|
|
36
|
+
@errors << (PostalcodeCheckError.from_hash(structure) if structure)
|
|
37
|
+
end
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
@errors = SKIP unless hash.key?('errors')
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
# Provides a human-readable string representation of the object.
|
|
44
|
+
def to_s
|
|
45
|
+
class_name = self.class.name.split('::').last
|
|
46
|
+
"<#{class_name} errors: #{@errors}>"
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
# Provides a debugging-friendly string with detailed object information.
|
|
50
|
+
def inspect
|
|
51
|
+
class_name = self.class.name.split('::').last
|
|
52
|
+
"<#{class_name} errors: #{@errors.inspect}>"
|
|
53
|
+
end
|
|
54
|
+
end
|
|
55
|
+
end
|
|
@@ -0,0 +1,53 @@
|
|
|
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
|
+
# TooManyRequests class.
|
|
8
|
+
class TooManyRequestsException < APIException
|
|
9
|
+
SKIP = Object.new
|
|
10
|
+
private_constant :SKIP
|
|
11
|
+
|
|
12
|
+
# TODO: Write general description for this method
|
|
13
|
+
# @return [String]
|
|
14
|
+
attr_accessor :message
|
|
15
|
+
|
|
16
|
+
# TODO: Write general description for this method
|
|
17
|
+
# @return [Float]
|
|
18
|
+
attr_accessor :http_status_code
|
|
19
|
+
|
|
20
|
+
# The constructor.
|
|
21
|
+
# @param [String] reason The reason for raising an exception.
|
|
22
|
+
# @param [HttpResponse] response The HttpReponse of the API call.
|
|
23
|
+
def initialize(reason, response)
|
|
24
|
+
super(reason, response)
|
|
25
|
+
hash = APIHelper.json_deserialize(@response.raw_body)
|
|
26
|
+
unbox(hash)
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
# Populates this object by extracting properties from a hash.
|
|
30
|
+
# @param [Hash] hash The deserialized response sent by the server in the
|
|
31
|
+
# response body.
|
|
32
|
+
def unbox(hash)
|
|
33
|
+
return nil unless hash
|
|
34
|
+
|
|
35
|
+
@message = hash.key?('message') ? hash['message'] : SKIP
|
|
36
|
+
@http_status_code =
|
|
37
|
+
hash.key?('http_status_code') ? hash['http_status_code'] : SKIP
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
# Provides a human-readable string representation of the object.
|
|
41
|
+
def to_s
|
|
42
|
+
class_name = self.class.name.split('::').last
|
|
43
|
+
"<#{class_name} message: #{@message}, http_status_code: #{@http_status_code}>"
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
# Provides a debugging-friendly string with detailed object information.
|
|
47
|
+
def inspect
|
|
48
|
+
class_name = self.class.name.split('::').last
|
|
49
|
+
"<#{class_name} message: #{@message.inspect}, http_status_code:"\
|
|
50
|
+
" #{@http_status_code.inspect}>"
|
|
51
|
+
end
|
|
52
|
+
end
|
|
53
|
+
end
|
|
@@ -0,0 +1,53 @@
|
|
|
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
|
+
# Unauthorized class.
|
|
8
|
+
class UnauthorizedException < APIException
|
|
9
|
+
SKIP = Object.new
|
|
10
|
+
private_constant :SKIP
|
|
11
|
+
|
|
12
|
+
# TODO: Write general description for this method
|
|
13
|
+
# @return [String]
|
|
14
|
+
attr_accessor :message
|
|
15
|
+
|
|
16
|
+
# TODO: Write general description for this method
|
|
17
|
+
# @return [Float]
|
|
18
|
+
attr_accessor :http_status_code
|
|
19
|
+
|
|
20
|
+
# The constructor.
|
|
21
|
+
# @param [String] reason The reason for raising an exception.
|
|
22
|
+
# @param [HttpResponse] response The HttpReponse of the API call.
|
|
23
|
+
def initialize(reason, response)
|
|
24
|
+
super(reason, response)
|
|
25
|
+
hash = APIHelper.json_deserialize(@response.raw_body)
|
|
26
|
+
unbox(hash)
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
# Populates this object by extracting properties from a hash.
|
|
30
|
+
# @param [Hash] hash The deserialized response sent by the server in the
|
|
31
|
+
# response body.
|
|
32
|
+
def unbox(hash)
|
|
33
|
+
return nil unless hash
|
|
34
|
+
|
|
35
|
+
@message = hash.key?('message') ? hash['message'] : SKIP
|
|
36
|
+
@http_status_code =
|
|
37
|
+
hash.key?('http_status_code') ? hash['http_status_code'] : SKIP
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
# Provides a human-readable string representation of the object.
|
|
41
|
+
def to_s
|
|
42
|
+
class_name = self.class.name.split('::').last
|
|
43
|
+
"<#{class_name} message: #{@message}, http_status_code: #{@http_status_code}>"
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
# Provides a debugging-friendly string with detailed object information.
|
|
47
|
+
def inspect
|
|
48
|
+
class_name = self.class.name.split('::').last
|
|
49
|
+
"<#{class_name} message: #{@message.inspect}, http_status_code:"\
|
|
50
|
+
" #{@http_status_code.inspect}>"
|
|
51
|
+
end
|
|
52
|
+
end
|
|
53
|
+
end
|
|
@@ -0,0 +1,19 @@
|
|
|
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
|
+
# Http response received.
|
|
8
|
+
class ApiResponse < CoreLibrary::ApiResponse
|
|
9
|
+
# The constructor
|
|
10
|
+
# @param [HttpResponse] http_response The original, raw response from the api.
|
|
11
|
+
# @param [Object] data The data field specified for the response.
|
|
12
|
+
# @param [Array<String>] errors Any errors returned by the server.
|
|
13
|
+
def initialize(http_response,
|
|
14
|
+
data: nil,
|
|
15
|
+
errors: nil)
|
|
16
|
+
super
|
|
17
|
+
end
|
|
18
|
+
end
|
|
19
|
+
end
|
|
@@ -0,0 +1,52 @@
|
|
|
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
|
+
# Utility class for custom header authorization.
|
|
8
|
+
class CustomHeaderAuthentication < CoreLibrary::HeaderAuth
|
|
9
|
+
# Display error message on occurrence of authentication failure.
|
|
10
|
+
# @returns [String] The oAuth error message.
|
|
11
|
+
def error_message
|
|
12
|
+
'CustomHeaderAuthentication: apikey is undefined.'
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
# Initialization constructor.
|
|
16
|
+
def initialize(custom_header_authentication_credentials)
|
|
17
|
+
auth_params = {}
|
|
18
|
+
auth_params['apikey'] = custom_header_authentication_credentials.apikey unless
|
|
19
|
+
custom_header_authentication_credentials.nil? || custom_header_authentication_credentials.apikey.nil?
|
|
20
|
+
|
|
21
|
+
super auth_params
|
|
22
|
+
end
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
# Data class for CustomHeaderAuthenticationCredentials.
|
|
26
|
+
# Data class for CustomHeaderAuthenticationCredentials.
|
|
27
|
+
class CustomHeaderAuthenticationCredentials
|
|
28
|
+
attr_reader :apikey
|
|
29
|
+
|
|
30
|
+
def initialize(apikey:)
|
|
31
|
+
raise ArgumentError, 'apikey cannot be nil' if apikey.nil?
|
|
32
|
+
|
|
33
|
+
@apikey = apikey
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
def self.from_env
|
|
37
|
+
apikey = ENV['APIKEY']
|
|
38
|
+
all_nil = [
|
|
39
|
+
apikey
|
|
40
|
+
].all?(&:nil?)
|
|
41
|
+
return nil if all_nil
|
|
42
|
+
|
|
43
|
+
new(apikey: apikey)
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
def clone_with(apikey: nil)
|
|
47
|
+
apikey ||= self.apikey
|
|
48
|
+
|
|
49
|
+
CustomHeaderAuthenticationCredentials.new(apikey: apikey)
|
|
50
|
+
end
|
|
51
|
+
end
|
|
52
|
+
end
|
|
@@ -0,0 +1,10 @@
|
|
|
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
|
+
# HttpCallBack allows defining callables for pre and post API calls.
|
|
8
|
+
class HttpCallBack < CoreLibrary::HttpCallback
|
|
9
|
+
end
|
|
10
|
+
end
|
|
@@ -0,0 +1,22 @@
|
|
|
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
|
+
##
|
|
8
|
+
# ProxySettings encapsulates HTTP proxy configuration for Faraday,
|
|
9
|
+
# including optional basic authentication.
|
|
10
|
+
#
|
|
11
|
+
class ProxySettings < CoreLibrary::ProxySettings
|
|
12
|
+
def self.from_env
|
|
13
|
+
address = ENV['PROXY_ADDRESS']
|
|
14
|
+
port = ENV['PROXY_PORT']
|
|
15
|
+
username = ENV['PROXY_USERNAME']
|
|
16
|
+
password = ENV['PROXY_PASSWORD']
|
|
17
|
+
return nil if address.nil? || address.strip.empty?
|
|
18
|
+
|
|
19
|
+
new(address: address, port: port, username: username, password: password)
|
|
20
|
+
end
|
|
21
|
+
end
|
|
22
|
+
end
|