Class: UspsApi::PricesExtraServiceRateDetails
- Inherits:
-
BaseModel
- Object
- CoreLibrary::BaseModel
- BaseModel
- UspsApi::PricesExtraServiceRateDetails
- Defined in:
- lib/usps_api/models/prices_extra_service_rate_details.rb
Overview
The extra service rate details that match the search criteria.
Instance Attribute Summary collapse
-
#extra_service ⇒ String
Number associated with the extra service.
-
#name ⇒ String
Name of the extra service.
-
#price ⇒ Float
The postage rate.
-
#price_type ⇒ PriceType1
The type of price applied (Retail, Commercial, Contract, NSA (deprecated)).
-
#sku ⇒ String
The stock keeping unit for the designated rate.
-
#warnings ⇒ Array[ContainersContainerWarnings]
A list of warnings associated with the rate calculation.
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(extra_service: SKIP, name: SKIP, sku: SKIP, price_type: SKIP, price: SKIP, warnings: SKIP) ⇒ PricesExtraServiceRateDetails
constructor
A new instance of PricesExtraServiceRateDetails.
-
#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(extra_service: SKIP, name: SKIP, sku: SKIP, price_type: SKIP, price: SKIP, warnings: SKIP) ⇒ PricesExtraServiceRateDetails
Returns a new instance of PricesExtraServiceRateDetails.
66 67 68 69 70 71 72 73 74 |
# File 'lib/usps_api/models/prices_extra_service_rate_details.rb', line 66 def initialize(extra_service: SKIP, name: SKIP, sku: SKIP, price_type: SKIP, price: SKIP, warnings: SKIP) @extra_service = extra_service unless extra_service == SKIP @name = name unless name == SKIP @sku = sku unless sku == SKIP @price_type = price_type unless price_type == SKIP @price = price unless price == SKIP @warnings = warnings unless warnings == SKIP end |
Instance Attribute Details
#extra_service ⇒ String
Number associated with the extra service
14 15 16 |
# File 'lib/usps_api/models/prices_extra_service_rate_details.rb', line 14 def extra_service @extra_service end |
#name ⇒ String
Name of the extra service.
18 19 20 |
# File 'lib/usps_api/models/prices_extra_service_rate_details.rb', line 18 def name @name end |
#price ⇒ Float
The postage rate.
31 32 33 |
# File 'lib/usps_api/models/prices_extra_service_rate_details.rb', line 31 def price @price end |
#price_type ⇒ PriceType1
The type of price applied (Retail, Commercial, Contract, NSA (deprecated)).
27 28 29 |
# File 'lib/usps_api/models/prices_extra_service_rate_details.rb', line 27 def price_type @price_type end |
#sku ⇒ String
The stock keeping unit for the designated rate.
22 23 24 |
# File 'lib/usps_api/models/prices_extra_service_rate_details.rb', line 22 def sku @sku end |
#warnings ⇒ Array[ContainersContainerWarnings]
A list of warnings associated with the rate calculation.
35 36 37 |
# File 'lib/usps_api/models/prices_extra_service_rate_details.rb', line 35 def warnings @warnings end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 |
# File 'lib/usps_api/models/prices_extra_service_rate_details.rb', line 77 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. extra_service = hash.key?('extraService') ? hash['extraService'] : SKIP name = hash.key?('name') ? hash['name'] : SKIP sku = hash.key?('SKU') ? hash['SKU'] : SKIP price_type = hash.key?('priceType') ? hash['priceType'] : 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 << (ContainersContainerWarnings.from_hash(structure) if structure) end end warnings = SKIP unless hash.key?('warnings') # Create object from extracted values. PricesExtraServiceRateDetails.new(extra_service: extra_service, name: name, sku: sku, price_type: price_type, price: price, warnings: warnings) end |
.names ⇒ Object
A mapping from model property names to API property names.
38 39 40 41 42 43 44 45 46 47 |
# File 'lib/usps_api/models/prices_extra_service_rate_details.rb', line 38 def self.names @_hash = {} if @_hash.nil? @_hash['extra_service'] = 'extraService' @_hash['name'] = 'name' @_hash['sku'] = 'SKU' @_hash['price_type'] = 'priceType' @_hash['price'] = 'price' @_hash['warnings'] = 'warnings' @_hash end |
.nullables ⇒ Object
An array for nullable fields
62 63 64 |
# File 'lib/usps_api/models/prices_extra_service_rate_details.rb', line 62 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
50 51 52 53 54 55 56 57 58 59 |
# File 'lib/usps_api/models/prices_extra_service_rate_details.rb', line 50 def self.optionals %w[ extra_service name sku price_type price warnings ] end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
114 115 116 117 118 119 |
# File 'lib/usps_api/models/prices_extra_service_rate_details.rb', line 114 def inspect class_name = self.class.name.split('::').last "<#{class_name} extra_service: #{@extra_service.inspect}, name: #{@name.inspect}, sku:"\ " #{@sku.inspect}, price_type: #{@price_type.inspect}, price: #{@price.inspect}, warnings:"\ " #{@warnings.inspect}>" end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
107 108 109 110 111 |
# File 'lib/usps_api/models/prices_extra_service_rate_details.rb', line 107 def to_s class_name = self.class.name.split('::').last "<#{class_name} extra_service: #{@extra_service}, name: #{@name}, sku: #{@sku}, price_type:"\ " #{@price_type}, price: #{@price}, warnings: #{@warnings}>" end |