Class: UspsApi::InternationalLabelsExtraServiceResponse
- Inherits:
-
BaseModel
- Object
- CoreLibrary::BaseModel
- BaseModel
- UspsApi::InternationalLabelsExtraServiceResponse
- Defined in:
- lib/usps_api/models/international_labels_extra_service_response.rb
Overview
InternationalLabelsExtraServiceResponse Model.
Instance Attribute Summary collapse
-
#price ⇒ Float
The price for the extra service.
-
#service_id ⇒ String
The unique identifier of the extra service.
-
#service_name ⇒ String
Name of the extra service.
-
#sku ⇒ String
SKU of the extra service.
-
#warnings ⇒ Array[Warning]
Warnings and additional details around the Extra Services.
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(service_id: SKIP, service_name: SKIP, sku: SKIP, price: SKIP, warnings: SKIP) ⇒ InternationalLabelsExtraServiceResponse
constructor
A new instance of InternationalLabelsExtraServiceResponse.
-
#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(service_id: SKIP, service_name: SKIP, sku: SKIP, price: SKIP, warnings: SKIP) ⇒ InternationalLabelsExtraServiceResponse
Returns a new instance of InternationalLabelsExtraServiceResponse.
59 60 61 62 63 64 65 66 |
# File 'lib/usps_api/models/international_labels_extra_service_response.rb', line 59 def initialize(service_id: SKIP, service_name: SKIP, sku: SKIP, price: SKIP, warnings: SKIP) @service_id = service_id unless service_id == SKIP @service_name = service_name unless service_name == SKIP @sku = sku unless sku == SKIP @price = price unless price == SKIP @warnings = warnings unless warnings == SKIP end |
Instance Attribute Details
#price ⇒ Float
The price for the extra service.
26 27 28 |
# File 'lib/usps_api/models/international_labels_extra_service_response.rb', line 26 def price @price end |
#service_id ⇒ String
The unique identifier of the extra service.
14 15 16 |
# File 'lib/usps_api/models/international_labels_extra_service_response.rb', line 14 def service_id @service_id end |
#service_name ⇒ String
Name of the extra service.
18 19 20 |
# File 'lib/usps_api/models/international_labels_extra_service_response.rb', line 18 def service_name @service_name end |
#sku ⇒ String
SKU of the extra service.
22 23 24 |
# File 'lib/usps_api/models/international_labels_extra_service_response.rb', line 22 def sku @sku end |
#warnings ⇒ Array[Warning]
Warnings and additional details around the Extra Services.
30 31 32 |
# File 'lib/usps_api/models/international_labels_extra_service_response.rb', line 30 def warnings @warnings end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 |
# File 'lib/usps_api/models/international_labels_extra_service_response.rb', line 69 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. service_id = hash.key?('serviceID') ? hash['serviceID'] : SKIP service_name = hash.key?('serviceName') ? hash['serviceName'] : SKIP sku = hash.key?('sku') ? hash['sku'] : SKIP price = hash.key?('price') ? hash['price'] : SKIP # Parameter is an array, so we need to iterate through it warnings = nil unless hash['warnings'].nil? warnings = [] hash['warnings'].each do |structure| warnings << (Warning.from_hash(structure) if structure) end end warnings = SKIP unless hash.key?('warnings') # Create object from extracted values. InternationalLabelsExtraServiceResponse.new(service_id: service_id, service_name: service_name, sku: sku, price: price, warnings: warnings) end |
.names ⇒ Object
A mapping from model property names to API property names.
33 34 35 36 37 38 39 40 41 |
# File 'lib/usps_api/models/international_labels_extra_service_response.rb', line 33 def self.names @_hash = {} if @_hash.nil? @_hash['service_id'] = 'serviceID' @_hash['service_name'] = 'serviceName' @_hash['sku'] = 'sku' @_hash['price'] = 'price' @_hash['warnings'] = 'warnings' @_hash end |
.nullables ⇒ Object
An array for nullable fields
55 56 57 |
# File 'lib/usps_api/models/international_labels_extra_service_response.rb', line 55 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
44 45 46 47 48 49 50 51 52 |
# File 'lib/usps_api/models/international_labels_extra_service_response.rb', line 44 def self.optionals %w[ service_id service_name sku price warnings ] end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
104 105 106 107 108 |
# File 'lib/usps_api/models/international_labels_extra_service_response.rb', line 104 def inspect class_name = self.class.name.split('::').last "<#{class_name} service_id: #{@service_id.inspect}, service_name: #{@service_name.inspect},"\ " sku: #{@sku.inspect}, price: #{@price.inspect}, warnings: #{@warnings.inspect}>" end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
97 98 99 100 101 |
# File 'lib/usps_api/models/international_labels_extra_service_response.rb', line 97 def to_s class_name = self.class.name.split('::').last "<#{class_name} service_id: #{@service_id}, service_name: #{@service_name}, sku: #{@sku},"\ " price: #{@price}, warnings: #{@warnings}>" end |