Class: UspsApi::InternationalCustomsForm
- Inherits:
-
BaseModel
- Object
- CoreLibrary::BaseModel
- BaseModel
- UspsApi::InternationalCustomsForm
- Defined in:
- lib/usps_api/models/international_customs_form.rb
Overview
Customs form information required for international shipments including content type, item details, and references.
Instance Attribute Summary collapse
-
#aesitn ⇒ String
USPS requires the ITN or the Exemption.
-
#certificate_number ⇒ String
Certificate Number.
-
#content_comments ⇒ String
Required when customContentType is OTHER.
-
#contents ⇒ Array[InternationalCustomsFormPackageContents]
Details of the contents of the package.
-
#customs_content_type ⇒ CustomsContentType
Specifies the content of the package or envelope.
-
#exporters_reference ⇒ CustomsReferenceInformation
Reference information for customs processing including tax codes, VAT numbers, importer codes, and contact details.
-
#importers_reference ⇒ CustomsReferenceInformation
Reference information for customs processing including tax codes, VAT numbers, importer codes, and contact details.
-
#invoice_number ⇒ String
Invoice Number.
-
#license_number ⇒ String
License Number.
-
#restriction_comments ⇒ String
Restriction Comments.
-
#restriction_type ⇒ RestrictionType
Restriction Types.
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(aesitn:, customs_content_type:, contents:, content_comments: SKIP, restriction_type: SKIP, restriction_comments: SKIP, invoice_number: SKIP, license_number: SKIP, certificate_number: SKIP, importers_reference: SKIP, exporters_reference: SKIP) ⇒ InternationalCustomsForm
constructor
A new instance of InternationalCustomsForm.
-
#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(aesitn:, customs_content_type:, contents:, content_comments: SKIP, restriction_type: SKIP, restriction_comments: SKIP, invoice_number: SKIP, license_number: SKIP, certificate_number: SKIP, importers_reference: SKIP, exporters_reference: SKIP) ⇒ InternationalCustomsForm
Returns a new instance of InternationalCustomsForm.
124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 |
# File 'lib/usps_api/models/international_customs_form.rb', line 124 def initialize(aesitn:, customs_content_type:, contents:, content_comments: SKIP, restriction_type: SKIP, restriction_comments: SKIP, invoice_number: SKIP, license_number: SKIP, certificate_number: SKIP, importers_reference: SKIP, exporters_reference: SKIP) @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 @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 @importers_reference = importers_reference unless importers_reference == SKIP @exporters_reference = exporters_reference unless exporters_reference == SKIP @contents = contents end |
Instance Attribute Details
#aesitn ⇒ String
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.
-
**EEL- Exemptions, Exclusions, Legend**\ An [AES exemption](pe.usps.com/text/imm/immc5_012.htm) is an
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.
44 45 46 |
# File 'lib/usps_api/models/international_customs_form.rb', line 44 def aesitn @aesitn end |
#certificate_number ⇒ String
Certificate Number.
56 57 58 |
# File 'lib/usps_api/models/international_customs_form.rb', line 56 def certificate_number @certificate_number end |
#content_comments ⇒ String
Required when customContentType is OTHER.
15 16 17 |
# File 'lib/usps_api/models/international_customs_form.rb', line 15 def content_comments @content_comments end |
#contents ⇒ Array[InternationalCustomsFormPackageContents]
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. Note:
-
One of either ‘itemValue` and `itemWeight` or `itemTotalValue` and
‘itemTotalWeight` are required.
86 87 88 |
# File 'lib/usps_api/models/international_customs_form.rb', line 86 def contents @contents end |
#customs_content_type ⇒ CustomsContentType
Specifies the content of the package or envelope. Note:
-
‘CREMATED_REMAINS` is only supported by mailClass
‘PRIORITY_MAIL_EXPRESS_INTERNATIONAL`
-
Customs Content Type must be ‘DANGEROUS_GOODS` when using any of the
following extra services:
* 813 - HAZMAT Class 7 - Radioactive Materials Package
* 826 - HAZMAT Division 6.2 – Infectious Substances Package
67 68 69 |
# File 'lib/usps_api/models/international_customs_form.rb', line 67 def customs_content_type @customs_content_type end |
#exporters_reference ⇒ CustomsReferenceInformation
Reference information for customs processing including tax codes, VAT numbers, importer codes, and contact details.
77 78 79 |
# File 'lib/usps_api/models/international_customs_form.rb', line 77 def exporters_reference @exporters_reference end |
#importers_reference ⇒ CustomsReferenceInformation
Reference information for customs processing including tax codes, VAT numbers, importer codes, and contact details.
72 73 74 |
# File 'lib/usps_api/models/international_customs_form.rb', line 72 def importers_reference @importers_reference end |
#invoice_number ⇒ String
Invoice Number.
48 49 50 |
# File 'lib/usps_api/models/international_customs_form.rb', line 48 def invoice_number @invoice_number end |
#license_number ⇒ String
License Number.
52 53 54 |
# File 'lib/usps_api/models/international_customs_form.rb', line 52 def license_number @license_number end |
#restriction_comments ⇒ String
Restriction Comments. Required when ‘restrictionType`=`OTHER`.
27 28 29 |
# File 'lib/usps_api/models/international_customs_form.rb', line 27 def restriction_comments @restriction_comments end |
#restriction_type ⇒ RestrictionType
Restriction Types.
* QUARANTINE
* SANITARY_INSPECTION
* PHYTOSANITARY_INSPECTION
* OTHER
23 24 25 |
# File 'lib/usps_api/models/international_customs_form.rb', line 23 def restriction_type @restriction_type end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 |
# File 'lib/usps_api/models/international_customs_form.rb', line 143 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. aesitn = hash.key?('AESITN') ? hash['AESITN'] : nil customs_content_type = hash.key?('customsContentType') ? hash['customsContentType'] : nil # Parameter is an array, so we need to iterate through it contents = nil unless hash['contents'].nil? contents = [] hash['contents'].each do |structure| contents << (InternationalCustomsFormPackageContents.from_hash(structure) if structure) end end contents = nil unless hash.key?('contents') content_comments = hash.key?('contentComments') ? hash['contentComments'] : SKIP restriction_type = hash.key?('restrictionType') ? hash['restrictionType'] : SKIP restriction_comments = hash.key?('restrictionComments') ? hash['restrictionComments'] : 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 importers_reference = CustomsReferenceInformation.from_hash(hash['importersReference']) if hash['importersReference'] exporters_reference = CustomsReferenceInformation.from_hash(hash['exportersReference']) if hash['exportersReference'] # Create object from extracted values. InternationalCustomsForm.new(aesitn: aesitn, customs_content_type: customs_content_type, contents: contents, content_comments: content_comments, restriction_type: restriction_type, restriction_comments: restriction_comments, invoice_number: invoice_number, license_number: license_number, certificate_number: certificate_number, importers_reference: importers_reference, exporters_reference: exporters_reference) end |
.names ⇒ Object
A mapping from model property names to API property names.
89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 |
# File 'lib/usps_api/models/international_customs_form.rb', line 89 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['exporters_reference'] = 'exportersReference' @_hash['contents'] = 'contents' @_hash end |
.nullables ⇒ Object
An array for nullable fields
120 121 122 |
# File 'lib/usps_api/models/international_customs_form.rb', line 120 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
106 107 108 109 110 111 112 113 114 115 116 117 |
# File 'lib/usps_api/models/international_customs_form.rb', line 106 def self.optionals %w[ content_comments restriction_type restriction_comments invoice_number license_number certificate_number importers_reference exporters_reference ] end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
201 202 203 204 205 206 207 208 209 210 |
# File 'lib/usps_api/models/international_customs_form.rb', line 201 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}, exporters_reference: #{@exporters_reference.inspect},"\ " contents: #{@contents.inspect}>" end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
190 191 192 193 194 195 196 197 198 |
# File 'lib/usps_api/models/international_customs_form.rb', line 190 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},"\ " exporters_reference: #{@exporters_reference}, contents: #{@contents}>" end |