Class: UspsApi::CustomsReferenceInformation
- Inherits:
-
BaseModel
- Object
- CoreLibrary::BaseModel
- BaseModel
- UspsApi::CustomsReferenceInformation
- Defined in:
- lib/usps_api/models/customs_reference_information.rb
Overview
Reference information for customs processing including tax codes, VAT numbers, importer codes, and contact details.
Instance Attribute Summary collapse
-
#contact ⇒ Contact
Contact information for customs reference.
-
#reference ⇒ String
Customs Reference.
-
#reference_type ⇒ ReferenceType
The type of reference number being provided.
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(reference_type: SKIP, reference: SKIP, contact: SKIP) ⇒ CustomsReferenceInformation
constructor
A new instance of CustomsReferenceInformation.
-
#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(reference_type: SKIP, reference: SKIP, contact: SKIP) ⇒ CustomsReferenceInformation
Returns a new instance of CustomsReferenceInformation.
51 52 53 54 55 |
# File 'lib/usps_api/models/customs_reference_information.rb', line 51 def initialize(reference_type: SKIP, reference: SKIP, contact: SKIP) @reference_type = reference_type unless reference_type == SKIP @reference = reference unless reference == SKIP @contact = contact unless contact == SKIP end |
Instance Attribute Details
#contact ⇒ Contact
Contact information for customs reference. When multiple contact methods are provided, the customs form will prioritize printing phone number, then email address, then the fax number. All contact methods will be manifested electronically.
26 27 28 |
# File 'lib/usps_api/models/customs_reference_information.rb', line 26 def contact @contact end |
#reference ⇒ String
Customs Reference.
19 20 21 |
# File 'lib/usps_api/models/customs_reference_information.rb', line 19 def reference @reference end |
#reference_type ⇒ ReferenceType
The type of reference number being provided.
15 16 17 |
# File 'lib/usps_api/models/customs_reference_information.rb', line 15 def reference_type @reference_type end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
58 59 60 61 62 63 64 65 66 67 68 69 70 |
# File 'lib/usps_api/models/customs_reference_information.rb', line 58 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. reference_type = hash.key?('referenceType') ? hash['referenceType'] : SKIP reference = hash.key?('reference') ? hash['reference'] : SKIP contact = Contact.from_hash(hash['contact']) if hash['contact'] # Create object from extracted values. CustomsReferenceInformation.new(reference_type: reference_type, reference: reference, contact: contact) end |
.names ⇒ Object
A mapping from model property names to API property names.
29 30 31 32 33 34 35 |
# File 'lib/usps_api/models/customs_reference_information.rb', line 29 def self.names @_hash = {} if @_hash.nil? @_hash['reference_type'] = 'referenceType' @_hash['reference'] = 'reference' @_hash['contact'] = 'contact' @_hash end |
.nullables ⇒ Object
An array for nullable fields
47 48 49 |
# File 'lib/usps_api/models/customs_reference_information.rb', line 47 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
38 39 40 41 42 43 44 |
# File 'lib/usps_api/models/customs_reference_information.rb', line 38 def self.optionals %w[ reference_type reference contact ] end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
80 81 82 83 84 |
# File 'lib/usps_api/models/customs_reference_information.rb', line 80 def inspect class_name = self.class.name.split('::').last "<#{class_name} reference_type: #{@reference_type.inspect}, reference:"\ " #{@reference.inspect}, contact: #{@contact.inspect}>" end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
73 74 75 76 77 |
# File 'lib/usps_api/models/customs_reference_information.rb', line 73 def to_s class_name = self.class.name.split('::').last "<#{class_name} reference_type: #{@reference_type}, reference: #{@reference}, contact:"\ " #{@contact}>" end |