Class: UspsApi::CustomsReferenceInformation

Inherits:
BaseModel
  • Object
show all
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

Class Method Summary collapse

Instance Method Summary collapse

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

#contactContact

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.

Returns:



26
27
28
# File 'lib/usps_api/models/customs_reference_information.rb', line 26

def contact
  @contact
end

#referenceString

Customs Reference.

Returns:

  • (String)


19
20
21
# File 'lib/usps_api/models/customs_reference_information.rb', line 19

def reference
  @reference
end

#reference_typeReferenceType

The type of reference number being provided.

Returns:



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

.namesObject

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

.nullablesObject

An array for nullable fields



47
48
49
# File 'lib/usps_api/models/customs_reference_information.rb', line 47

def self.nullables
  []
end

.optionalsObject

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

#inspectObject

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_sObject

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