Class: UspsApi::LabelsCustomsForm1

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

Overview

Domestic Returns Custom Form

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, customs_content_type: SKIP, importers_reference: SKIP, importers_contact: SKIP, exporters_reference: SKIP, exporters_contact: SKIP, contents: SKIP, additional_properties: nil) ⇒ LabelsCustomsForm1

Returns a new instance of LabelsCustomsForm1.



142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
# File 'lib/usps_api/models/labels_customs_form1.rb', line 142

def initialize(content_comments: SKIP, restriction_type: SKIP,
               restriction_comments: SKIP, aesitn: SKIP,
               invoice_number: SKIP, license_number: SKIP,
               certificate_number: SKIP, customs_content_type: SKIP,
               importers_reference: SKIP, importers_contact: SKIP,
               exporters_reference: SKIP, exporters_contact: SKIP,
               contents: 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
  @customs_content_type = customs_content_type unless customs_content_type == SKIP
  @importers_reference = importers_reference unless importers_reference == SKIP
  @importers_contact = importers_contact unless importers_contact == SKIP
  @exporters_reference = exporters_reference unless exporters_reference == SKIP
  @exporters_contact = exporters_contact unless exporters_contact == SKIP
  @contents = contents unless contents == SKIP
  @additional_properties = additional_properties
end

Instance Attribute Details

#aesitnString

AES/ITN Exemption should be populated with the electronic export internal transaction number (if required), or the appropriate Exemption/Exclusion Legend.

  • **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)


45
46
47
# File 'lib/usps_api/models/labels_customs_form1.rb', line 45

def aesitn
  @aesitn
end

#certificate_numberString

Certificate Number

Returns:

  • (String)


57
58
59
# File 'lib/usps_api/models/labels_customs_form1.rb', line 57

def certificate_number
  @certificate_number
end

#content_commentsString

Required when customContentType is OTHER.

Returns:

  • (String)


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

def content_comments
  @content_comments
end

#contentsArray[LabelsCustomsFormPackageContents]

Details of the contents of the package. The first five items will print on the label of the customs form, and the rest will print on a separate continuation page.



97
98
99
# File 'lib/usps_api/models/labels_customs_form1.rb', line 97

def contents
  @contents
end

#customs_content_typeCustomsContentType1

Specifies the content of the package or envelope.

* MERCHANDISE
* GIFT
* DOCUMENT
* COMMERCIAL_SAMPLE
* RETURNED_GOODS
* OTHER
* HUMANITARIAN_DONATIONS
* DANGEROUS_GOODS

Returns:



69
70
71
# File 'lib/usps_api/models/labels_customs_form1.rb', line 69

def customs_content_type
  @customs_content_type
end

#exporters_contactString

Exporters Contact. Enter, if known, the Exporter’s telephone number, fax number, or email address, as such information might facilitate customs clearance or delivery.

Returns:

  • (String)


91
92
93
# File 'lib/usps_api/models/labels_customs_form1.rb', line 91

def exporters_contact
  @exporters_contact
end

#exporters_referenceString

Exporters Reference. The Exporter’s Reference might be a tax code, importer code, or VAT number used for sales tax.

Returns:

  • (String)


85
86
87
# File 'lib/usps_api/models/labels_customs_form1.rb', line 85

def exporters_reference
  @exporters_reference
end

#importers_contactString

Importers Contact. Enter, if known, the Importer’s telephone number, fax number, or email address, as such information might facilitate customs clearance or delivery.

Returns:

  • (String)


80
81
82
# File 'lib/usps_api/models/labels_customs_form1.rb', line 80

def importers_contact
  @importers_contact
end

#importers_referenceString

Importers Reference. The Importer’s Reference might be a tax code, importer code, or VAT number used for sales tax.

Returns:

  • (String)


74
75
76
# File 'lib/usps_api/models/labels_customs_form1.rb', line 74

def importers_reference
  @importers_reference
end

#invoice_numberString

Invoice Number

Returns:

  • (String)


49
50
51
# File 'lib/usps_api/models/labels_customs_form1.rb', line 49

def invoice_number
  @invoice_number
end

#license_numberString

License Number

Returns:

  • (String)


53
54
55
# File 'lib/usps_api/models/labels_customs_form1.rb', line 53

def license_number
  @license_number
end

#restriction_commentsString

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

Returns:

  • (String)


26
27
28
# File 'lib/usps_api/models/labels_customs_form1.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/labels_customs_form1.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.



169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
# File 'lib/usps_api/models/labels_customs_form1.rb', line 169

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
  customs_content_type =
    hash.key?('customsContentType') ? hash['customsContentType'] : SKIP
  importers_reference =
    hash.key?('importersReference') ? hash['importersReference'] : SKIP
  importers_contact =
    hash.key?('importersContact') ? hash['importersContact'] : SKIP
  exporters_reference =
    hash.key?('exportersReference') ? hash['exportersReference'] : SKIP
  exporters_contact =
    hash.key?('exportersContact') ? hash['exportersContact'] : SKIP
  # Parameter is an array, so we need to iterate through it
  contents = nil
  unless hash['contents'].nil?
    contents = []
    hash['contents'].each do |structure|
      contents << (LabelsCustomsFormPackageContents.from_hash(structure) if structure)
    end
  end

  contents = SKIP unless hash.key?('contents')

  # 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.
  LabelsCustomsForm1.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,
                         customs_content_type: customs_content_type,
                         importers_reference: importers_reference,
                         importers_contact: importers_contact,
                         exporters_reference: exporters_reference,
                         exporters_contact: exporters_contact,
                         contents: contents,
                         additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
# File 'lib/usps_api/models/labels_customs_form1.rb', line 100

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['customs_content_type'] = 'customsContentType'
  @_hash['importers_reference'] = 'importersReference'
  @_hash['importers_contact'] = 'importersContact'
  @_hash['exporters_reference'] = 'exportersReference'
  @_hash['exporters_contact'] = 'exportersContact'
  @_hash['contents'] = 'contents'
  @_hash
end

.nullablesObject

An array for nullable fields



138
139
140
# File 'lib/usps_api/models/labels_customs_form1.rb', line 138

def self.nullables
  []
end

.optionalsObject

An array for optional fields



119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
# File 'lib/usps_api/models/labels_customs_form1.rb', line 119

def self.optionals
  %w[
    content_comments
    restriction_type
    restriction_comments
    aesitn
    invoice_number
    license_number
    certificate_number
    customs_content_type
    importers_reference
    importers_contact
    exporters_reference
    exporters_contact
    contents
  ]
end

.validate(value) ⇒ Object

Validates an instance of the object from a given value.

Parameters:



231
232
233
234
235
236
237
# File 'lib/usps_api/models/labels_customs_form1.rb', line 231

def self.validate(value)
  return true if value.instance_of? self

  return false unless value.instance_of? Hash

  true
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



253
254
255
256
257
258
259
260
261
262
263
264
# File 'lib/usps_api/models/labels_customs_form1.rb', line 253

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},"\
  " customs_content_type: #{@customs_content_type.inspect}, importers_reference:"\
  " #{@importers_reference.inspect}, importers_contact: #{@importers_contact.inspect},"\
  " exporters_reference: #{@exporters_reference.inspect}, exporters_contact:"\
  " #{@exporters_contact.inspect}, contents: #{@contents.inspect}, additional_properties:"\
  " #{@additional_properties}>"
end

#to_sObject

Provides a human-readable string representation of the object.



240
241
242
243
244
245
246
247
248
249
250
# File 'lib/usps_api/models/labels_customs_form1.rb', line 240

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}, customs_content_type:"\
  " #{@customs_content_type}, importers_reference: #{@importers_reference}, importers_contact:"\
  " #{@importers_contact}, exporters_reference: #{@exporters_reference}, exporters_contact:"\
  " #{@exporters_contact}, contents: #{@contents}, additional_properties:"\
  " #{@additional_properties}>"
end