Class: UspsApi::LabelsCustomsForm
- Defined in:
- lib/usps_api/models/labels_customs_form.rb
Overview
Domestic Customs Form
Instance Attribute Summary collapse
-
#aesitn ⇒ String
AES/ITN Exemption should be populated with the electronic export internal transaction number (if required), or the appropriate Exemption/Exclusion Legend.
-
#certificate_number ⇒ String
Certificate Number.
-
#content_comments ⇒ String
Required when customContentType is OTHER.
-
#contents ⇒ Array[LabelsCustomsFormPackageContents]
Details of the contents of the package.
-
#customs_content_type ⇒ CustomsContentType1
Specifies the content of the package or envelope.
-
#exporters_contact ⇒ String
Exporters Contact.
-
#exporters_reference ⇒ String
Exporters Reference.
-
#importers_contact ⇒ String
Importers Contact.
-
#importers_reference ⇒ String
Importers Reference.
-
#invoice_number ⇒ String
Invoice Number.
-
#license_number ⇒ String
License Number.
-
#restriction_comments ⇒ String
Restriction Comments.
-
#restriction_type ⇒ RestrictionType
Restriction Types * QUARANTINE * SANITARY_INSPECTION * PHYTOSANITARY_INSPECTION * OTHER.
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.
-
.validate(value) ⇒ Object
Validates an instance of the object from a given value.
Instance Method Summary collapse
-
#initialize(customs_content_type:, contents:, content_comments: SKIP, restriction_type: SKIP, restriction_comments: SKIP, aesitn: SKIP, invoice_number: SKIP, license_number: SKIP, certificate_number: SKIP, importers_reference: SKIP, importers_contact: SKIP, exporters_reference: SKIP, exporters_contact: SKIP, additional_properties: nil) ⇒ LabelsCustomsForm
constructor
A new instance of LabelsCustomsForm.
-
#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(customs_content_type:, contents:, content_comments: SKIP, restriction_type: SKIP, restriction_comments: SKIP, aesitn: SKIP, invoice_number: SKIP, license_number: SKIP, certificate_number: SKIP, importers_reference: SKIP, importers_contact: SKIP, exporters_reference: SKIP, exporters_contact: SKIP, additional_properties: nil) ⇒ LabelsCustomsForm
Returns a new instance of LabelsCustomsForm.
140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 |
# File 'lib/usps_api/models/labels_customs_form.rb', line 140 def initialize(customs_content_type:, contents:, content_comments: SKIP, restriction_type: SKIP, restriction_comments: SKIP, aesitn: SKIP, invoice_number: SKIP, license_number: SKIP, certificate_number: SKIP, importers_reference: SKIP, importers_contact: SKIP, exporters_reference: SKIP, exporters_contact: 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 @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 @additional_properties = additional_properties end |
Instance Attribute Details
#aesitn ⇒ String
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.
-
**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.
45 46 47 |
# File 'lib/usps_api/models/labels_customs_form.rb', line 45 def aesitn @aesitn end |
#certificate_number ⇒ String
Certificate Number
57 58 59 |
# File 'lib/usps_api/models/labels_customs_form.rb', line 57 def certificate_number @certificate_number end |
#content_comments ⇒ String
Required when customContentType is OTHER.
14 15 16 |
# File 'lib/usps_api/models/labels_customs_form.rb', line 14 def content_comments @content_comments end |
#contents ⇒ Array[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_form.rb', line 97 def contents @contents end |
#customs_content_type ⇒ CustomsContentType1
Specifies the content of the package or envelope.
* MERCHANDISE
* GIFT
* DOCUMENT
* COMMERCIAL_SAMPLE
* RETURNED_GOODS
* OTHER
* HUMANITARIAN_DONATIONS
* DANGEROUS_GOODS
69 70 71 |
# File 'lib/usps_api/models/labels_customs_form.rb', line 69 def customs_content_type @customs_content_type end |
#exporters_contact ⇒ String
Exporters Contact. Enter, if known, the Exporter’s telephone number, fax number, or email address, as such information might facilitate customs clearance or delivery.
91 92 93 |
# File 'lib/usps_api/models/labels_customs_form.rb', line 91 def exporters_contact @exporters_contact end |
#exporters_reference ⇒ String
Exporters Reference. The Exporter’s Reference might be a tax code, importer code, or VAT number used for sales tax.
85 86 87 |
# File 'lib/usps_api/models/labels_customs_form.rb', line 85 def exporters_reference @exporters_reference end |
#importers_contact ⇒ String
Importers Contact. Enter, if known, the Importer’s telephone number, fax number, or email address, as such information might facilitate customs clearance or delivery.
80 81 82 |
# File 'lib/usps_api/models/labels_customs_form.rb', line 80 def importers_contact @importers_contact end |
#importers_reference ⇒ String
Importers Reference. The Importer’s Reference might be a tax code, importer code, or VAT number used for sales tax.
74 75 76 |
# File 'lib/usps_api/models/labels_customs_form.rb', line 74 def importers_reference @importers_reference end |
#invoice_number ⇒ String
Invoice Number
49 50 51 |
# File 'lib/usps_api/models/labels_customs_form.rb', line 49 def invoice_number @invoice_number end |
#license_number ⇒ String
License Number
53 54 55 |
# File 'lib/usps_api/models/labels_customs_form.rb', line 53 def license_number @license_number end |
#restriction_comments ⇒ String
Restriction Comments. Required when ‘restrictionType`=`OTHER`.
26 27 28 |
# File 'lib/usps_api/models/labels_customs_form.rb', line 26 def restriction_comments @restriction_comments end |
#restriction_type ⇒ RestrictionType
Restriction Types
* QUARANTINE
* SANITARY_INSPECTION
* PHYTOSANITARY_INSPECTION
* OTHER
22 23 24 |
# File 'lib/usps_api/models/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.
166 167 168 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 |
# File 'lib/usps_api/models/labels_customs_form.rb', line 166 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. 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 << (LabelsCustomsFormPackageContents.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 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 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 # 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. LabelsCustomsForm.new(customs_content_type: customs_content_type, contents: contents, 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, importers_reference: importers_reference, importers_contact: importers_contact, exporters_reference: exporters_reference, exporters_contact: exporters_contact, additional_properties: additional_properties) end |
.names ⇒ Object
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_form.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 |
.nullables ⇒ Object
An array for nullable fields
136 137 138 |
# File 'lib/usps_api/models/labels_customs_form.rb', line 136 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 |
# File 'lib/usps_api/models/labels_customs_form.rb', line 119 def self.optionals %w[ content_comments restriction_type restriction_comments aesitn invoice_number license_number certificate_number importers_reference importers_contact exporters_reference exporters_contact ] end |
.validate(value) ⇒ Object
Validates an instance of the object from a given value.
228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 |
# File 'lib/usps_api/models/labels_customs_form.rb', line 228 def self.validate(value) if value.instance_of? self return ( APIHelper.valid_type?(value.customs_content_type, ->(val) { CustomsContentType1.validate(val) }) and APIHelper.valid_type?(value.contents, ->(val) { LabelsCustomsFormPackageContents.validate(val) }, is_model_hash: true, is_inner_model_hash: true) ) end return false unless value.instance_of? Hash ( APIHelper.valid_type?(value['customsContentType'], ->(val) { CustomsContentType1.validate(val) }) and APIHelper.valid_type?(value['contents'], ->(val) { LabelsCustomsFormPackageContents.validate(val) }, is_model_hash: true, is_inner_model_hash: true) ) end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
266 267 268 269 270 271 272 273 274 275 276 277 |
# File 'lib/usps_api/models/labels_customs_form.rb', line 266 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_s ⇒ Object
Provides a human-readable string representation of the object.
253 254 255 256 257 258 259 260 261 262 263 |
# File 'lib/usps_api/models/labels_customs_form.rb', line 253 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 |