Class: Gusto::Authentication
- Inherits:
-
Object
- Object
- Gusto::Authentication
- Defined in:
- lib/fern_gusto/types/authentication.rb
Constant Summary collapse
- OMIT =
Object.new
Instance Attribute Summary collapse
-
#access_token ⇒ String
readonly
A new access token that can be used for subsequent authenticated requests.
-
#additional_properties ⇒ OpenStruct
readonly
Additional properties unmapped to the current class definition.
-
#created_at ⇒ String
readonly
Datetime for when the new access token is created.
-
#expires_in ⇒ Object
readonly
endpoint to continue making authenticated requests.
-
#refresh_token ⇒ Object
readonly
authenticated token.
-
#scope ⇒ String
readonly
All of the scopes for which the access token provides access.
-
#token_type ⇒ String
readonly
The literal string ‘bearer’.
Class Method Summary collapse
Instance Method Summary collapse
- #initialize(access_token: OMIT, token_type: OMIT, expires_in: OMIT, refresh_token: OMIT, created_at: OMIT, scope: OMIT, additional_properties: nil) ⇒ Gusto::Authentication constructor
- #to_json ⇒ String
Constructor Details
#initialize(access_token: OMIT, token_type: OMIT, expires_in: OMIT, refresh_token: OMIT, created_at: OMIT, scope: OMIT, additional_properties: nil) ⇒ Gusto::Authentication
40 41 42 43 44 45 46 47 48 49 50 51 |
# File 'lib/fern_gusto/types/authentication.rb', line 40 def initialize(access_token: OMIT, token_type: OMIT, expires_in: OMIT, refresh_token: OMIT, created_at: OMIT, scope: OMIT, additional_properties: nil) @access_token = access_token if access_token != OMIT @token_type = token_type if token_type != OMIT @expires_in = expires_in if expires_in != OMIT @refresh_token = refresh_token if refresh_token != OMIT @created_at = created_at if created_at != OMIT @scope = scope if scope != OMIT @additional_properties = additional_properties @_field_set = { "access_token": access_token, "token_type": token_type, "expires_in": expires_in, "refresh_token": refresh_token, "created_at": created_at, "scope": scope }.reject do | _k, v | v == OMIT end end |
Instance Attribute Details
#access_token ⇒ String (readonly)
Returns A new access token that can be used for subsequent authenticated requests.
9 10 11 |
# File 'lib/fern_gusto/types/authentication.rb', line 9 def access_token @access_token end |
#additional_properties ⇒ OpenStruct (readonly)
Returns Additional properties unmapped to the current class definition.
23 24 25 |
# File 'lib/fern_gusto/types/authentication.rb', line 23 def additional_properties @additional_properties end |
#created_at ⇒ String (readonly)
Returns Datetime for when the new access token is created.
19 20 21 |
# File 'lib/fern_gusto/types/authentication.rb', line 19 def created_at @created_at end |
#expires_in ⇒ Object (readonly)
endpoint to continue making authenticated requests.
14 15 16 |
# File 'lib/fern_gusto/types/authentication.rb', line 14 def expires_in @expires_in end |
#refresh_token ⇒ Object (readonly)
authenticated token.
17 18 19 |
# File 'lib/fern_gusto/types/authentication.rb', line 17 def refresh_token @refresh_token end |
#scope ⇒ String (readonly)
Returns All of the scopes for which the access token provides access.
21 22 23 |
# File 'lib/fern_gusto/types/authentication.rb', line 21 def scope @scope end |
#token_type ⇒ String (readonly)
Returns The literal string ‘bearer’.
11 12 13 |
# File 'lib/fern_gusto/types/authentication.rb', line 11 def token_type @token_type end |
Class Method Details
.from_json(json_object:) ⇒ Gusto::Authentication
56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 |
# File 'lib/fern_gusto/types/authentication.rb', line 56 def self.from_json(json_object:) struct = JSON.parse(json_object, object_class: OpenStruct) parsed_json = JSON.parse(json_object) access_token = parsed_json["access_token"] token_type = parsed_json["token_type"] expires_in = parsed_json["expires_in"] refresh_token = parsed_json["refresh_token"] created_at = parsed_json["created_at"] scope = parsed_json["scope"] new( access_token: access_token, token_type: token_type, expires_in: expires_in, refresh_token: refresh_token, created_at: created_at, scope: scope, additional_properties: struct ) end |
.validate_raw(obj:) ⇒ Void
87 88 89 90 91 92 93 94 |
# File 'lib/fern_gusto/types/authentication.rb', line 87 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.token_type&.is_a?(String) != false || raise("Passed value for field obj.token_type is not the expected type, validation failed.") obj.expires_in&.is_a?(Float) != false || raise("Passed value for field obj.expires_in 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.") obj.created_at&.is_a?(String) != false || raise("Passed value for field obj.created_at 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 ⇒ String
78 79 80 |
# File 'lib/fern_gusto/types/authentication.rb', line 78 def to_json @_field_set&.to_json end |