Class: UspsApi::PricingCharacteristic
- Defined in:
- lib/usps_api/models/pricing_characteristic.rb
Overview
PricingCharacteristic Model.
Instance Attribute Summary collapse
-
#assessed ⇒ String
The census value for the ingredient.
-
#claimed ⇒ String
Manifest value of the ingredient.
-
#pricing_characteristic ⇒ PricingCharacteristic1
| Enumeration | Format | Example | | – | – | – | | WEIGHT | number | 4.1 | | DIM_WEIGHT | number | 11.8 | | LENGTH | number | 8.6 | | WIDTH | number | 4.2 | | HEIGHT | number | 3.5 | | ORIGIN_ZIP_CODE | string | 20260 | | DESTINATION_ZIP_CODE | string | 20260 | | ZONE | string | 01 | | DESTINATION_ENTRY_FACILITY_TYPE | string | Temp | | RATE_INDICATOR | string | SP | | MAIL_CLASS | string | PRIORITY_MAIL |.
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(pricing_characteristic: SKIP, claimed: SKIP, assessed: SKIP, additional_properties: nil) ⇒ PricingCharacteristic
constructor
A new instance of PricingCharacteristic.
-
#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(pricing_characteristic: SKIP, claimed: SKIP, assessed: SKIP, additional_properties: nil) ⇒ PricingCharacteristic
Returns a new instance of PricingCharacteristic.
59 60 61 62 63 64 65 66 67 68 |
# File 'lib/usps_api/models/pricing_characteristic.rb', line 59 def initialize(pricing_characteristic: SKIP, claimed: SKIP, assessed: SKIP, additional_properties: nil) # Add additional model properties to the instance additional_properties = {} if additional_properties.nil? @pricing_characteristic = pricing_characteristic unless pricing_characteristic == SKIP @claimed = claimed unless claimed == SKIP @assessed = assessed unless assessed == SKIP @additional_properties = additional_properties end |
Instance Attribute Details
#assessed ⇒ String
The census value for the ingredient
34 35 36 |
# File 'lib/usps_api/models/pricing_characteristic.rb', line 34 def assessed @assessed end |
#claimed ⇒ String
Manifest value of the ingredient
30 31 32 |
# File 'lib/usps_api/models/pricing_characteristic.rb', line 30 def claimed @claimed end |
#pricing_characteristic ⇒ PricingCharacteristic1
| Enumeration | Format | Example | | – | – | – | | WEIGHT | number | 4.1 | | DIM_WEIGHT | number | 11.8 | | LENGTH | number | 8.6 | | WIDTH | number | 4.2 | | HEIGHT | number | 3.5 | | ORIGIN_ZIP_CODE | string | 20260 | | DESTINATION_ZIP_CODE | string | 20260 | | ZONE | string | 01 | | DESTINATION_ENTRY_FACILITY_TYPE | string | Temp | | RATE_INDICATOR | string | SP | | MAIL_CLASS | string | PRIORITY_MAIL |
26 27 28 |
# File 'lib/usps_api/models/pricing_characteristic.rb', line 26 def pricing_characteristic @pricing_characteristic end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 |
# File 'lib/usps_api/models/pricing_characteristic.rb', line 71 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. pricing_characteristic = hash.key?('pricingCharacteristic') ? hash['pricingCharacteristic'] : SKIP claimed = hash.key?('claimed') ? hash['claimed'] : SKIP assessed = hash.key?('assessed') ? hash['assessed'] : SKIP # Create a new hash for additional properties, removing known properties. new_hash = hash.reject { |k, _| names.value?(k) } additional_properties = APIHelper.get_additional_properties( new_hash, proc { |value| value } ) # Create object from extracted values. PricingCharacteristic.new(pricing_characteristic: pricing_characteristic, claimed: claimed, assessed: assessed, additional_properties: additional_properties) end |
.names ⇒ Object
A mapping from model property names to API property names.
37 38 39 40 41 42 43 |
# File 'lib/usps_api/models/pricing_characteristic.rb', line 37 def self.names @_hash = {} if @_hash.nil? @_hash['pricing_characteristic'] = 'pricingCharacteristic' @_hash['claimed'] = 'claimed' @_hash['assessed'] = 'assessed' @_hash end |
.nullables ⇒ Object
An array for nullable fields
55 56 57 |
# File 'lib/usps_api/models/pricing_characteristic.rb', line 55 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
46 47 48 49 50 51 52 |
# File 'lib/usps_api/models/pricing_characteristic.rb', line 46 def self.optionals %w[ pricing_characteristic claimed assessed ] end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
102 103 104 105 106 107 |
# File 'lib/usps_api/models/pricing_characteristic.rb', line 102 def inspect class_name = self.class.name.split('::').last "<#{class_name} pricing_characteristic: #{@pricing_characteristic.inspect}, claimed:"\ " #{@claimed.inspect}, assessed: #{@assessed.inspect}, additional_properties:"\ " #{@additional_properties}>" end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
95 96 97 98 99 |
# File 'lib/usps_api/models/pricing_characteristic.rb', line 95 def to_s class_name = self.class.name.split('::').last "<#{class_name} pricing_characteristic: #{@pricing_characteristic}, claimed: #{@claimed},"\ " assessed: #{@assessed}, additional_properties: #{@additional_properties}>" end |