Class: UspsApi::UnpaidPackagesDetails
- Defined in:
- lib/usps_api/models/unpaid_packages_details.rb
Overview
Details on unpaid packages that will be or have been issued to a customer account. Fields will only be provided if they differed from the original manifested data.
Instance Attribute Summary collapse
-
#crid ⇒ String
The Customer Registration ID associated with the subscription.
-
#mid ⇒ String
Mailer Identifier.
-
#pic ⇒ String
Package Identification Code, parsed from the IMpb.
-
#scan_date_time ⇒ DateTime
The date and time which the barcode of a package was scanned and no matching payment documentation was found.
-
#service_type_code ⇒ String
The service Type Code of the mail piece.
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(pic: SKIP, crid: SKIP, mid: SKIP, service_type_code: SKIP, scan_date_time: SKIP, additional_properties: nil) ⇒ UnpaidPackagesDetails
constructor
A new instance of UnpaidPackagesDetails.
-
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
- #to_custom_scan_date_time ⇒ Object
-
#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(pic: SKIP, crid: SKIP, mid: SKIP, service_type_code: SKIP, scan_date_time: SKIP, additional_properties: nil) ⇒ UnpaidPackagesDetails
Returns a new instance of UnpaidPackagesDetails.
67 68 69 70 71 72 73 74 75 76 77 78 |
# File 'lib/usps_api/models/unpaid_packages_details.rb', line 67 def initialize(pic: SKIP, crid: SKIP, mid: SKIP, service_type_code: SKIP, scan_date_time: SKIP, additional_properties: nil) # Add additional model properties to the instance additional_properties = {} if additional_properties.nil? @pic = pic unless pic == SKIP @crid = crid unless crid == SKIP @mid = mid unless mid == SKIP @service_type_code = service_type_code unless service_type_code == SKIP @scan_date_time = scan_date_time unless scan_date_time == SKIP @additional_properties = additional_properties end |
Instance Attribute Details
#crid ⇒ String
The Customer Registration ID associated with the subscription.
21 22 23 |
# File 'lib/usps_api/models/unpaid_packages_details.rb', line 21 def crid @crid end |
#mid ⇒ String
Mailer Identifier. A field within a field within the Intelligent Mail barcode that is used to identify mailers. MIDs are assigned by the USPS to a Mail Owner, Mailing Agent or other service providers who request them.
27 28 29 |
# File 'lib/usps_api/models/unpaid_packages_details.rb', line 27 def mid @mid end |
#pic ⇒ String
Package Identification Code, parsed from the IMpb.
17 18 19 |
# File 'lib/usps_api/models/unpaid_packages_details.rb', line 17 def pic @pic end |
#scan_date_time ⇒ DateTime
The date and time which the barcode of a package was scanned and no matching payment documentation was found.
38 39 40 |
# File 'lib/usps_api/models/unpaid_packages_details.rb', line 38 def scan_date_time @scan_date_time end |
#service_type_code ⇒ String
The service Type Code of the mail piece. Refer to the lookup table for all the possible values. USPS Pub 199 Appendix I: Intelligent Mail Package Barcode Service Type Codes
33 34 35 |
# File 'lib/usps_api/models/unpaid_packages_details.rb', line 33 def service_type_code @service_type_code end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 |
# File 'lib/usps_api/models/unpaid_packages_details.rb', line 81 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. pic = hash.key?('PIC') ? hash['PIC'] : SKIP crid = hash.key?('CRID') ? hash['CRID'] : SKIP mid = hash.key?('MID') ? hash['MID'] : SKIP service_type_code = hash.key?('serviceTypeCode') ? hash['serviceTypeCode'] : SKIP scan_date_time = if hash.key?('scanDateTime') (DateTimeHelper.from_rfc3339(hash['scanDateTime']) if hash['scanDateTime']) else SKIP end # 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. UnpaidPackagesDetails.new(pic: pic, crid: crid, mid: mid, service_type_code: service_type_code, scan_date_time: scan_date_time, additional_properties: additional_properties) end |
.names ⇒ Object
A mapping from model property names to API property names.
41 42 43 44 45 46 47 48 49 |
# File 'lib/usps_api/models/unpaid_packages_details.rb', line 41 def self.names @_hash = {} if @_hash.nil? @_hash['pic'] = 'PIC' @_hash['crid'] = 'CRID' @_hash['mid'] = 'MID' @_hash['service_type_code'] = 'serviceTypeCode' @_hash['scan_date_time'] = 'scanDateTime' @_hash end |
.nullables ⇒ Object
An array for nullable fields
63 64 65 |
# File 'lib/usps_api/models/unpaid_packages_details.rb', line 63 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
52 53 54 55 56 57 58 59 60 |
# File 'lib/usps_api/models/unpaid_packages_details.rb', line 52 def self.optionals %w[ pic crid mid service_type_code scan_date_time ] end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
125 126 127 128 129 130 |
# File 'lib/usps_api/models/unpaid_packages_details.rb', line 125 def inspect class_name = self.class.name.split('::').last "<#{class_name} pic: #{@pic.inspect}, crid: #{@crid.inspect}, mid: #{@mid.inspect},"\ " service_type_code: #{@service_type_code.inspect}, scan_date_time:"\ " #{@scan_date_time.inspect}, additional_properties: #{@additional_properties}>" end |
#to_custom_scan_date_time ⇒ Object
112 113 114 |
# File 'lib/usps_api/models/unpaid_packages_details.rb', line 112 def to_custom_scan_date_time DateTimeHelper.to_rfc3339(scan_date_time) end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
117 118 119 120 121 122 |
# File 'lib/usps_api/models/unpaid_packages_details.rb', line 117 def to_s class_name = self.class.name.split('::').last "<#{class_name} pic: #{@pic}, crid: #{@crid}, mid: #{@mid}, service_type_code:"\ " #{@service_type_code}, scan_date_time: #{@scan_date_time}, additional_properties:"\ " #{@additional_properties}>" end |