Class: UspsApi::ScanFormMetaData
- Defined in:
- lib/usps_api/models/scan_form_meta_data.rb
Overview
Metadata for the scan form
Instance Attribute Summary collapse
-
#destination_entry_facility_type ⇒ DestinationEntryFacilityType1
Specifies the type of facility the mailpieces are being entered at.
-
#entry_facility_zip_code ⇒ String
The ZIP code of the destination entry facility.
-
#form ⇒ Form
This field has been deprecated.
-
#from_address ⇒ ScanFormAddress
Location of the Shipper.
-
#image_info ⇒ ScanFormsImageInfo
Characteristics of the type of SCAN Form being requested.
-
#image_type ⇒ DeprecatedImageType
This field has been deprecated.
-
#label_type ⇒ DeprecatedLabelTypeResponse
This field has been deprecated.
-
#mailing_date ⇒ Date
The date of mailing.
-
#manifest_number ⇒ String
The Electronic File Number (EFN) stored in the Shipping Services File that represents all the tracking numbers associated to a shipment.
-
#overwrite_mailing_date ⇒ TrueClass | FalseClass
Label Mailing Date Overwrite option.
-
#shipment ⇒ Object
SCAN Form shipment method used to populate tracking numbers into the SCAN FOrm.
-
#tracking_numbers ⇒ Array[String]
Tracking numbers that were added to the SCAN Form.
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(image_info: SKIP, form: Form::ENUM_5630, image_type: DeprecatedImageType::PDF, label_type: DeprecatedLabelTypeResponse::ENUM_85X11LABEL, mailing_date: SKIP, overwrite_mailing_date: false, entry_facility_zip_code: SKIP, destination_entry_facility_type: SKIP, shipment: SKIP, manifest_number: SKIP, tracking_numbers: SKIP, from_address: SKIP, additional_properties: nil) ⇒ ScanFormMetaData
constructor
A new instance of ScanFormMetaData.
-
#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(image_info: SKIP, form: Form::ENUM_5630, image_type: DeprecatedImageType::PDF, label_type: DeprecatedLabelTypeResponse::ENUM_85X11LABEL, mailing_date: SKIP, overwrite_mailing_date: false, entry_facility_zip_code: SKIP, destination_entry_facility_type: SKIP, shipment: SKIP, manifest_number: SKIP, tracking_numbers: SKIP, from_address: SKIP, additional_properties: nil) ⇒ ScanFormMetaData
Returns a new instance of ScanFormMetaData.
122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 |
# File 'lib/usps_api/models/scan_form_meta_data.rb', line 122 def initialize(image_info: SKIP, form: Form::ENUM_5630, image_type: DeprecatedImageType::PDF, label_type: DeprecatedLabelTypeResponse::ENUM_85X11LABEL, mailing_date: SKIP, overwrite_mailing_date: false, entry_facility_zip_code: SKIP, destination_entry_facility_type: SKIP, shipment: SKIP, manifest_number: SKIP, tracking_numbers: SKIP, from_address: SKIP, additional_properties: nil) # Add additional model properties to the instance additional_properties = {} if additional_properties.nil? @image_info = image_info unless image_info == SKIP @form = form unless form == SKIP @image_type = image_type unless image_type == SKIP @label_type = label_type unless label_type == SKIP @mailing_date = mailing_date unless mailing_date == SKIP @overwrite_mailing_date = overwrite_mailing_date unless overwrite_mailing_date == SKIP @entry_facility_zip_code = entry_facility_zip_code unless entry_facility_zip_code == SKIP unless destination_entry_facility_type == SKIP @destination_entry_facility_type = destination_entry_facility_type end @shipment = shipment unless shipment == SKIP @manifest_number = manifest_number unless manifest_number == SKIP @tracking_numbers = tracking_numbers unless tracking_numbers == SKIP @from_address = from_address unless from_address == SKIP @additional_properties = additional_properties end |
Instance Attribute Details
#destination_entry_facility_type ⇒ DestinationEntryFacilityType1
Specifies the type of facility the mailpieces are being entered at. All mailpieces on a single SCAN Form must be entered at the same facility and facility type. A value of ‘NONE` cannot be used when shipping Parcel Select or USPS Connect Local items.
54 55 56 |
# File 'lib/usps_api/models/scan_form_meta_data.rb', line 54 def destination_entry_facility_type @destination_entry_facility_type end |
#entry_facility_zip_code ⇒ String
The ZIP code of the destination entry facility.
47 48 49 |
# File 'lib/usps_api/models/scan_form_meta_data.rb', line 47 def entry_facility_zip_code @entry_facility_zip_code end |
#form ⇒ Form
This field has been deprecated. The type of SCAN Form will be dictated by the ‘imageInfo.labelType` requested.
19 20 21 |
# File 'lib/usps_api/models/scan_form_meta_data.rb', line 19 def form @form end |
#from_address ⇒ ScanFormAddress
Location of the Shipper. Only domestic addresses are supported for this API. Note:
-
The ‘firstName` and `lastName` or `firm` are always required.
78 79 80 |
# File 'lib/usps_api/models/scan_form_meta_data.rb', line 78 def from_address @from_address end |
#image_info ⇒ ScanFormsImageInfo
Characteristics of the type of SCAN Form being requested.
14 15 16 |
# File 'lib/usps_api/models/scan_form_meta_data.rb', line 14 def image_info @image_info end |
#image_type ⇒ DeprecatedImageType
This field has been deprecated. ‘imageType` can be updated through `imageInfo.imageType`.
24 25 26 |
# File 'lib/usps_api/models/scan_form_meta_data.rb', line 24 def image_type @image_type end |
#label_type ⇒ DeprecatedLabelTypeResponse
This field has been deprecated. ‘labelType` can be updated through `imageInfo.labelType`.
29 30 31 |
# File 'lib/usps_api/models/scan_form_meta_data.rb', line 29 def label_type @label_type end |
#mailing_date ⇒ Date
The date of mailing. The date when the items in the associated SCAN Form will be dropped off at the Entry Facility.
34 35 36 |
# File 'lib/usps_api/models/scan_form_meta_data.rb', line 34 def mailing_date @mailing_date end |
#manifest_number ⇒ String
The Electronic File Number (EFN) stored in the Shipping Services File that represents all the tracking numbers associated to a shipment.
64 65 66 |
# File 'lib/usps_api/models/scan_form_meta_data.rb', line 64 def manifest_number @manifest_number end |
#overwrite_mailing_date ⇒ TrueClass | FalseClass
Label Mailing Date Overwrite option. If this value is set to ‘true`, the mailing dates for the packages contained within the SCAN Form will be overwritten with the `mailingDate` value provided in the SCAN Form request. If this value is set to `false`, the mailing dates for the packages contained within the SCAN Form will not be updated and will use the values initially provided in the Label request.
43 44 45 |
# File 'lib/usps_api/models/scan_form_meta_data.rb', line 43 def overwrite_mailing_date @overwrite_mailing_date end |
#shipment ⇒ Object
SCAN Form shipment method used to populate tracking numbers into the SCAN FOrm.
59 60 61 |
# File 'lib/usps_api/models/scan_form_meta_data.rb', line 59 def shipment @shipment end |
#tracking_numbers ⇒ Array[String]
Tracking numbers that were added to the SCAN Form. For ‘MID` and `manifestMID` Shipment options, only eligible labels matching the `MID` or `manifestMID`, `mailingDate`, `entryFacilityZIPCode`, and `destinationEntryFacilityType` are added.
71 72 73 |
# File 'lib/usps_api/models/scan_form_meta_data.rb', line 71 def tracking_numbers @tracking_numbers end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
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 188 189 190 191 192 193 194 195 196 197 |
# File 'lib/usps_api/models/scan_form_meta_data.rb', line 152 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. image_info = ScanFormsImageInfo.from_hash(hash['imageInfo']) if hash['imageInfo'] form = hash['form'] ||= Form::ENUM_5630 image_type = hash['imageType'] ||= DeprecatedImageType::PDF label_type = hash['labelType'] ||= DeprecatedLabelTypeResponse::ENUM_85X11LABEL mailing_date = hash.key?('mailingDate') ? hash['mailingDate'] : SKIP overwrite_mailing_date = hash['overwriteMailingDate'] ||= false entry_facility_zip_code = hash.key?('entryFacilityZIPCode') ? hash['entryFacilityZIPCode'] : SKIP destination_entry_facility_type = hash.key?('destinationEntryFacilityType') ? hash['destinationEntryFacilityType'] : SKIP shipment = hash.key?('shipment') ? APIHelper.deserialize_union_type( UnionTypeLookUp.get(:ScanFormMetaDataShipment), hash['shipment'] ) : SKIP manifest_number = hash.key?('manifestNumber') ? hash['manifestNumber'] : SKIP tracking_numbers = hash.key?('trackingNumbers') ? hash['trackingNumbers'] : SKIP from_address = ScanFormAddress.from_hash(hash['fromAddress']) if hash['fromAddress'] # 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. ScanFormMetaData.new(image_info: image_info, form: form, image_type: image_type, label_type: label_type, mailing_date: mailing_date, overwrite_mailing_date: overwrite_mailing_date, entry_facility_zip_code: entry_facility_zip_code, destination_entry_facility_type: destination_entry_facility_type, shipment: shipment, manifest_number: manifest_number, tracking_numbers: tracking_numbers, from_address: from_address, additional_properties: additional_properties) end |
.names ⇒ Object
A mapping from model property names to API property names.
81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 |
# File 'lib/usps_api/models/scan_form_meta_data.rb', line 81 def self.names @_hash = {} if @_hash.nil? @_hash['image_info'] = 'imageInfo' @_hash['form'] = 'form' @_hash['image_type'] = 'imageType' @_hash['label_type'] = 'labelType' @_hash['mailing_date'] = 'mailingDate' @_hash['overwrite_mailing_date'] = 'overwriteMailingDate' @_hash['entry_facility_zip_code'] = 'entryFacilityZIPCode' @_hash['destination_entry_facility_type'] = 'destinationEntryFacilityType' @_hash['shipment'] = 'shipment' @_hash['manifest_number'] = 'manifestNumber' @_hash['tracking_numbers'] = 'trackingNumbers' @_hash['from_address'] = 'fromAddress' @_hash end |
.nullables ⇒ Object
An array for nullable fields
118 119 120 |
# File 'lib/usps_api/models/scan_form_meta_data.rb', line 118 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 |
# File 'lib/usps_api/models/scan_form_meta_data.rb', line 100 def self.optionals %w[ image_info form image_type label_type mailing_date overwrite_mailing_date entry_facility_zip_code destination_entry_facility_type shipment manifest_number tracking_numbers from_address ] end |
.validate(value) ⇒ Object
Validates an instance of the object from a given value.
201 202 203 204 205 206 207 |
# File 'lib/usps_api/models/scan_form_meta_data.rb', line 201 def self.validate(value) return true if value.instance_of? self return false unless value.instance_of? Hash true end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
222 223 224 225 226 227 228 229 230 231 232 |
# File 'lib/usps_api/models/scan_form_meta_data.rb', line 222 def inspect class_name = self.class.name.split('::').last "<#{class_name} image_info: #{@image_info.inspect}, form: #{@form.inspect}, image_type:"\ " #{@image_type.inspect}, label_type: #{@label_type.inspect}, mailing_date:"\ " #{@mailing_date.inspect}, overwrite_mailing_date: #{@overwrite_mailing_date.inspect},"\ " entry_facility_zip_code: #{@entry_facility_zip_code.inspect},"\ " destination_entry_facility_type: #{@destination_entry_facility_type.inspect}, shipment:"\ " #{@shipment.inspect}, manifest_number: #{@manifest_number.inspect}, tracking_numbers:"\ " #{@tracking_numbers.inspect}, from_address: #{@from_address.inspect},"\ " additional_properties: #{@additional_properties}>" end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
210 211 212 213 214 215 216 217 218 219 |
# File 'lib/usps_api/models/scan_form_meta_data.rb', line 210 def to_s class_name = self.class.name.split('::').last "<#{class_name} image_info: #{@image_info}, form: #{@form}, image_type: #{@image_type},"\ " label_type: #{@label_type}, mailing_date: #{@mailing_date}, overwrite_mailing_date:"\ " #{@overwrite_mailing_date}, entry_facility_zip_code: #{@entry_facility_zip_code},"\ " destination_entry_facility_type: #{@destination_entry_facility_type}, shipment:"\ " #{@shipment}, manifest_number: #{@manifest_number}, tracking_numbers:"\ " #{@tracking_numbers}, from_address: #{@from_address}, additional_properties:"\ " #{@additional_properties}>" end |