Class: UspsApi::InternationalLabelsPackageOptions
- Inherits:
-
BaseModel
- Object
- CoreLibrary::BaseModel
- BaseModel
- UspsApi::InternationalLabelsPackageOptions
- Defined in:
- lib/usps_api/models/international_labels_package_options.rb
Overview
Additional options for package shipments including package value and non-delivery preferences.
Instance Attribute Summary collapse
-
#non_delivery_option ⇒ NonDeliveryOption
Requested action in the case a package is undeliverable: * RETURN for the package to be returned to ‘fromAddress`.
-
#package_value ⇒ Float
The merchandise value of the package, in US dollars.
Class Method Summary collapse
-
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
-
.names ⇒ Object
A mapping from model property names to API property names.
-
.nullables ⇒ Object
An array for nullable fields.
-
.optionals ⇒ Object
An array for optional fields.
Instance Method Summary collapse
-
#initialize(package_value: SKIP, non_delivery_option: SKIP, additional_properties: nil) ⇒ InternationalLabelsPackageOptions
constructor
A new instance of InternationalLabelsPackageOptions.
-
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
-
#to_s ⇒ Object
Provides a human-readable string representation of the object.
Methods inherited from BaseModel
#check_for_conflict, #process_additional_properties, #process_array, #process_basic_value, #process_hash, #to_hash, #to_json
Constructor Details
#initialize(package_value: SKIP, non_delivery_option: SKIP, additional_properties: nil) ⇒ InternationalLabelsPackageOptions
Returns a new instance of InternationalLabelsPackageOptions.
46 47 48 49 50 51 52 53 54 |
# File 'lib/usps_api/models/international_labels_package_options.rb', line 46 def initialize(package_value: SKIP, non_delivery_option: SKIP, additional_properties: nil) # Add additional model properties to the instance additional_properties = {} if additional_properties.nil? @package_value = package_value unless package_value == SKIP @non_delivery_option = non_delivery_option unless non_delivery_option == SKIP @additional_properties = additional_properties end |
Instance Attribute Details
#non_delivery_option ⇒ NonDeliveryOption
Requested action in the case a package is undeliverable: * RETURN for the package to be returned to ‘fromAddress`. * REDIRECT to return the package to address specified in the `redirectAddress`. * ABANDON to dispose of the undeliverable package
23 24 25 |
# File 'lib/usps_api/models/international_labels_package_options.rb', line 23 def non_delivery_option @non_delivery_option end |
#package_value ⇒ Float
The merchandise value of the package, in US dollars. Used to calculate Insurance Fees if requested.
16 17 18 |
# File 'lib/usps_api/models/international_labels_package_options.rb', line 16 def package_value @package_value end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 |
# File 'lib/usps_api/models/international_labels_package_options.rb', line 57 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. package_value = hash.key?('packageValue') ? hash['packageValue'] : SKIP non_delivery_option = hash.key?('nonDeliveryOption') ? hash['nonDeliveryOption'] : SKIP # Create a new hash for additional properties, removing known properties. new_hash = hash.reject { |k, _| names.value?(k) } additional_properties = APIHelper.get_additional_properties( new_hash, proc { |value| value } ) # Create object from extracted values. InternationalLabelsPackageOptions.new(package_value: package_value, non_delivery_option: non_delivery_option, additional_properties: additional_properties) end |
.names ⇒ Object
A mapping from model property names to API property names.
26 27 28 29 30 31 |
# File 'lib/usps_api/models/international_labels_package_options.rb', line 26 def self.names @_hash = {} if @_hash.nil? @_hash['package_value'] = 'packageValue' @_hash['non_delivery_option'] = 'nonDeliveryOption' @_hash end |
.nullables ⇒ Object
An array for nullable fields
42 43 44 |
# File 'lib/usps_api/models/international_labels_package_options.rb', line 42 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
34 35 36 37 38 39 |
# File 'lib/usps_api/models/international_labels_package_options.rb', line 34 def self.optionals %w[ package_value non_delivery_option ] end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
86 87 88 89 90 |
# File 'lib/usps_api/models/international_labels_package_options.rb', line 86 def inspect class_name = self.class.name.split('::').last "<#{class_name} package_value: #{@package_value.inspect}, non_delivery_option:"\ " #{@non_delivery_option.inspect}, additional_properties: #{@additional_properties}>" end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
79 80 81 82 83 |
# File 'lib/usps_api/models/international_labels_package_options.rb', line 79 def to_s class_name = self.class.name.split('::').last "<#{class_name} package_value: #{@package_value}, non_delivery_option:"\ " #{@non_delivery_option}, additional_properties: #{@additional_properties}>" end |