Class: UspsApi::InternationalLabelsCustomsForm

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/usps_api/models/international_labels_customs_form.rb

Overview

Additional details required when creating International shipments.

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(content_comments: SKIP, restriction_type: SKIP, restriction_comments: SKIP, aesitn: SKIP, invoice_number: SKIP, license_number: SKIP, certificate_number: SKIP, additional_properties: nil) ⇒ InternationalLabelsCustomsForm

Returns a new instance of InternationalLabelsCustomsForm.



88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
# File 'lib/usps_api/models/international_labels_customs_form.rb', line 88

def initialize(content_comments: SKIP, restriction_type: SKIP,
               restriction_comments: SKIP, aesitn: SKIP,
               invoice_number: SKIP, license_number: SKIP,
               certificate_number: SKIP, additional_properties: nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @content_comments = content_comments unless content_comments == SKIP
  @restriction_type = restriction_type unless restriction_type == SKIP
  @restriction_comments = restriction_comments unless restriction_comments == SKIP
  @aesitn = aesitn unless aesitn == SKIP
  @invoice_number = invoice_number unless invoice_number == SKIP
  @license_number = license_number unless license_number == SKIP
  @certificate_number = certificate_number unless certificate_number == SKIP
  @additional_properties = additional_properties
end

Instance Attribute Details

#aesitnString

USPS requires the ITN or the Exemption.

  • **AES - Automated Export System / ITN - Internal Transaction Number**\ The [internal transaction number

(ITN)](pe.usps.com/text/imm/immc5_010.htm) is a 14-digit number that corresponds to an export transaction in the Automated Export System. It serves as proof that an exporter met his or her legal obligation to inform the U.S. government about the details of an export shipment.

instance in which you would not have to file in AES to get the 14-digit ITN. Instead of the ITN, you would enter the exemption’s section in the U.S. Foreign Trade Regulations on the export documentation where you would otherwise put the ITN. Sample - ‘NO EEI 30.37(a)`: Shipments valued at $2,500 or less.

Returns:

  • (String)


43
44
45
# File 'lib/usps_api/models/international_labels_customs_form.rb', line 43

def aesitn
  @aesitn
end

#certificate_numberString

Certificate Number.

Returns:

  • (String)


55
56
57
# File 'lib/usps_api/models/international_labels_customs_form.rb', line 55

def certificate_number
  @certificate_number
end

#content_commentsString

Required when customContentType is OTHER.

Returns:

  • (String)


14
15
16
# File 'lib/usps_api/models/international_labels_customs_form.rb', line 14

def content_comments
  @content_comments
end

#invoice_numberString

Invoice Number.

Returns:

  • (String)


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

def invoice_number
  @invoice_number
end

#license_numberString

License Number.

Returns:

  • (String)


51
52
53
# File 'lib/usps_api/models/international_labels_customs_form.rb', line 51

def license_number
  @license_number
end

#restriction_commentsString

Restriction Comments. Required when ‘restrictionType`=`OTHER`.

Returns:

  • (String)


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

def restriction_comments
  @restriction_comments
end

#restriction_typeRestrictionType

Restriction Types.

* QUARANTINE
* SANITARY_INSPECTION
* PHYTOSANITARY_INSPECTION
* OTHER

Returns:



22
23
24
# File 'lib/usps_api/models/international_labels_customs_form.rb', line 22

def restriction_type
  @restriction_type
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
# File 'lib/usps_api/models/international_labels_customs_form.rb', line 106

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  content_comments =
    hash.key?('contentComments') ? hash['contentComments'] : SKIP
  restriction_type =
    hash.key?('restrictionType') ? hash['restrictionType'] : SKIP
  restriction_comments =
    hash.key?('restrictionComments') ? hash['restrictionComments'] : SKIP
  aesitn = hash.key?('AESITN') ? hash['AESITN'] : SKIP
  invoice_number = hash.key?('invoiceNumber') ? hash['invoiceNumber'] : SKIP
  license_number = hash.key?('licenseNumber') ? hash['licenseNumber'] : SKIP
  certificate_number =
    hash.key?('certificateNumber') ? hash['certificateNumber'] : 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.
  InternationalLabelsCustomsForm.new(content_comments: content_comments,
                                     restriction_type: restriction_type,
                                     restriction_comments: restriction_comments,
                                     aesitn: aesitn,
                                     invoice_number: invoice_number,
                                     license_number: license_number,
                                     certificate_number: certificate_number,
                                     additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



58
59
60
61
62
63
64
65
66
67
68
# File 'lib/usps_api/models/international_labels_customs_form.rb', line 58

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['content_comments'] = 'contentComments'
  @_hash['restriction_type'] = 'restrictionType'
  @_hash['restriction_comments'] = 'restrictionComments'
  @_hash['aesitn'] = 'AESITN'
  @_hash['invoice_number'] = 'invoiceNumber'
  @_hash['license_number'] = 'licenseNumber'
  @_hash['certificate_number'] = 'certificateNumber'
  @_hash
end

.nullablesObject

An array for nullable fields



84
85
86
# File 'lib/usps_api/models/international_labels_customs_form.rb', line 84

def self.nullables
  []
end

.optionalsObject

An array for optional fields



71
72
73
74
75
76
77
78
79
80
81
# File 'lib/usps_api/models/international_labels_customs_form.rb', line 71

def self.optionals
  %w[
    content_comments
    restriction_type
    restriction_comments
    aesitn
    invoice_number
    license_number
    certificate_number
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



151
152
153
154
155
156
157
158
# File 'lib/usps_api/models/international_labels_customs_form.rb', line 151

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} content_comments: #{@content_comments.inspect}, restriction_type:"\
  " #{@restriction_type.inspect}, restriction_comments: #{@restriction_comments.inspect},"\
  " aesitn: #{@aesitn.inspect}, invoice_number: #{@invoice_number.inspect}, license_number:"\
  " #{@license_number.inspect}, certificate_number: #{@certificate_number.inspect},"\
  " additional_properties: #{@additional_properties}>"
end

#to_sObject

Provides a human-readable string representation of the object.



141
142
143
144
145
146
147
148
# File 'lib/usps_api/models/international_labels_customs_form.rb', line 141

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} content_comments: #{@content_comments}, restriction_type:"\
  " #{@restriction_type}, restriction_comments: #{@restriction_comments}, aesitn: #{@aesitn},"\
  " invoice_number: #{@invoice_number}, license_number: #{@license_number},"\
  " certificate_number: #{@certificate_number}, additional_properties:"\
  " #{@additional_properties}>"
end