Class: Paid::OrderLineAttributePricing

Inherits:
Object
  • Object
show all
Defined in:
lib/paid_ruby/types/order_line_attribute_pricing.rb

Constant Summary collapse

OMIT =
Object.new

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(event_name: OMIT, charge_type: OMIT, price_point: OMIT, pricing_model: OMIT, billing_frequency: OMIT, additional_properties: nil) ⇒ Paid::OrderLineAttributePricing

Parameters:

  • event_name (String) (defaults to: OMIT)
  • charge_type (Paid::ChargeType) (defaults to: OMIT)
  • price_point (Paid::PricePoint) (defaults to: OMIT)
  • pricing_model (Paid::PricingModelType) (defaults to: OMIT)
  • billing_frequency (Paid::BillingFrequency) (defaults to: OMIT)
  • additional_properties (OpenStruct) (defaults to: nil)

    Additional properties unmapped to the current class definition



36
37
38
39
40
41
42
43
44
45
46
# File 'lib/paid_ruby/types/order_line_attribute_pricing.rb', line 36

def initialize(event_name: OMIT, charge_type: OMIT, price_point: OMIT, pricing_model: OMIT, billing_frequency: OMIT, additional_properties: nil)
  @event_name = event_name if event_name != OMIT
  @charge_type = charge_type if charge_type != OMIT
  @price_point = price_point if price_point != OMIT
  @pricing_model = pricing_model if pricing_model != OMIT
  @billing_frequency = billing_frequency if billing_frequency != OMIT
  @additional_properties = additional_properties
  @_field_set = { "eventName": event_name, "chargeType": charge_type, "pricePoint": price_point, "pricingModel": pricing_model, "billingFrequency": billing_frequency }.reject do | _k, v |
  v == OMIT
end
end

Instance Attribute Details

#additional_propertiesOpenStruct (readonly)

Returns Additional properties unmapped to the current class definition.

Returns:

  • (OpenStruct)

    Additional properties unmapped to the current class definition



22
23
24
# File 'lib/paid_ruby/types/order_line_attribute_pricing.rb', line 22

def additional_properties
  @additional_properties
end

#billing_frequencyPaid::BillingFrequency (readonly)



20
21
22
# File 'lib/paid_ruby/types/order_line_attribute_pricing.rb', line 20

def billing_frequency
  @billing_frequency
end

#charge_typePaid::ChargeType (readonly)

Returns:



14
15
16
# File 'lib/paid_ruby/types/order_line_attribute_pricing.rb', line 14

def charge_type
  @charge_type
end

#event_nameString (readonly)

Returns:

  • (String)


12
13
14
# File 'lib/paid_ruby/types/order_line_attribute_pricing.rb', line 12

def event_name
  @event_name
end

#price_pointPaid::PricePoint (readonly)

Returns:



16
17
18
# File 'lib/paid_ruby/types/order_line_attribute_pricing.rb', line 16

def price_point
  @price_point
end

#pricing_modelPaid::PricingModelType (readonly)



18
19
20
# File 'lib/paid_ruby/types/order_line_attribute_pricing.rb', line 18

def pricing_model
  @pricing_model
end

Class Method Details

.from_json(json_object:) ⇒ Paid::OrderLineAttributePricing

Parameters:

  • json_object (String)

Returns:



51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
# File 'lib/paid_ruby/types/order_line_attribute_pricing.rb', line 51

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"]
  charge_type = parsed_json["chargeType"]
  unless parsed_json["pricePoint"].nil?
    price_point = parsed_json["pricePoint"].to_json
    price_point = Paid::PricePoint.from_json(json_object: price_point)
  else
    price_point = nil
  end
  pricing_model = parsed_json["pricingModel"]
  billing_frequency = parsed_json["billingFrequency"]
  new(
    event_name: event_name,
    charge_type: charge_type,
    price_point: price_point,
    pricing_model: pricing_model,
    billing_frequency: billing_frequency,
    additional_properties: struct
  )
end

.validate_raw(obj:) ⇒ Void

Parameters:

  • obj (Object)

Returns:

  • (Void)


85
86
87
88
89
90
91
# File 'lib/paid_ruby/types/order_line_attribute_pricing.rb', line 85

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.charge_type&.is_a?(Paid::ChargeType) != false || raise("Passed value for field obj.charge_type is not the expected type, validation failed.")
  obj.price_point.nil? || Paid::PricePoint.validate_raw(obj: obj.price_point)
  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.")
end

Instance Method Details

#to_jsonString

Returns:

  • (String)


76
77
78
# File 'lib/paid_ruby/types/order_line_attribute_pricing.rb', line 76

def to_json
  @_field_set&.to_json
end