Class: Vapi::OrgPlan

Inherits:
Object
  • Object
show all
Defined in:
lib/vapi_server_sdk/types/org_plan.rb

Constant Summary collapse

OMIT =
Object.new

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(included_providers: OMIT, included_minutes: OMIT, cost_per_overage_minute: OMIT, additional_properties: nil) ⇒ Vapi::OrgPlan

Parameters:

  • included_providers (Array<Hash{String => Object}>) (defaults to: OMIT)
  • included_minutes (Float) (defaults to: OMIT)
  • cost_per_overage_minute (Float) (defaults to: OMIT)
  • additional_properties (OpenStruct) (defaults to: nil)

    Additional properties unmapped to the current class definition



27
28
29
30
31
32
33
34
35
36
37
38
39
40
# File 'lib/vapi_server_sdk/types/org_plan.rb', line 27

def initialize(included_providers: OMIT, included_minutes: OMIT, cost_per_overage_minute: OMIT,
               additional_properties: nil)
  @included_providers = included_providers if included_providers != OMIT
  @included_minutes = included_minutes if included_minutes != OMIT
  @cost_per_overage_minute = cost_per_overage_minute if cost_per_overage_minute != OMIT
  @additional_properties = additional_properties
  @_field_set = {
    "includedProviders": included_providers,
    "includedMinutes": included_minutes,
    "costPerOverageMinute": cost_per_overage_minute
  }.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



15
16
17
# File 'lib/vapi_server_sdk/types/org_plan.rb', line 15

def additional_properties
  @additional_properties
end

#cost_per_overage_minuteFloat (readonly)

Returns:

  • (Float)


13
14
15
# File 'lib/vapi_server_sdk/types/org_plan.rb', line 13

def cost_per_overage_minute
  @cost_per_overage_minute
end

#included_minutesFloat (readonly)

Returns:

  • (Float)


11
12
13
# File 'lib/vapi_server_sdk/types/org_plan.rb', line 11

def included_minutes
  @included_minutes
end

#included_providersArray<Hash{String => Object}> (readonly)

Returns:

  • (Array<Hash{String => Object}>)


9
10
11
# File 'lib/vapi_server_sdk/types/org_plan.rb', line 9

def included_providers
  @included_providers
end

Class Method Details

.from_json(json_object:) ⇒ Vapi::OrgPlan

Deserialize a JSON object to an instance of OrgPlan

Parameters:

  • json_object (String)

Returns:



46
47
48
49
50
51
52
53
54
55
56
57
58
# File 'lib/vapi_server_sdk/types/org_plan.rb', line 46

def self.from_json(json_object:)
  struct = JSON.parse(json_object, object_class: OpenStruct)
  parsed_json = JSON.parse(json_object)
  included_providers = parsed_json["includedProviders"]
  included_minutes = parsed_json["includedMinutes"]
  cost_per_overage_minute = parsed_json["costPerOverageMinute"]
  new(
    included_providers: included_providers,
    included_minutes: included_minutes,
    cost_per_overage_minute: cost_per_overage_minute,
    additional_properties: struct
  )
end

.validate_raw(obj:) ⇒ Void

Leveraged for Union-type generation, validate_raw attempts to parse the given

hash and check each fields type against the current object's property
definitions.

Parameters:

  • obj (Object)

Returns:

  • (Void)


73
74
75
76
77
# File 'lib/vapi_server_sdk/types/org_plan.rb', line 73

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

Instance Method Details

#to_json(*_args) ⇒ String

Serialize an instance of OrgPlan to a JSON object

Returns:

  • (String)


63
64
65
# File 'lib/vapi_server_sdk/types/org_plan.rb', line 63

def to_json(*_args)
  @_field_set&.to_json
end