Class: Paid::AgentPricePoint
- Inherits:
-
Object
- Object
- Paid::AgentPricePoint
- Defined in:
- lib/paid_ruby/types/agent_price_point.rb
Constant Summary collapse
- OMIT =
Object.new
Instance Attribute Summary collapse
-
#additional_properties ⇒ OpenStruct
readonly
Additional properties unmapped to the current class definition.
- #included_quantity ⇒ Float readonly
- #min_quantity ⇒ Float readonly
- #tiers ⇒ Array<Paid::AgentPricePointTiers> readonly
- #unit_price ⇒ Float readonly
Class Method Summary collapse
Instance Method Summary collapse
- #initialize(unit_price: OMIT, min_quantity: OMIT, included_quantity: OMIT, tiers: OMIT, additional_properties: nil) ⇒ Paid::AgentPricePoint constructor
- #to_json ⇒ String
Constructor Details
#initialize(unit_price: OMIT, min_quantity: OMIT, included_quantity: OMIT, tiers: OMIT, additional_properties: nil) ⇒ Paid::AgentPricePoint
30 31 32 33 34 35 36 37 38 39 |
# File 'lib/paid_ruby/types/agent_price_point.rb', line 30 def initialize(unit_price: OMIT, min_quantity: OMIT, included_quantity: OMIT, tiers: OMIT, additional_properties: nil) @unit_price = unit_price if unit_price != OMIT @min_quantity = min_quantity if min_quantity != OMIT @included_quantity = included_quantity if included_quantity != OMIT @tiers = tiers if tiers != OMIT @additional_properties = additional_properties @_field_set = { "unitPrice": unit_price, "minQuantity": min_quantity, "includedQuantity": included_quantity, "tiers": tiers }.reject do | _k, v | v == OMIT end end |
Instance Attribute Details
#additional_properties ⇒ OpenStruct (readonly)
Returns Additional properties unmapped to the current class definition.
17 18 19 |
# File 'lib/paid_ruby/types/agent_price_point.rb', line 17 def additional_properties @additional_properties end |
#included_quantity ⇒ Float (readonly)
13 14 15 |
# File 'lib/paid_ruby/types/agent_price_point.rb', line 13 def included_quantity @included_quantity end |
#min_quantity ⇒ Float (readonly)
11 12 13 |
# File 'lib/paid_ruby/types/agent_price_point.rb', line 11 def min_quantity @min_quantity end |
#tiers ⇒ Array<Paid::AgentPricePointTiers> (readonly)
15 16 17 |
# File 'lib/paid_ruby/types/agent_price_point.rb', line 15 def tiers @tiers end |
#unit_price ⇒ Float (readonly)
9 10 11 |
# File 'lib/paid_ruby/types/agent_price_point.rb', line 9 def unit_price @unit_price end |
Class Method Details
.from_json(json_object:) ⇒ Paid::AgentPricePoint
44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 |
# File 'lib/paid_ruby/types/agent_price_point.rb', line 44 def self.from_json(json_object:) struct = JSON.parse(json_object, object_class: OpenStruct) parsed_json = JSON.parse(json_object) unit_price = parsed_json["unitPrice"] min_quantity = parsed_json["minQuantity"] included_quantity = parsed_json["includedQuantity"] tiers = parsed_json["tiers"]&.map do | item | item = item.to_json Paid::AgentPricePointTiers.from_json(json_object: item) end new( unit_price: unit_price, min_quantity: min_quantity, included_quantity: included_quantity, tiers: tiers, additional_properties: struct ) end |
.validate_raw(obj:) ⇒ Void
74 75 76 77 78 79 |
# File 'lib/paid_ruby/types/agent_price_point.rb', line 74 def self.validate_raw(obj:) obj.unit_price&.is_a?(Float) != false || raise("Passed value for field obj.unit_price is not the expected type, validation failed.") obj.min_quantity&.is_a?(Float) != false || raise("Passed value for field obj.min_quantity is not the expected type, validation failed.") obj.included_quantity&.is_a?(Float) != false || raise("Passed value for field obj.included_quantity is not the expected type, validation failed.") obj.tiers&.is_a?(Array) != false || raise("Passed value for field obj.tiers is not the expected type, validation failed.") end |
Instance Method Details
#to_json ⇒ String
65 66 67 |
# File 'lib/paid_ruby/types/agent_price_point.rb', line 65 def to_json @_field_set&.to_json end |