Class: Vapi::Oauth2AuthenticationSession
- Inherits:
-
Object
- Object
- Vapi::Oauth2AuthenticationSession
- Defined in:
- lib/vapi_server_sdk/types/oauth_2_authentication_session.rb
Constant Summary collapse
- OMIT =
Object.new
Instance Attribute Summary collapse
-
#access_token ⇒ String
readonly
This is the OAuth2 access token.
-
#additional_properties ⇒ OpenStruct
readonly
Additional properties unmapped to the current class definition.
-
#expires_at ⇒ DateTime
readonly
This is the OAuth2 access token expiration.
-
#refresh_token ⇒ String
readonly
This is the OAuth2 refresh token.
Class Method Summary collapse
-
.from_json(json_object:) ⇒ Vapi::Oauth2AuthenticationSession
Deserialize a JSON object to an instance of Oauth2AuthenticationSession.
-
.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.
Instance Method Summary collapse
- #initialize(access_token: OMIT, expires_at: OMIT, refresh_token: OMIT, additional_properties: nil) ⇒ Vapi::Oauth2AuthenticationSession constructor
-
#to_json(*_args) ⇒ String
Serialize an instance of Oauth2AuthenticationSession to a JSON object.
Constructor Details
#initialize(access_token: OMIT, expires_at: OMIT, refresh_token: OMIT, additional_properties: nil) ⇒ Vapi::Oauth2AuthenticationSession
28 29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/vapi_server_sdk/types/oauth_2_authentication_session.rb', line 28 def initialize(access_token: OMIT, expires_at: OMIT, refresh_token: OMIT, additional_properties: nil) @access_token = access_token if access_token != OMIT @expires_at = expires_at if expires_at != OMIT @refresh_token = refresh_token if refresh_token != OMIT @additional_properties = additional_properties @_field_set = { "accessToken": access_token, "expiresAt": expires_at, "refreshToken": refresh_token }.reject do |_k, v| v == OMIT end end |
Instance Attribute Details
#access_token ⇒ String (readonly)
Returns This is the OAuth2 access token.
10 11 12 |
# File 'lib/vapi_server_sdk/types/oauth_2_authentication_session.rb', line 10 def access_token @access_token end |
#additional_properties ⇒ OpenStruct (readonly)
Returns Additional properties unmapped to the current class definition.
16 17 18 |
# File 'lib/vapi_server_sdk/types/oauth_2_authentication_session.rb', line 16 def additional_properties @additional_properties end |
#expires_at ⇒ DateTime (readonly)
Returns This is the OAuth2 access token expiration.
12 13 14 |
# File 'lib/vapi_server_sdk/types/oauth_2_authentication_session.rb', line 12 def expires_at @expires_at end |
#refresh_token ⇒ String (readonly)
Returns This is the OAuth2 refresh token.
14 15 16 |
# File 'lib/vapi_server_sdk/types/oauth_2_authentication_session.rb', line 14 def refresh_token @refresh_token end |
Class Method Details
.from_json(json_object:) ⇒ Vapi::Oauth2AuthenticationSession
Deserialize a JSON object to an instance of Oauth2AuthenticationSession
46 47 48 49 50 51 52 53 54 55 56 57 58 |
# File 'lib/vapi_server_sdk/types/oauth_2_authentication_session.rb', line 46 def self.from_json(json_object:) struct = JSON.parse(json_object, object_class: OpenStruct) parsed_json = JSON.parse(json_object) access_token = parsed_json["accessToken"] expires_at = (DateTime.parse(parsed_json["expiresAt"]) unless parsed_json["expiresAt"].nil?) refresh_token = parsed_json["refreshToken"] new( access_token: access_token, expires_at: expires_at, refresh_token: refresh_token, 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.
73 74 75 76 77 |
# File 'lib/vapi_server_sdk/types/oauth_2_authentication_session.rb', line 73 def self.validate_raw(obj:) obj.access_token&.is_a?(String) != false || raise("Passed value for field obj.access_token is not the expected type, validation failed.") obj.expires_at&.is_a?(DateTime) != false || raise("Passed value for field obj.expires_at is not the expected type, validation failed.") obj.refresh_token&.is_a?(String) != false || raise("Passed value for field obj.refresh_token is not the expected type, validation failed.") end |
Instance Method Details
#to_json(*_args) ⇒ String
Serialize an instance of Oauth2AuthenticationSession to a JSON object
63 64 65 |
# File 'lib/vapi_server_sdk/types/oauth_2_authentication_session.rb', line 63 def to_json(*_args) @_field_set&.to_json end |