Class: UspsApi::ReturnPackageResponse
- Defined in:
- lib/usps_api/models/return_package_response.rb
Overview
ReturnPackageResponse Model.
Instance Attribute Summary collapse
-
#label_broker_qr ⇒ String
The Label Broker QR Code image, Base64 encoded file contents.
-
#return_label_image ⇒ String
Contains the Base64-encoded file contents of the return label image.
-
#return_label_metadata ⇒ ReturnLabelMetadata
Return Label Metadata.
-
#return_receipt_image ⇒ String
Contains the Base64-encoded file contents of the return receipt image.
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(return_label_metadata: SKIP, return_label_image: SKIP, return_receipt_image: SKIP, label_broker_qr: SKIP) ⇒ ReturnPackageResponse
constructor
A new instance of ReturnPackageResponse.
-
#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(return_label_metadata: SKIP, return_label_image: SKIP, return_receipt_image: SKIP, label_broker_qr: SKIP) ⇒ ReturnPackageResponse
Returns a new instance of ReturnPackageResponse.
66 67 68 69 70 71 72 |
# File 'lib/usps_api/models/return_package_response.rb', line 66 def initialize(return_label_metadata: SKIP, return_label_image: SKIP, return_receipt_image: SKIP, label_broker_qr: SKIP) @return_label_metadata = unless == SKIP @return_label_image = return_label_image unless return_label_image == SKIP @return_receipt_image = return_receipt_image unless return_receipt_image == SKIP @label_broker_qr = label_broker_qr unless label_broker_qr == SKIP end |
Instance Attribute Details
#label_broker_qr ⇒ String
The Label Broker QR Code image, Base64 encoded file contents. Only provided if ‘imageType` in the `imageInfo` is set to `LABEL_BROKER`.
39 40 41 |
# File 'lib/usps_api/models/return_package_response.rb', line 39 def label_broker_qr @label_broker_qr end |
#return_label_image ⇒ String
Contains the Base64-encoded file contents of the return label image. Provided only when ‘imageInfo.imageType` is not `NONE`. Note:
-
Not provided when Extra Service Code ‘415 - USPS Label Delivery` is
requested, as no images are returned for this service.
22 23 24 |
# File 'lib/usps_api/models/return_package_response.rb', line 22 def return_label_image @return_label_image end |
#return_label_metadata ⇒ ReturnLabelMetadata
Return Label Metadata
14 15 16 |
# File 'lib/usps_api/models/return_package_response.rb', line 14 def @return_label_metadata end |
#return_receipt_image ⇒ String
Contains the Base64-encoded file contents of the return receipt image. Provided only when ‘imageInfo.receiptOption` is `SEPARATE_PAGE`. Note:
-
When ‘imageInfo.imageType` is `ZPL203DPI` or `ZPL300DPI` and
‘imageInfo.receiptOption` is `SEPARATE_PAGE`, the receipt will be returned as an additional label segment within the single ZPL payload in `labelImage`. In this case, `receiptImage` will not be populated.
-
Not provided when Extra Service Code ‘415 - USPS Label Delivery` is
requested, as no images are returned for this service.
34 35 36 |
# File 'lib/usps_api/models/return_package_response.rb', line 34 def return_receipt_image @return_receipt_image end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 |
# File 'lib/usps_api/models/return_package_response.rb', line 75 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. = ReturnLabelMetadata.from_hash(hash['returnLabelMetadata']) if hash['returnLabelMetadata'] return_label_image = hash.key?('returnLabelImage') ? hash['returnLabelImage'] : SKIP return_receipt_image = hash.key?('returnReceiptImage') ? hash['returnReceiptImage'] : SKIP label_broker_qr = hash.key?('labelBrokerQR') ? hash['labelBrokerQR'] : SKIP # Create object from extracted values. ReturnPackageResponse.new(return_label_metadata: , return_label_image: return_label_image, return_receipt_image: return_receipt_image, label_broker_qr: label_broker_qr) end |
.names ⇒ Object
A mapping from model property names to API property names.
42 43 44 45 46 47 48 49 |
# File 'lib/usps_api/models/return_package_response.rb', line 42 def self.names @_hash = {} if @_hash.nil? @_hash['return_label_metadata'] = 'returnLabelMetadata' @_hash['return_label_image'] = 'returnLabelImage' @_hash['return_receipt_image'] = 'returnReceiptImage' @_hash['label_broker_qr'] = 'labelBrokerQR' @_hash end |
.nullables ⇒ Object
An array for nullable fields
62 63 64 |
# File 'lib/usps_api/models/return_package_response.rb', line 62 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
52 53 54 55 56 57 58 59 |
# File 'lib/usps_api/models/return_package_response.rb', line 52 def self.optionals %w[ return_label_metadata return_label_image return_receipt_image label_broker_qr ] end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
104 105 106 107 108 109 |
# File 'lib/usps_api/models/return_package_response.rb', line 104 def inspect class_name = self.class.name.split('::').last "<#{class_name} return_label_metadata: #{@return_label_metadata.inspect},"\ " return_label_image: #{@return_label_image.inspect}, return_receipt_image:"\ " #{@return_receipt_image.inspect}, label_broker_qr: #{@label_broker_qr.inspect}>" end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
96 97 98 99 100 101 |
# File 'lib/usps_api/models/return_package_response.rb', line 96 def to_s class_name = self.class.name.split('::').last "<#{class_name} return_label_metadata: #{@return_label_metadata}, return_label_image:"\ " #{@return_label_image}, return_receipt_image: #{@return_receipt_image}, label_broker_qr:"\ " #{@label_broker_qr}>" end |