Class: Vapi::OAuth2AuthenticationPlan

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

Constant Summary collapse

OMIT =
Object.new

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(url:, client_id:, client_secret:, scope: OMIT, additional_properties: nil) ⇒ Vapi::OAuth2AuthenticationPlan

Parameters:

  • url (String)

    This is the OAuth2 URL.

  • client_id (String)

    This is the OAuth2 client ID.

  • client_secret (String)

    This is the OAuth2 client secret.

  • scope (String) (defaults to: OMIT)

    This is the scope of the OAuth2 token.

  • additional_properties (OpenStruct) (defaults to: nil)

    Additional properties unmapped to the current class definition



30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
# File 'lib/vapi_server_sdk/types/o_auth_2_authentication_plan.rb', line 30

def initialize(url:, client_id:, client_secret:, scope: OMIT, additional_properties: nil)
  @url = url
  @client_id = client_id
  @client_secret = client_secret
  @scope = scope if scope != OMIT
  @additional_properties = additional_properties
  @_field_set = {
    "url": url,
    "clientId": client_id,
    "clientSecret": client_secret,
    "scope": scope
  }.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



17
18
19
# File 'lib/vapi_server_sdk/types/o_auth_2_authentication_plan.rb', line 17

def additional_properties
  @additional_properties
end

#client_idString (readonly)

Returns This is the OAuth2 client ID.

Returns:

  • (String)

    This is the OAuth2 client ID.



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

def client_id
  @client_id
end

#client_secretString (readonly)

Returns This is the OAuth2 client secret.

Returns:

  • (String)

    This is the OAuth2 client secret.



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

def client_secret
  @client_secret
end

#scopeString (readonly)

Returns This is the scope of the OAuth2 token.

Returns:

  • (String)

    This is the scope of the OAuth2 token.



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

def scope
  @scope
end

#urlString (readonly)

Returns This is the OAuth2 URL.

Returns:

  • (String)

    This is the OAuth2 URL.



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

def url
  @url
end

Class Method Details

.from_json(json_object:) ⇒ Vapi::OAuth2AuthenticationPlan

Deserialize a JSON object to an instance of OAuth2AuthenticationPlan

Parameters:

  • json_object (String)

Returns:



50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
# File 'lib/vapi_server_sdk/types/o_auth_2_authentication_plan.rb', line 50

def self.from_json(json_object:)
  struct = JSON.parse(json_object, object_class: OpenStruct)
  parsed_json = JSON.parse(json_object)
  url = parsed_json["url"]
  client_id = parsed_json["clientId"]
  client_secret = parsed_json["clientSecret"]
  scope = parsed_json["scope"]
  new(
    url: url,
    client_id: client_id,
    client_secret: client_secret,
    scope: scope,
    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)


79
80
81
82
83
84
# File 'lib/vapi_server_sdk/types/o_auth_2_authentication_plan.rb', line 79

def self.validate_raw(obj:)
  obj.url.is_a?(String) != false || raise("Passed value for field obj.url is not the expected type, validation failed.")
  obj.client_id.is_a?(String) != false || raise("Passed value for field obj.client_id is not the expected type, validation failed.")
  obj.client_secret.is_a?(String) != false || raise("Passed value for field obj.client_secret is not the expected type, validation failed.")
  obj.scope&.is_a?(String) != false || raise("Passed value for field obj.scope is not the expected type, validation failed.")
end

Instance Method Details

#to_json(*_args) ⇒ String

Serialize an instance of OAuth2AuthenticationPlan to a JSON object

Returns:

  • (String)


69
70
71
# File 'lib/vapi_server_sdk/types/o_auth_2_authentication_plan.rb', line 69

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