Class: Vapi::InvoicePlan

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

Constant Summary collapse

OMIT =
Object.new

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(company_name: OMIT, company_address: OMIT, company_tax_id: OMIT, company_email: OMIT, additional_properties: nil) ⇒ Vapi::InvoicePlan

Parameters:

  • company_name (String) (defaults to: OMIT)

    This is the name of the company.

  • company_address (String) (defaults to: OMIT)

    This is the address of the company.

  • company_tax_id (String) (defaults to: OMIT)

    This is the tax ID of the company.

  • company_email (String) (defaults to: OMIT)

    This is the preferred invoicing email of the company. If not specified, defaults to the subscription’s email.

  • additional_properties (OpenStruct) (defaults to: nil)

    Additional properties unmapped to the current class definition



32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
# File 'lib/vapi_server_sdk/types/invoice_plan.rb', line 32

def initialize(company_name: OMIT, company_address: OMIT, company_tax_id: OMIT, company_email: OMIT,
               additional_properties: nil)
  @company_name = company_name if company_name != OMIT
  @company_address = company_address if company_address != OMIT
  @company_tax_id = company_tax_id if company_tax_id != OMIT
  @company_email = company_email if company_email != OMIT
  @additional_properties = additional_properties
  @_field_set = {
    "companyName": company_name,
    "companyAddress": company_address,
    "companyTaxId": company_tax_id,
    "companyEmail": company_email
  }.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



18
19
20
# File 'lib/vapi_server_sdk/types/invoice_plan.rb', line 18

def additional_properties
  @additional_properties
end

#company_addressString (readonly)

Returns This is the address of the company.

Returns:

  • (String)

    This is the address of the company.



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

def company_address
  @company_address
end

#company_emailString (readonly)

Returns This is the preferred invoicing email of the company. If not specified, defaults to the subscription’s email.

Returns:

  • (String)

    This is the preferred invoicing email of the company. If not specified, defaults to the subscription’s email.



16
17
18
# File 'lib/vapi_server_sdk/types/invoice_plan.rb', line 16

def company_email
  @company_email
end

#company_nameString (readonly)

Returns This is the name of the company.

Returns:

  • (String)

    This is the name of the company.



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

def company_name
  @company_name
end

#company_tax_idString (readonly)

Returns This is the tax ID of the company.

Returns:

  • (String)

    This is the tax ID of the company.



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

def company_tax_id
  @company_tax_id
end

Class Method Details

.from_json(json_object:) ⇒ Vapi::InvoicePlan

Deserialize a JSON object to an instance of InvoicePlan

Parameters:

  • json_object (String)

Returns:



53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
# File 'lib/vapi_server_sdk/types/invoice_plan.rb', line 53

def self.from_json(json_object:)
  struct = JSON.parse(json_object, object_class: OpenStruct)
  parsed_json = JSON.parse(json_object)
  company_name = parsed_json["companyName"]
  company_address = parsed_json["companyAddress"]
  company_tax_id = parsed_json["companyTaxId"]
  company_email = parsed_json["companyEmail"]
  new(
    company_name: company_name,
    company_address: company_address,
    company_tax_id: company_tax_id,
    company_email: company_email,
    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)


82
83
84
85
86
87
# File 'lib/vapi_server_sdk/types/invoice_plan.rb', line 82

def self.validate_raw(obj:)
  obj.company_name&.is_a?(String) != false || raise("Passed value for field obj.company_name is not the expected type, validation failed.")
  obj.company_address&.is_a?(String) != false || raise("Passed value for field obj.company_address is not the expected type, validation failed.")
  obj.company_tax_id&.is_a?(String) != false || raise("Passed value for field obj.company_tax_id is not the expected type, validation failed.")
  obj.company_email&.is_a?(String) != false || raise("Passed value for field obj.company_email is not the expected type, validation failed.")
end

Instance Method Details

#to_json(*_args) ⇒ String

Serialize an instance of InvoicePlan to a JSON object

Returns:

  • (String)


72
73
74
# File 'lib/vapi_server_sdk/types/invoice_plan.rb', line 72

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