Class: UspsApi::LabelPackageResponse1
- Defined in:
- lib/usps_api/models/label_package_response1.rb
Overview
LabelPackageResponse1 Model.
Instance Attribute Summary collapse
-
#label_broker_qr ⇒ String
The Label Broker QR Code image, Base64 encoded file contents.
-
#label_image ⇒ String
Contains the Base64-encoded file contents of the label image.
-
#label_metadata ⇒ LabelMetadata
Label Metadata returned from label creation and label edit.
-
#receipt_image ⇒ String
Contains the Base64-encoded file contents of the label receipt image.
-
#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(label_metadata: SKIP, return_label_metadata: SKIP, label_image: SKIP, receipt_image: SKIP, return_label_image: SKIP, return_receipt_image: SKIP, label_broker_qr: SKIP) ⇒ LabelPackageResponse1
constructor
A new instance of LabelPackageResponse1.
-
#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(label_metadata: SKIP, return_label_metadata: SKIP, label_image: SKIP, receipt_image: SKIP, return_label_image: SKIP, return_receipt_image: SKIP, label_broker_qr: SKIP) ⇒ LabelPackageResponse1
Returns a new instance of LabelPackageResponse1.
93 94 95 96 97 98 99 100 101 102 103 104 |
# File 'lib/usps_api/models/label_package_response1.rb', line 93 def initialize(label_metadata: SKIP, return_label_metadata: SKIP, label_image: SKIP, receipt_image: SKIP, return_label_image: SKIP, return_receipt_image: SKIP, label_broker_qr: SKIP) @label_metadata = unless == SKIP @return_label_metadata = unless == SKIP @label_image = label_image unless label_image == SKIP @receipt_image = receipt_image unless receipt_image == 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`.
60 61 62 |
# File 'lib/usps_api/models/label_package_response1.rb', line 60 def label_broker_qr @label_broker_qr end |
#label_image ⇒ String
Contains the Base64-encoded file contents of the 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.
26 27 28 |
# File 'lib/usps_api/models/label_package_response1.rb', line 26 def label_image @label_image end |
#label_metadata ⇒ LabelMetadata
Label Metadata returned from label creation and label edit.
14 15 16 |
# File 'lib/usps_api/models/label_package_response1.rb', line 14 def @label_metadata end |
#receipt_image ⇒ String
Contains the Base64-encoded file contents of the label 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.
38 39 40 |
# File 'lib/usps_api/models/label_package_response1.rb', line 38 def receipt_image @receipt_image end |
#return_label_image ⇒ String
Contains the Base64-encoded file contents of the return label image. Provided only when ‘imageInfo.returnLabel` is `true` and `imageInfo.imageType` is not `NONE`.
44 45 46 |
# File 'lib/usps_api/models/label_package_response1.rb', line 44 def return_label_image @return_label_image end |
#return_label_metadata ⇒ ReturnLabelMetadata
Return Label Metadata
18 19 20 |
# File 'lib/usps_api/models/label_package_response1.rb', line 18 def @return_label_metadata end |
#return_receipt_image ⇒ String
Contains the Base64-encoded file contents of the return receipt image. Provided only when ‘imageInfo.returnLabel` is `true` and `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.
55 56 57 |
# File 'lib/usps_api/models/label_package_response1.rb', line 55 def return_receipt_image @return_receipt_image end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 |
# File 'lib/usps_api/models/label_package_response1.rb', line 107 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. = LabelMetadata.from_hash(hash['labelMetadata']) if hash['labelMetadata'] = ReturnLabelMetadata.from_hash(hash['returnLabelMetadata']) if hash['returnLabelMetadata'] label_image = hash.key?('labelImage') ? hash['labelImage'] : SKIP receipt_image = hash.key?('receiptImage') ? hash['receiptImage'] : SKIP 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. LabelPackageResponse1.new(label_metadata: , return_label_metadata: , label_image: label_image, receipt_image: receipt_image, 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.
63 64 65 66 67 68 69 70 71 72 73 |
# File 'lib/usps_api/models/label_package_response1.rb', line 63 def self.names @_hash = {} if @_hash.nil? @_hash['label_metadata'] = 'labelMetadata' @_hash['return_label_metadata'] = 'returnLabelMetadata' @_hash['label_image'] = 'labelImage' @_hash['receipt_image'] = 'receiptImage' @_hash['return_label_image'] = 'returnLabelImage' @_hash['return_receipt_image'] = 'returnReceiptImage' @_hash['label_broker_qr'] = 'labelBrokerQR' @_hash end |
.nullables ⇒ Object
An array for nullable fields
89 90 91 |
# File 'lib/usps_api/models/label_package_response1.rb', line 89 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
76 77 78 79 80 81 82 83 84 85 86 |
# File 'lib/usps_api/models/label_package_response1.rb', line 76 def self.optionals %w[ label_metadata return_label_metadata label_image receipt_image return_label_image return_receipt_image label_broker_qr ] end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
143 144 145 146 147 148 149 150 |
# File 'lib/usps_api/models/label_package_response1.rb', line 143 def inspect class_name = self.class.name.split('::').last "<#{class_name} label_metadata: #{@label_metadata.inspect}, return_label_metadata:"\ " #{@return_label_metadata.inspect}, label_image: #{@label_image.inspect}, receipt_image:"\ " #{@receipt_image.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.
134 135 136 137 138 139 140 |
# File 'lib/usps_api/models/label_package_response1.rb', line 134 def to_s class_name = self.class.name.split('::').last "<#{class_name} label_metadata: #{@label_metadata}, return_label_metadata:"\ " #{@return_label_metadata}, label_image: #{@label_image}, receipt_image: #{@receipt_image},"\ " return_label_image: #{@return_label_image}, return_receipt_image:"\ " #{@return_receipt_image}, label_broker_qr: #{@label_broker_qr}>" end |