Class: Paid::AgentPricePointTiers

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

Constant Summary collapse

OMIT =
Object.new

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(min_quantity: OMIT, max_quantity: OMIT, unit_price:, additional_properties: nil) ⇒ Paid::AgentPricePointTiers

Parameters:

  • min_quantity (Float) (defaults to: OMIT)
  • max_quantity (Float) (defaults to: OMIT)
  • unit_price (Float)
  • additional_properties (OpenStruct) (defaults to: nil)

    Additional properties unmapped to the current class definition



26
27
28
29
30
31
32
33
34
# File 'lib/paid_ruby/types/agent_price_point_tiers.rb', line 26

def initialize(min_quantity: OMIT, max_quantity: OMIT, unit_price:, additional_properties: nil)
  @min_quantity = min_quantity if min_quantity != OMIT
  @max_quantity = max_quantity if max_quantity != OMIT
  @unit_price = unit_price
  @additional_properties = additional_properties
  @_field_set = { "minQuantity": min_quantity, "maxQuantity": max_quantity, "unitPrice": unit_price }.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



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

def additional_properties
  @additional_properties
end

#max_quantityFloat (readonly)

Returns:

  • (Float)


10
11
12
# File 'lib/paid_ruby/types/agent_price_point_tiers.rb', line 10

def max_quantity
  @max_quantity
end

#min_quantityFloat (readonly)

Returns:

  • (Float)


8
9
10
# File 'lib/paid_ruby/types/agent_price_point_tiers.rb', line 8

def min_quantity
  @min_quantity
end

#unit_priceFloat (readonly)

Returns:

  • (Float)


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

def unit_price
  @unit_price
end

Class Method Details

.from_json(json_object:) ⇒ Paid::AgentPricePointTiers

Parameters:

  • json_object (String)

Returns:



39
40
41
42
43
44
45
46
47
48
49
50
51
# File 'lib/paid_ruby/types/agent_price_point_tiers.rb', line 39

def self.from_json(json_object:)
  struct = JSON.parse(json_object, object_class: OpenStruct)
  parsed_json = JSON.parse(json_object)
  min_quantity = parsed_json["minQuantity"]
  max_quantity = parsed_json["maxQuantity"]
  unit_price = parsed_json["unitPrice"]
  new(
    min_quantity: min_quantity,
    max_quantity: max_quantity,
    unit_price: unit_price,
    additional_properties: struct
  )
end

.validate_raw(obj:) ⇒ Void

Parameters:

  • obj (Object)

Returns:

  • (Void)


64
65
66
67
68
# File 'lib/paid_ruby/types/agent_price_point_tiers.rb', line 64

def self.validate_raw(obj:)
  obj.min_quantity&.is_a?(Float) != false || raise("Passed value for field obj.min_quantity is not the expected type, validation failed.")
  obj.max_quantity&.is_a?(Float) != false || raise("Passed value for field obj.max_quantity is not the expected type, validation failed.")
  obj.unit_price.is_a?(Float) != false || raise("Passed value for field obj.unit_price is not the expected type, validation failed.")
end

Instance Method Details

#to_jsonString

Returns:

  • (String)


55
56
57
# File 'lib/paid_ruby/types/agent_price_point_tiers.rb', line 55

def to_json
  @_field_set&.to_json
end