Class: Paid::Pricing
- Inherits:
-
Object
- Object
- Paid::Pricing
- Defined in:
- lib/paid_ruby/types/pricing.rb
Constant Summary collapse
- OMIT =
Object.new
Instance Attribute Summary collapse
-
#additional_properties ⇒ OpenStruct
readonly
Additional properties unmapped to the current class definition.
- #billing_frequency ⇒ Paid::BillingFrequency readonly
- #charge_type ⇒ Paid::ChargeType readonly
- #credit_cost ⇒ Float readonly
- #event_name ⇒ String readonly
- #price_points ⇒ Hash{String => Paid::AgentPricePoint} readonly
- #pricing_model ⇒ Paid::PricingModelType readonly
- #taxable ⇒ Boolean readonly
Class Method Summary collapse
Instance Method Summary collapse
- #initialize(event_name: OMIT, taxable:, credit_cost: OMIT, charge_type:, pricing_model:, billing_frequency:, price_points:, additional_properties: nil) ⇒ Paid::Pricing constructor
- #to_json ⇒ String
Constructor Details
#initialize(event_name: OMIT, taxable:, credit_cost: OMIT, charge_type:, pricing_model:, billing_frequency:, price_points:, additional_properties: nil) ⇒ Paid::Pricing
41 42 43 44 45 46 47 48 49 50 51 52 53 |
# File 'lib/paid_ruby/types/pricing.rb', line 41 def initialize(event_name: OMIT, taxable:, credit_cost: OMIT, charge_type:, pricing_model:, billing_frequency:, price_points:, additional_properties: nil) @event_name = event_name if event_name != OMIT @taxable = taxable @credit_cost = credit_cost if credit_cost != OMIT @charge_type = charge_type @pricing_model = pricing_model @billing_frequency = billing_frequency @price_points = price_points @additional_properties = additional_properties @_field_set = { "eventName": event_name, "taxable": taxable, "creditCost": credit_cost, "chargeType": charge_type, "pricingModel": pricing_model, "billingFrequency": billing_frequency, "pricePoints": price_points }.reject do | _k, v | v == OMIT end end |
Instance Attribute Details
#additional_properties ⇒ OpenStruct (readonly)
25 26 27 |
# File 'lib/paid_ruby/types/pricing.rb', line 25 def additional_properties @additional_properties end |
#billing_frequency ⇒ Paid::BillingFrequency (readonly)
21 22 23 |
# File 'lib/paid_ruby/types/pricing.rb', line 21 def billing_frequency @billing_frequency end |
#charge_type ⇒ Paid::ChargeType (readonly)
17 18 19 |
# File 'lib/paid_ruby/types/pricing.rb', line 17 def charge_type @charge_type end |
#credit_cost ⇒ Float (readonly)
15 16 17 |
# File 'lib/paid_ruby/types/pricing.rb', line 15 def credit_cost @credit_cost end |
#event_name ⇒ String (readonly)
11 12 13 |
# File 'lib/paid_ruby/types/pricing.rb', line 11 def event_name @event_name end |
#price_points ⇒ Hash{String => Paid::AgentPricePoint} (readonly)
23 24 25 |
# File 'lib/paid_ruby/types/pricing.rb', line 23 def price_points @price_points end |
#pricing_model ⇒ Paid::PricingModelType (readonly)
19 20 21 |
# File 'lib/paid_ruby/types/pricing.rb', line 19 def pricing_model @pricing_model end |
#taxable ⇒ Boolean (readonly)
13 14 15 |
# File 'lib/paid_ruby/types/pricing.rb', line 13 def taxable @taxable end |
Class Method Details
.from_json(json_object:) ⇒ Paid::Pricing
58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 |
# File 'lib/paid_ruby/types/pricing.rb', line 58 def self.from_json(json_object:) struct = JSON.parse(json_object, object_class: OpenStruct) parsed_json = JSON.parse(json_object) event_name = parsed_json["eventName"] taxable = parsed_json["taxable"] credit_cost = parsed_json["creditCost"] charge_type = parsed_json["chargeType"] pricing_model = parsed_json["pricingModel"] billing_frequency = parsed_json["billingFrequency"] price_points = parsed_json["pricePoints"]&.transform_values do | value | value = value.to_json Paid::AgentPricePoint.from_json(json_object: value) end new( event_name: event_name, taxable: taxable, credit_cost: credit_cost, charge_type: charge_type, pricing_model: pricing_model, billing_frequency: billing_frequency, price_points: price_points, additional_properties: struct ) end |
.validate_raw(obj:) ⇒ Void
94 95 96 97 98 99 100 101 102 |
# File 'lib/paid_ruby/types/pricing.rb', line 94 def self.validate_raw(obj:) obj.event_name&.is_a?(String) != false || raise("Passed value for field obj.event_name is not the expected type, validation failed.") obj.taxable.is_a?(Boolean) != false || raise("Passed value for field obj.taxable is not the expected type, validation failed.") obj.credit_cost&.is_a?(Float) != false || raise("Passed value for field obj.credit_cost is not the expected type, validation failed.") obj.charge_type.is_a?(Paid::ChargeType) != false || raise("Passed value for field obj.charge_type is not the expected type, validation failed.") obj.pricing_model.is_a?(Paid::PricingModelType) != false || raise("Passed value for field obj.pricing_model is not the expected type, validation failed.") obj.billing_frequency.is_a?(Paid::BillingFrequency) != false || raise("Passed value for field obj.billing_frequency is not the expected type, validation failed.") obj.price_points.is_a?(Hash) != false || raise("Passed value for field obj.price_points is not the expected type, validation failed.") end |
Instance Method Details
#to_json ⇒ String
85 86 87 |
# File 'lib/paid_ruby/types/pricing.rb', line 85 def to_json @_field_set&.to_json end |