Class: Paid::Tier
- Inherits:
-
Object
- Object
- Paid::Tier
- Defined in:
- lib/paid_ruby/types/tier.rb
Constant Summary collapse
- OMIT =
Object.new
Instance Attribute Summary collapse
-
#additional_properties ⇒ OpenStruct
readonly
Additional properties unmapped to the current class definition.
- #lower_bound ⇒ Float readonly
- #price ⇒ Float readonly
- #upper_bound ⇒ Float readonly
Class Method Summary collapse
Instance Method Summary collapse
- #initialize(lower_bound: OMIT, upper_bound: OMIT, price: OMIT, additional_properties: nil) ⇒ Paid::Tier constructor
- #to_json ⇒ String
Constructor Details
#initialize(lower_bound: OMIT, upper_bound: OMIT, price: OMIT, additional_properties: nil) ⇒ Paid::Tier
26 27 28 29 30 31 32 33 34 |
# File 'lib/paid_ruby/types/tier.rb', line 26 def initialize(lower_bound: OMIT, upper_bound: OMIT, price: OMIT, additional_properties: nil) @lower_bound = lower_bound if lower_bound != OMIT @upper_bound = upper_bound if upper_bound != OMIT @price = price if price != OMIT @additional_properties = additional_properties @_field_set = { "lowerBound": lower_bound, "upperBound": upper_bound, "price": price }.reject do | _k, v | v == OMIT end end |
Instance Attribute Details
#additional_properties ⇒ OpenStruct (readonly)
Returns Additional properties unmapped to the current class definition.
14 15 16 |
# File 'lib/paid_ruby/types/tier.rb', line 14 def additional_properties @additional_properties end |
#lower_bound ⇒ Float (readonly)
8 9 10 |
# File 'lib/paid_ruby/types/tier.rb', line 8 def lower_bound @lower_bound end |
#price ⇒ Float (readonly)
12 13 14 |
# File 'lib/paid_ruby/types/tier.rb', line 12 def price @price end |
#upper_bound ⇒ Float (readonly)
10 11 12 |
# File 'lib/paid_ruby/types/tier.rb', line 10 def upper_bound @upper_bound end |
Class Method Details
.from_json(json_object:) ⇒ Paid::Tier
39 40 41 42 43 44 45 46 47 48 49 50 51 |
# File 'lib/paid_ruby/types/tier.rb', line 39 def self.from_json(json_object:) struct = JSON.parse(json_object, object_class: OpenStruct) parsed_json = JSON.parse(json_object) lower_bound = parsed_json["lowerBound"] upper_bound = parsed_json["upperBound"] price = parsed_json["price"] new( lower_bound: lower_bound, upper_bound: upper_bound, price: price, additional_properties: struct ) end |
.validate_raw(obj:) ⇒ Void
64 65 66 67 68 |
# File 'lib/paid_ruby/types/tier.rb', line 64 def self.validate_raw(obj:) obj.lower_bound&.is_a?(Float) != false || raise("Passed value for field obj.lower_bound is not the expected type, validation failed.") obj.upper_bound&.is_a?(Float) != false || raise("Passed value for field obj.upper_bound is not the expected type, validation failed.") obj.price&.is_a?(Float) != false || raise("Passed value for field obj.price is not the expected type, validation failed.") end |
Instance Method Details
#to_json ⇒ String
55 56 57 |
# File 'lib/paid_ruby/types/tier.rb', line 55 def to_json @_field_set&.to_json end |