Class: Vapi::GoogleCalendarOAuth2AuthorizationCredential

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

Constant Summary collapse

OMIT =
Object.new

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(provider:, authorization_id:, id:, org_id:, created_at:, updated_at:, name: OMIT, additional_properties: nil) ⇒ Vapi::GoogleCalendarOAuth2AuthorizationCredential



40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
# File 'lib/vapi_server_sdk/types/google_calendar_o_auth_2_authorization_credential.rb', line 40

def initialize(provider:, authorization_id:, id:, org_id:, created_at:, updated_at:, name: OMIT,
               additional_properties: nil)
  @provider = provider
  @authorization_id = authorization_id
  @id = id
  @org_id = org_id
  @created_at = created_at
  @updated_at = updated_at
  @name = name if name != OMIT
  @additional_properties = additional_properties
  @_field_set = {
    "provider": provider,
    "authorizationId": authorization_id,
    "id": id,
    "orgId": org_id,
    "createdAt": created_at,
    "updatedAt": updated_at,
    "name": name
  }.reject do |_k, v|
    v == OMIT
  end
end

Instance Attribute Details

#additional_propertiesOpenStruct (readonly)



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

def additional_properties
  @additional_properties
end

#authorization_idString (readonly)



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

def authorization_id
  @authorization_id
end

#created_atDateTime (readonly)



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

def created_at
  @created_at
end

#idString (readonly)



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

def id
  @id
end

#nameString (readonly)



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

def name
  @name
end

#org_idString (readonly)



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

def org_id
  @org_id
end

#providerString (readonly)



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

def provider
  @provider
end

#updated_atDateTime (readonly)



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

def updated_at
  @updated_at
end

Class Method Details

.from_json(json_object:) ⇒ Vapi::GoogleCalendarOAuth2AuthorizationCredential

Deserialize a JSON object to an instance of

GoogleCalendarOAuth2AuthorizationCredential


68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
# File 'lib/vapi_server_sdk/types/google_calendar_o_auth_2_authorization_credential.rb', line 68

def self.from_json(json_object:)
  struct = JSON.parse(json_object, object_class: OpenStruct)
  parsed_json = JSON.parse(json_object)
  provider = parsed_json["provider"]
  authorization_id = parsed_json["authorizationId"]
  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"]
  new(
    provider: provider,
    authorization_id: authorization_id,
    id: id,
    org_id: org_id,
    created_at: created_at,
    updated_at: updated_at,
    name: name,
    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.


104
105
106
107
108
109
110
111
112
# File 'lib/vapi_server_sdk/types/google_calendar_o_auth_2_authorization_credential.rb', line 104

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.authorization_id.is_a?(String) != false || raise("Passed value for field obj.authorization_id 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.")
end

Instance Method Details

#to_json(*_args) ⇒ String

Serialize an instance of GoogleCalendarOAuth2AuthorizationCredential to a JSON

object


94
95
96
# File 'lib/vapi_server_sdk/types/google_calendar_o_auth_2_authorization_credential.rb', line 94

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