Class: Vapi::TwilioCredential

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

Constant Summary collapse

OMIT =
Object.new

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(provider:, id:, org_id:, created_at:, updated_at:, account_sid:, auth_token: OMIT, api_key: OMIT, api_secret: OMIT, name: OMIT, additional_properties: nil) ⇒ Vapi::TwilioCredential



49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
# File 'lib/vapi_server_sdk/types/twilio_credential.rb', line 49

def initialize(provider:, id:, org_id:, created_at:, updated_at:, account_sid:, auth_token: OMIT, api_key: OMIT,
               api_secret: OMIT, name: OMIT, additional_properties: nil)
  @provider = provider
  @auth_token = auth_token if auth_token != OMIT
  @api_key = api_key if api_key != OMIT
  @api_secret = api_secret if api_secret != OMIT
  @id = id
  @org_id = org_id
  @created_at = created_at
  @updated_at = updated_at
  @name = name if name != OMIT
  @account_sid = 
  @additional_properties = additional_properties
  @_field_set = {
    "provider": provider,
    "authToken": auth_token,
    "apiKey": api_key,
    "apiSecret": api_secret,
    "id": id,
    "orgId": org_id,
    "createdAt": created_at,
    "updatedAt": updated_at,
    "name": name,
    "accountSid": 
  }.reject do |_k, v|
    v == OMIT
  end
end

Instance Attribute Details

#account_sidString (readonly)



28
29
30
# File 'lib/vapi_server_sdk/types/twilio_credential.rb', line 28

def 
  @account_sid
end

#additional_propertiesOpenStruct (readonly)



30
31
32
# File 'lib/vapi_server_sdk/types/twilio_credential.rb', line 30

def additional_properties
  @additional_properties
end

#api_keyString (readonly)



14
15
16
# File 'lib/vapi_server_sdk/types/twilio_credential.rb', line 14

def api_key
  @api_key
end

#api_secretString (readonly)



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

def api_secret
  @api_secret
end

#auth_tokenString (readonly)



12
13
14
# File 'lib/vapi_server_sdk/types/twilio_credential.rb', line 12

def auth_token
  @auth_token
end

#created_atDateTime (readonly)



22
23
24
# File 'lib/vapi_server_sdk/types/twilio_credential.rb', line 22

def created_at
  @created_at
end

#idString (readonly)



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

def id
  @id
end

#nameString (readonly)



26
27
28
# File 'lib/vapi_server_sdk/types/twilio_credential.rb', line 26

def name
  @name
end

#org_idString (readonly)



20
21
22
# File 'lib/vapi_server_sdk/types/twilio_credential.rb', line 20

def org_id
  @org_id
end

#providerString (readonly)



10
11
12
# File 'lib/vapi_server_sdk/types/twilio_credential.rb', line 10

def provider
  @provider
end

#updated_atDateTime (readonly)



24
25
26
# File 'lib/vapi_server_sdk/types/twilio_credential.rb', line 24

def updated_at
  @updated_at
end

Class Method Details

.from_json(json_object:) ⇒ Vapi::TwilioCredential

Deserialize a JSON object to an instance of TwilioCredential



82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
# File 'lib/vapi_server_sdk/types/twilio_credential.rb', line 82

def self.from_json(json_object:)
  struct = JSON.parse(json_object, object_class: OpenStruct)
  parsed_json = JSON.parse(json_object)
  provider = parsed_json["provider"]
  auth_token = parsed_json["authToken"]
  api_key = parsed_json["apiKey"]
  api_secret = parsed_json["apiSecret"]
  id = parsed_json["id"]
  org_id = parsed_json["orgId"]
  created_at = (DateTime.parse(parsed_json["createdAt"]) unless parsed_json["createdAt"].nil?)
  updated_at = (DateTime.parse(parsed_json["updatedAt"]) unless parsed_json["updatedAt"].nil?)
  name = parsed_json["name"]
   = parsed_json["accountSid"]
  new(
    provider: provider,
    auth_token: auth_token,
    api_key: api_key,
    api_secret: api_secret,
    id: id,
    org_id: org_id,
    created_at: created_at,
    updated_at: updated_at,
    name: name,
    account_sid: ,
    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.


123
124
125
126
127
128
129
130
131
132
133
134
# File 'lib/vapi_server_sdk/types/twilio_credential.rb', line 123

def self.validate_raw(obj:)
  obj.provider.is_a?(String) != false || raise("Passed value for field obj.provider is not the expected type, validation failed.")
  obj.auth_token&.is_a?(String) != false || raise("Passed value for field obj.auth_token is not the expected type, validation failed.")
  obj.api_key&.is_a?(String) != false || raise("Passed value for field obj.api_key is not the expected type, validation failed.")
  obj.api_secret&.is_a?(String) != false || raise("Passed value for field obj.api_secret is not the expected type, validation failed.")
  obj.id.is_a?(String) != false || raise("Passed value for field obj.id is not the expected type, validation failed.")
  obj.org_id.is_a?(String) != false || raise("Passed value for field obj.org_id is not the expected type, validation failed.")
  obj.created_at.is_a?(DateTime) != false || raise("Passed value for field obj.created_at is not the expected type, validation failed.")
  obj.updated_at.is_a?(DateTime) != false || raise("Passed value for field obj.updated_at is not the expected type, validation failed.")
  obj.name&.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.")
  obj..is_a?(String) != false || raise("Passed value for field obj.account_sid is not the expected type, validation failed.")
end

Instance Method Details

#to_json(*_args) ⇒ String

Serialize an instance of TwilioCredential to a JSON object



113
114
115
# File 'lib/vapi_server_sdk/types/twilio_credential.rb', line 113

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