Class: OpenapiClient::Label
- Inherits:
-
Object
- Object
- OpenapiClient::Label
- Defined in:
- lib/openapi_client/models/label.rb
Overview
A label represents the physical sticker that you affix to a package to ship it. ShipEngine makes it easy for you to [create labels](www.shipengine.com/docs/labels/create-a-label/) and then download them in PDF, PNG, or ZPL format so you can print them.
Direct Known Subclasses
CreateLabelFromRateResponseBody, CreateLabelFromShipmentResponseBody, CreateLabelRequestBody, CreateLabelResponseBody, CreateReturnLabelResponseBody, GetLabelByExternalShipmentIdResponseBody, GetLabelByIdResponseBody
Instance Attribute Summary collapse
-
#batch_id ⇒ Object
If this label was created as part of a [batch](www.shipengine.com/docs/labels/bulk/), then this is the unique ID of that batch.
-
#carrier_code ⇒ Object
The [shipping carrier](www.shipengine.com/docs/carriers/setup/) who will ship the package, such as ‘fedex`, `dhl_express`, `stamps_com`, etc.
-
#carrier_id ⇒ Object
The unique ID of the [carrier account](www.shipengine.com/docs/carriers/setup/) that was used to create this label.
-
#charge_event ⇒ Object
The label charge event.
-
#created_at ⇒ Object
The date and time that the label was created in ShipEngine.
-
#form_download ⇒ Object
The link to downlaod the customs form (a.k.a. commercial invoice) for this shipment, if any.
-
#insurance_claim ⇒ Object
The link to submit an insurance claim for the shipment.
-
#insurance_cost ⇒ Object
The insurance cost for this package.
-
#is_international ⇒ Object
Indicates whether this is an international shipment.
-
#is_return_label ⇒ Object
Indicates whether this is a return label.
-
#label_download ⇒ Object
Returns the value of attribute label_download.
-
#label_download_type ⇒ Object
Returns the value of attribute label_download_type.
-
#label_format ⇒ Object
The file format that you want the label to be in.
-
#label_id ⇒ Object
A string that uniquely identifies the label.
-
#label_image_id ⇒ Object
The label image resource that was used to create a custom label image.
-
#label_layout ⇒ Object
The layout (size) that you want the label to be in.
-
#outbound_label_id ⇒ Object
The ‘label_id` of the original (outgoing) label that the return label is for.
-
#package_code ⇒ Object
The [package type](www.shipengine.com/docs/reference/list-carrier-packages/), such as ‘thick_envelope`, `small_flat_rate_box`, `large_package`, etc.
-
#packages ⇒ Object
The label’s package(s).
-
#rma_number ⇒ Object
An optional Return Merchandise Authorization number.
-
#service_code ⇒ Object
The [carrier service](www.shipengine.com/docs/shipping/use-a-carrier-service/) used to ship the package, such as ‘fedex_ground`, `usps_first_class_mail`, `flat_rate_envelope`, etc.
-
#ship_date ⇒ Object
The date that the package was (or will be) shippped.
-
#shipment ⇒ Object
The shipment information used to generate the label.
-
#shipment_cost ⇒ Object
The cost of shipping, delivery confirmation, and other carrier charges.
-
#shipment_id ⇒ Object
The shipment that this label is for.
-
#status ⇒ Object
Returns the value of attribute status.
-
#test_label ⇒ Object
Indicate if this label is being used only for testing purposes.
-
#trackable ⇒ Object
Indicates whether the shipment is trackable, in which case the ‘tracking_status` field will reflect the current status and each package will have a `tracking_number`.
-
#tracking_number ⇒ Object
The tracking number for the package.
-
#tracking_status ⇒ Object
The current status of the package, such as ‘in_transit` or `delivered`.
-
#validate_address ⇒ Object
Returns the value of attribute validate_address.
-
#voided ⇒ Object
Indicates whether the label has been [voided](www.shipengine.com/docs/labels/voiding/).
-
#voided_at ⇒ Object
The date and time that the label was [voided](www.shipengine.com/docs/labels/voiding/), or ‘null` if the label has not been voided.
Class Method Summary collapse
-
.attribute_map ⇒ Object
Attribute mapping from ruby-style variable name to JSON key.
-
.build_from_hash(attributes) ⇒ Object
Builds the object from hash.
-
.openapi_nullable ⇒ Object
List of attributes with nullable: true.
-
.openapi_types ⇒ Object
Attribute type mapping.
Instance Method Summary collapse
-
#==(o) ⇒ Object
Checks equality by comparing each attribute.
-
#_deserialize(type, value) ⇒ Object
Deserializes the data based on type.
-
#_to_hash(value) ⇒ Hash
Outputs non-array value in the form of hash For object, use to_hash.
-
#build_from_hash(attributes) ⇒ Object
Builds the object from hash.
- #eql?(o) ⇒ Boolean
-
#hash ⇒ Integer
Calculates hash code according to all attributes.
-
#initialize(attributes = {}) ⇒ Label
constructor
Initializes the object.
-
#list_invalid_properties ⇒ Object
Show invalid properties with the reasons.
-
#to_body ⇒ Hash
to_body is an alias to to_hash (backward compatibility).
-
#to_hash ⇒ Hash
Returns the object in the form of hash.
-
#to_s ⇒ String
Returns the string representation of the object.
-
#valid? ⇒ Boolean
Check to see if the all the properties in the model are valid.
Constructor Details
#initialize(attributes = {}) ⇒ Label
Initializes the object
204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 |
# File 'lib/openapi_client/models/label.rb', line 204 def initialize(attributes = {}) if (!attributes.is_a?(Hash)) fail ArgumentError, "The input argument (attributes) must be a hash in `OpenapiClient::Label` initialize method" end # check to see if the attribute exists and convert string to symbol for hash key attributes = attributes.each_with_object({}) { |(k, v), h| if (!self.class.attribute_map.key?(k.to_sym)) fail ArgumentError, "`#{k}` is not a valid attribute in `OpenapiClient::Label`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect end h[k.to_sym] = v } if attributes.key?(:'label_id') self.label_id = attributes[:'label_id'] end if attributes.key?(:'status') self.status = attributes[:'status'] end if attributes.key?(:'shipment_id') self.shipment_id = attributes[:'shipment_id'] end if attributes.key?(:'shipment') self.shipment = attributes[:'shipment'] end if attributes.key?(:'ship_date') self.ship_date = attributes[:'ship_date'] end if attributes.key?(:'created_at') self.created_at = attributes[:'created_at'] end if attributes.key?(:'shipment_cost') self.shipment_cost = attributes[:'shipment_cost'] end if attributes.key?(:'insurance_cost') self.insurance_cost = attributes[:'insurance_cost'] end if attributes.key?(:'tracking_number') self.tracking_number = attributes[:'tracking_number'] end if attributes.key?(:'is_return_label') self.is_return_label = attributes[:'is_return_label'] end if attributes.key?(:'rma_number') self.rma_number = attributes[:'rma_number'] end if attributes.key?(:'is_international') self.is_international = attributes[:'is_international'] end if attributes.key?(:'batch_id') self.batch_id = attributes[:'batch_id'] end if attributes.key?(:'carrier_id') self.carrier_id = attributes[:'carrier_id'] end if attributes.key?(:'charge_event') self.charge_event = attributes[:'charge_event'] end if attributes.key?(:'outbound_label_id') self.outbound_label_id = attributes[:'outbound_label_id'] end if attributes.key?(:'service_code') self.service_code = attributes[:'service_code'] end if attributes.key?(:'test_label') self.test_label = attributes[:'test_label'] else self.test_label = false end if attributes.key?(:'package_code') self.package_code = attributes[:'package_code'] end if attributes.key?(:'validate_address') self.validate_address = attributes[:'validate_address'] end if attributes.key?(:'voided') self.voided = attributes[:'voided'] end if attributes.key?(:'voided_at') self.voided_at = attributes[:'voided_at'] end if attributes.key?(:'label_download_type') self.label_download_type = attributes[:'label_download_type'] end if attributes.key?(:'label_format') self.label_format = attributes[:'label_format'] end if attributes.key?(:'label_layout') self.label_layout = attributes[:'label_layout'] end if attributes.key?(:'trackable') self.trackable = attributes[:'trackable'] end if attributes.key?(:'label_image_id') self.label_image_id = attributes[:'label_image_id'] end if attributes.key?(:'carrier_code') self.carrier_code = attributes[:'carrier_code'] end if attributes.key?(:'tracking_status') self.tracking_status = attributes[:'tracking_status'] end if attributes.key?(:'label_download') self.label_download = attributes[:'label_download'] end if attributes.key?(:'form_download') self.form_download = attributes[:'form_download'] end if attributes.key?(:'insurance_claim') self.insurance_claim = attributes[:'insurance_claim'] end if attributes.key?(:'packages') if (value = attributes[:'packages']).is_a?(Array) self.packages = value end end end |
Instance Attribute Details
#batch_id ⇒ Object
If this label was created as part of a [batch](www.shipengine.com/docs/labels/bulk/), then this is the unique ID of that batch.
54 55 56 |
# File 'lib/openapi_client/models/label.rb', line 54 def batch_id @batch_id end |
#carrier_code ⇒ Object
The [shipping carrier](www.shipengine.com/docs/carriers/setup/) who will ship the package, such as ‘fedex`, `dhl_express`, `stamps_com`, etc.
97 98 99 |
# File 'lib/openapi_client/models/label.rb', line 97 def carrier_code @carrier_code end |
#carrier_id ⇒ Object
The unique ID of the [carrier account](www.shipengine.com/docs/carriers/setup/) that was used to create this label
57 58 59 |
# File 'lib/openapi_client/models/label.rb', line 57 def carrier_id @carrier_id end |
#charge_event ⇒ Object
The label charge event.
60 61 62 |
# File 'lib/openapi_client/models/label.rb', line 60 def charge_event @charge_event end |
#created_at ⇒ Object
The date and time that the label was created in ShipEngine.
33 34 35 |
# File 'lib/openapi_client/models/label.rb', line 33 def created_at @created_at end |
#form_download ⇒ Object
The link to downlaod the customs form (a.k.a. commercial invoice) for this shipment, if any. Forms are in PDF format. This field is null if the shipment does not require a customs form, or if the carrier does not support it.
105 106 107 |
# File 'lib/openapi_client/models/label.rb', line 105 def form_download @form_download end |
#insurance_claim ⇒ Object
The link to submit an insurance claim for the shipment. This field is null if the shipment is not insured or if the insurance provider does not support online claim submission.
108 109 110 |
# File 'lib/openapi_client/models/label.rb', line 108 def insurance_claim @insurance_claim end |
#insurance_cost ⇒ Object
The insurance cost for this package. Add this to the ‘shipment_cost` field to get the total cost.
39 40 41 |
# File 'lib/openapi_client/models/label.rb', line 39 def insurance_cost @insurance_cost end |
#is_international ⇒ Object
Indicates whether this is an international shipment. That is, the originating country and destination country are different.
51 52 53 |
# File 'lib/openapi_client/models/label.rb', line 51 def is_international @is_international end |
#is_return_label ⇒ Object
Indicates whether this is a return label. You may also want to set the ‘rma_number` so you know what is being returned.
45 46 47 |
# File 'lib/openapi_client/models/label.rb', line 45 def is_return_label @is_return_label end |
#label_download ⇒ Object
Returns the value of attribute label_download.
102 103 104 |
# File 'lib/openapi_client/models/label.rb', line 102 def label_download @label_download end |
#label_download_type ⇒ Object
Returns the value of attribute label_download_type.
82 83 84 |
# File 'lib/openapi_client/models/label.rb', line 82 def label_download_type @label_download_type end |
#label_format ⇒ Object
The file format that you want the label to be in. We recommend ‘pdf` format because it is supported by all carriers, whereas some carriers do not support the `png` or `zpl` formats.
85 86 87 |
# File 'lib/openapi_client/models/label.rb', line 85 def label_format @label_format end |
#label_id ⇒ Object
A string that uniquely identifies the label. This ID is generated by ShipEngine when the label is created.
19 20 21 |
# File 'lib/openapi_client/models/label.rb', line 19 def label_id @label_id end |
#label_image_id ⇒ Object
The label image resource that was used to create a custom label image.
94 95 96 |
# File 'lib/openapi_client/models/label.rb', line 94 def label_image_id @label_image_id end |
#label_layout ⇒ Object
The layout (size) that you want the label to be in. The ‘label_format` determines which sizes are allowed. `4x6` is supported for all label formats, whereas `letter` (8.5" x 11") is only supported for `pdf` format.
88 89 90 |
# File 'lib/openapi_client/models/label.rb', line 88 def label_layout @label_layout end |
#outbound_label_id ⇒ Object
The ‘label_id` of the original (outgoing) label that the return label is for. This associates the two labels together, which is required by some carriers.
63 64 65 |
# File 'lib/openapi_client/models/label.rb', line 63 def outbound_label_id @outbound_label_id end |
#package_code ⇒ Object
The [package type](www.shipengine.com/docs/reference/list-carrier-packages/), such as ‘thick_envelope`, `small_flat_rate_box`, `large_package`, etc. The code `package` indicates a custom or unknown package type.
72 73 74 |
# File 'lib/openapi_client/models/label.rb', line 72 def package_code @package_code end |
#packages ⇒ Object
The label’s package(s). > Note: Some carriers only allow one package per label. If you attempt to create a multi-package label for a carrier that doesn’t allow it, an error will be returned.
111 112 113 |
# File 'lib/openapi_client/models/label.rb', line 111 def packages @packages end |
#rma_number ⇒ Object
An optional Return Merchandise Authorization number. This field is useful for return labels. You can set it to any string value.
48 49 50 |
# File 'lib/openapi_client/models/label.rb', line 48 def rma_number @rma_number end |
#service_code ⇒ Object
The [carrier service](www.shipengine.com/docs/shipping/use-a-carrier-service/) used to ship the package, such as ‘fedex_ground`, `usps_first_class_mail`, `flat_rate_envelope`, etc.
66 67 68 |
# File 'lib/openapi_client/models/label.rb', line 66 def service_code @service_code end |
#ship_date ⇒ Object
The date that the package was (or will be) shippped. ShipEngine will take the day of week into consideration. For example, if the carrier does not operate on Sundays, then a package that would have shipped on Sunday will ship on Monday instead.
30 31 32 |
# File 'lib/openapi_client/models/label.rb', line 30 def ship_date @ship_date end |
#shipment ⇒ Object
The shipment information used to generate the label
27 28 29 |
# File 'lib/openapi_client/models/label.rb', line 27 def shipment @shipment end |
#shipment_cost ⇒ Object
The cost of shipping, delivery confirmation, and other carrier charges. This amount **does not** include insurance costs.
36 37 38 |
# File 'lib/openapi_client/models/label.rb', line 36 def shipment_cost @shipment_cost end |
#shipment_id ⇒ Object
The shipment that this label is for. ShipEngine can create a shipment for you automatically when you [create a label](www.shipengine.com/docs/labels/create-a-label/), or you can [create your own shipment](www.shipengine.com/docs/shipping/create-a-shipment/) and then [use it to print a label](www.shipengine.com/docs/labels/create-from-shipment/)
24 25 26 |
# File 'lib/openapi_client/models/label.rb', line 24 def shipment_id @shipment_id end |
#status ⇒ Object
Returns the value of attribute status.
21 22 23 |
# File 'lib/openapi_client/models/label.rb', line 21 def status @status end |
#test_label ⇒ Object
Indicate if this label is being used only for testing purposes. If true, then no charge will be added to your account.
69 70 71 |
# File 'lib/openapi_client/models/label.rb', line 69 def test_label @test_label end |
#trackable ⇒ Object
Indicates whether the shipment is trackable, in which case the ‘tracking_status` field will reflect the current status and each package will have a `tracking_number`.
91 92 93 |
# File 'lib/openapi_client/models/label.rb', line 91 def trackable @trackable end |
#tracking_number ⇒ Object
The tracking number for the package. Tracking number formats vary across carriers.
42 43 44 |
# File 'lib/openapi_client/models/label.rb', line 42 def tracking_number @tracking_number end |
#tracking_status ⇒ Object
The current status of the package, such as ‘in_transit` or `delivered`
100 101 102 |
# File 'lib/openapi_client/models/label.rb', line 100 def tracking_status @tracking_status end |
#validate_address ⇒ Object
Returns the value of attribute validate_address.
74 75 76 |
# File 'lib/openapi_client/models/label.rb', line 74 def validate_address @validate_address end |
#voided ⇒ Object
Indicates whether the label has been [voided](www.shipengine.com/docs/labels/voiding/)
77 78 79 |
# File 'lib/openapi_client/models/label.rb', line 77 def voided @voided end |
#voided_at ⇒ Object
The date and time that the label was [voided](www.shipengine.com/docs/labels/voiding/), or ‘null` if the label has not been voided
80 81 82 |
# File 'lib/openapi_client/models/label.rb', line 80 def voided_at @voided_at end |
Class Method Details
.attribute_map ⇒ Object
Attribute mapping from ruby-style variable name to JSON key.
114 115 116 117 118 119 120 121 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 150 |
# File 'lib/openapi_client/models/label.rb', line 114 def self.attribute_map { :'label_id' => :'label_id', :'status' => :'status', :'shipment_id' => :'shipment_id', :'shipment' => :'shipment', :'ship_date' => :'ship_date', :'created_at' => :'created_at', :'shipment_cost' => :'shipment_cost', :'insurance_cost' => :'insurance_cost', :'tracking_number' => :'tracking_number', :'is_return_label' => :'is_return_label', :'rma_number' => :'rma_number', :'is_international' => :'is_international', :'batch_id' => :'batch_id', :'carrier_id' => :'carrier_id', :'charge_event' => :'charge_event', :'outbound_label_id' => :'outbound_label_id', :'service_code' => :'service_code', :'test_label' => :'test_label', :'package_code' => :'package_code', :'validate_address' => :'validate_address', :'voided' => :'voided', :'voided_at' => :'voided_at', :'label_download_type' => :'label_download_type', :'label_format' => :'label_format', :'label_layout' => :'label_layout', :'trackable' => :'trackable', :'label_image_id' => :'label_image_id', :'carrier_code' => :'carrier_code', :'tracking_status' => :'tracking_status', :'label_download' => :'label_download', :'form_download' => :'form_download', :'insurance_claim' => :'insurance_claim', :'packages' => :'packages' } end |
.build_from_hash(attributes) ⇒ Object
Builds the object from hash
437 438 439 |
# File 'lib/openapi_client/models/label.rb', line 437 def self.build_from_hash(attributes) new.build_from_hash(attributes) end |
.openapi_nullable ⇒ Object
List of attributes with nullable: true
192 193 194 195 196 197 198 199 200 |
# File 'lib/openapi_client/models/label.rb', line 192 def self.openapi_nullable Set.new([ :'rma_number', :'voided_at', :'label_image_id', :'form_download', :'insurance_claim', ]) end |
.openapi_types ⇒ Object
Attribute type mapping.
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 |
# File 'lib/openapi_client/models/label.rb', line 153 def self.openapi_types { :'label_id' => :'String', :'status' => :'LabelStatus', :'shipment_id' => :'String', :'shipment' => :'Shipment', :'ship_date' => :'DateTime', :'created_at' => :'DateTime', :'shipment_cost' => :'MonetaryValue', :'insurance_cost' => :'MonetaryValue', :'tracking_number' => :'String', :'is_return_label' => :'Boolean', :'rma_number' => :'String', :'is_international' => :'Boolean', :'batch_id' => :'String', :'carrier_id' => :'String', :'charge_event' => :'LabelChargeEvent', :'outbound_label_id' => :'String', :'service_code' => :'String', :'test_label' => :'Boolean', :'package_code' => :'String', :'validate_address' => :'ValidateAddress', :'voided' => :'Boolean', :'voided_at' => :'DateTime', :'label_download_type' => :'LabelDownloadType', :'label_format' => :'LabelFormat', :'label_layout' => :'LabelLayout', :'trackable' => :'Boolean', :'label_image_id' => :'String', :'carrier_code' => :'String', :'tracking_status' => :'TrackingStatus', :'label_download' => :'LabelDownload', :'form_download' => :'Link', :'insurance_claim' => :'Link', :'packages' => :'Array<Package>' } end |
Instance Method Details
#==(o) ⇒ Object
Checks equality by comparing each attribute.
384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 |
# File 'lib/openapi_client/models/label.rb', line 384 def ==(o) return true if self.equal?(o) self.class == o.class && label_id == o.label_id && status == o.status && shipment_id == o.shipment_id && shipment == o.shipment && ship_date == o.ship_date && created_at == o.created_at && shipment_cost == o.shipment_cost && insurance_cost == o.insurance_cost && tracking_number == o.tracking_number && is_return_label == o.is_return_label && rma_number == o.rma_number && is_international == o.is_international && batch_id == o.batch_id && carrier_id == o.carrier_id && charge_event == o.charge_event && outbound_label_id == o.outbound_label_id && service_code == o.service_code && test_label == o.test_label && package_code == o.package_code && validate_address == o.validate_address && voided == o.voided && voided_at == o.voided_at && label_download_type == o.label_download_type && label_format == o.label_format && label_layout == o.label_layout && trackable == o.trackable && label_image_id == o.label_image_id && carrier_code == o.carrier_code && tracking_status == o.tracking_status && label_download == o.label_download && form_download == o.form_download && insurance_claim == o.insurance_claim && packages == o.packages end |
#_deserialize(type, value) ⇒ Object
Deserializes the data based on type
465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 |
# File 'lib/openapi_client/models/label.rb', line 465 def _deserialize(type, value) case type.to_sym when :DateTime DateTime.parse(value) when :Date Date.parse(value) when :String value.to_s when :Integer value.to_i when :Float value.to_f when :Boolean if value.to_s =~ /\A(true|t|yes|y|1)\z/i true else false end when :Object # generic object (usually a Hash), return directly value when /\AArray<(?<inner_type>.+)>\z/ inner_type = Regexp.last_match[:inner_type] value.map { |v| _deserialize(inner_type, v) } when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/ k_type = Regexp.last_match[:k_type] v_type = Regexp.last_match[:v_type] {}.tap do |hash| value.each do |k, v| hash[_deserialize(k_type, k)] = _deserialize(v_type, v) end end else # model OpenapiClient.const_get(type).build_from_hash(value) end end |
#_to_hash(value) ⇒ Hash
Outputs non-array value in the form of hash For object, use to_hash. Otherwise, just return the value
534 535 536 537 538 539 540 541 542 543 544 545 546 |
# File 'lib/openapi_client/models/label.rb', line 534 def _to_hash(value) if value.is_a?(Array) value.compact.map { |v| _to_hash(v) } elsif value.is_a?(Hash) {}.tap do |hash| value.each { |k, v| hash[k] = _to_hash(v) } end elsif value.respond_to? :to_hash value.to_hash else value end end |
#build_from_hash(attributes) ⇒ Object
Builds the object from hash
444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 |
# File 'lib/openapi_client/models/label.rb', line 444 def build_from_hash(attributes) return nil unless attributes.is_a?(Hash) self.class.openapi_types.each_pair do |key, type| if type =~ /\AArray<(.*)>/i # check to ensure the input is an array given that the attribute # is documented as an array but the input is not if attributes[self.class.attribute_map[key]].is_a?(Array) self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) end elsif !attributes[self.class.attribute_map[key]].nil? self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) end # or else data not found in attributes(hash), not an issue as the data can be optional end self end |
#eql?(o) ⇒ Boolean
424 425 426 |
# File 'lib/openapi_client/models/label.rb', line 424 def eql?(o) self == o end |
#hash ⇒ Integer
Calculates hash code according to all attributes.
430 431 432 |
# File 'lib/openapi_client/models/label.rb', line 430 def hash [label_id, status, shipment_id, shipment, ship_date, created_at, shipment_cost, insurance_cost, tracking_number, is_return_label, rma_number, is_international, batch_id, carrier_id, charge_event, outbound_label_id, service_code, test_label, package_code, validate_address, voided, voided_at, label_download_type, label_format, label_layout, trackable, label_image_id, carrier_code, tracking_status, label_download, form_download, insurance_claim, packages].hash end |
#list_invalid_properties ⇒ Object
Show invalid properties with the reasons. Usually used together with valid?
356 357 358 359 360 361 362 363 |
# File 'lib/openapi_client/models/label.rb', line 356 def list_invalid_properties invalid_properties = Array.new if !@tracking_number.nil? && @tracking_number.to_s.length < 1 invalid_properties.push('invalid value for "tracking_number", the character length must be great than or equal to 1.') end invalid_properties end |
#to_body ⇒ Hash
to_body is an alias to to_hash (backward compatibility)
510 511 512 |
# File 'lib/openapi_client/models/label.rb', line 510 def to_body to_hash end |
#to_hash ⇒ Hash
Returns the object in the form of hash
516 517 518 519 520 521 522 523 524 525 526 527 528 |
# File 'lib/openapi_client/models/label.rb', line 516 def to_hash hash = {} self.class.attribute_map.each_pair do |attr, param| value = self.send(attr) if value.nil? is_nullable = self.class.openapi_nullable.include?(attr) next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) end hash[param] = _to_hash(value) end hash end |
#to_s ⇒ String
Returns the string representation of the object
504 505 506 |
# File 'lib/openapi_client/models/label.rb', line 504 def to_s to_hash.to_s end |
#valid? ⇒ Boolean
Check to see if the all the properties in the model are valid
367 368 369 370 |
# File 'lib/openapi_client/models/label.rb', line 367 def valid? return false if !@tracking_number.nil? && @tracking_number.to_s.length < 1 true end |