Class: ApiReference::FixedFeeQuantityTransition
- Inherits:
-
BaseModel
- Object
- CoreLibrary::BaseModel
- BaseModel
- ApiReference::FixedFeeQuantityTransition
- Defined in:
- lib/api_reference/models/fixed_fee_quantity_transition.rb
Overview
FixedFeeQuantityTransition Model.
Instance Attribute Summary collapse
-
#effective_date ⇒ DateTime
TODO: Write general description for this method.
-
#price_id ⇒ String
TODO: Write general description for this method.
-
#quantity ⇒ Integer
TODO: Write general description for this method.
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.
-
.validate(value) ⇒ Object
Validates an instance of the object from a given value.
Instance Method Summary collapse
-
#initialize(price_id:, effective_date:, quantity:, additional_properties: nil) ⇒ FixedFeeQuantityTransition
constructor
A new instance of FixedFeeQuantityTransition.
-
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
- #to_custom_effective_date ⇒ Object
-
#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(price_id:, effective_date:, quantity:, additional_properties: nil) ⇒ FixedFeeQuantityTransition
Returns a new instance of FixedFeeQuantityTransition.
44 45 46 47 48 49 50 51 52 53 |
# File 'lib/api_reference/models/fixed_fee_quantity_transition.rb', line 44 def initialize(price_id:, effective_date:, quantity:, additional_properties: nil) # Add additional model properties to the instance additional_properties = {} if additional_properties.nil? @price_id = price_id @effective_date = effective_date @quantity = quantity @additional_properties = additional_properties end |
Instance Attribute Details
#effective_date ⇒ DateTime
TODO: Write general description for this method
19 20 21 |
# File 'lib/api_reference/models/fixed_fee_quantity_transition.rb', line 19 def effective_date @effective_date end |
#price_id ⇒ String
TODO: Write general description for this method
15 16 17 |
# File 'lib/api_reference/models/fixed_fee_quantity_transition.rb', line 15 def price_id @price_id end |
#quantity ⇒ Integer
TODO: Write general description for this method
23 24 25 |
# File 'lib/api_reference/models/fixed_fee_quantity_transition.rb', line 23 def quantity @quantity end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 |
# File 'lib/api_reference/models/fixed_fee_quantity_transition.rb', line 56 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. price_id = hash.key?('price_id') ? hash['price_id'] : nil effective_date = if hash.key?('effective_date') (DateTimeHelper.from_rfc3339(hash['effective_date']) if hash['effective_date']) end quantity = hash.key?('quantity') ? hash['quantity'] : nil # 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. FixedFeeQuantityTransition.new(price_id: price_id, effective_date: effective_date, quantity: quantity, additional_properties: additional_properties) end |
.names ⇒ Object
A mapping from model property names to API property names.
26 27 28 29 30 31 32 |
# File 'lib/api_reference/models/fixed_fee_quantity_transition.rb', line 26 def self.names @_hash = {} if @_hash.nil? @_hash['price_id'] = 'price_id' @_hash['effective_date'] = 'effective_date' @_hash['quantity'] = 'quantity' @_hash end |
.nullables ⇒ Object
An array for nullable fields
40 41 42 |
# File 'lib/api_reference/models/fixed_fee_quantity_transition.rb', line 40 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
35 36 37 |
# File 'lib/api_reference/models/fixed_fee_quantity_transition.rb', line 35 def self.optionals [] end |
.validate(value) ⇒ Object
Validates an instance of the object from a given value.
86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 |
# File 'lib/api_reference/models/fixed_fee_quantity_transition.rb', line 86 def self.validate(value) if value.instance_of? self return ( APIHelper.valid_type?(value.price_id, ->(val) { val.instance_of? String }) and APIHelper.valid_type?(value.effective_date, ->(val) { val.instance_of? DateTime }) and APIHelper.valid_type?(value.quantity, ->(val) { val.instance_of? Integer }) ) end return false unless value.instance_of? Hash ( APIHelper.valid_type?(value['price_id'], ->(val) { val.instance_of? String }) and APIHelper.valid_type?(value['effective_date'], ->(val) { val.instance_of? String }) and APIHelper.valid_type?(value['quantity'], ->(val) { val.instance_of? Integer }) ) end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
118 119 120 121 122 |
# File 'lib/api_reference/models/fixed_fee_quantity_transition.rb', line 118 def inspect class_name = self.class.name.split('::').last "<#{class_name} price_id: #{@price_id.inspect}, effective_date: #{@effective_date.inspect},"\ " quantity: #{@quantity.inspect}, additional_properties: #{@additional_properties}>" end |
#to_custom_effective_date ⇒ Object
80 81 82 |
# File 'lib/api_reference/models/fixed_fee_quantity_transition.rb', line 80 def to_custom_effective_date DateTimeHelper.to_rfc3339(effective_date) end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
111 112 113 114 115 |
# File 'lib/api_reference/models/fixed_fee_quantity_transition.rb', line 111 def to_s class_name = self.class.name.split('::').last "<#{class_name} price_id: #{@price_id}, effective_date: #{@effective_date}, quantity:"\ " #{@quantity}, additional_properties: #{@additional_properties}>" end |