Class: Gusto::Companies::CompaniesCreateResponse
- Inherits:
-
Object
- Object
- Gusto::Companies::CompaniesCreateResponse
- Defined in:
- lib/fern_gusto/companies/types/companies_create_response.rb
Overview
Object returned when creating a partner managed company
Constant Summary collapse
- OMIT =
Object.new
Instance Attribute Summary collapse
-
#access_token ⇒ Object
readonly
expire 2 hours after they are issued.
-
#additional_properties ⇒ OpenStruct
readonly
Additional properties unmapped to the current class definition.
-
#company_uuid ⇒ String
readonly
Gusto’s UUID for the company.
-
#expires_in ⇒ Integer
readonly
Time of access_token expiration in seconds.
-
#refresh_token ⇒ String
readonly
Refresh token that can be exchanged for a new access token.
Class Method Summary collapse
Instance Method Summary collapse
- #initialize(access_token: OMIT, refresh_token: OMIT, company_uuid: OMIT, expires_in: OMIT, additional_properties: nil) ⇒ Gusto::Companies::CompaniesCreateResponse constructor
- #to_json ⇒ String
Constructor Details
#initialize(access_token: OMIT, refresh_token: OMIT, company_uuid: OMIT, expires_in: OMIT, additional_properties: nil) ⇒ Gusto::Companies::CompaniesCreateResponse
33 34 35 36 37 38 39 40 41 42 |
# File 'lib/fern_gusto/companies/types/companies_create_response.rb', line 33 def initialize(access_token: OMIT, refresh_token: OMIT, company_uuid: OMIT, expires_in: OMIT, additional_properties: nil) @access_token = access_token if access_token != OMIT @refresh_token = refresh_token if refresh_token != OMIT @company_uuid = company_uuid if company_uuid != OMIT @expires_in = expires_in if expires_in != OMIT @additional_properties = additional_properties @_field_set = { "access_token": access_token, "refresh_token": refresh_token, "company_uuid": company_uuid, "expires_in": expires_in }.reject do | _k, v | v == OMIT end end |
Instance Attribute Details
#access_token ⇒ Object (readonly)
expire 2 hours after they are issued.
11 12 13 |
# File 'lib/fern_gusto/companies/types/companies_create_response.rb', line 11 def access_token @access_token end |
#additional_properties ⇒ OpenStruct (readonly)
Returns Additional properties unmapped to the current class definition.
19 20 21 |
# File 'lib/fern_gusto/companies/types/companies_create_response.rb', line 19 def additional_properties @additional_properties end |
#company_uuid ⇒ String (readonly)
Returns Gusto’s UUID for the company.
15 16 17 |
# File 'lib/fern_gusto/companies/types/companies_create_response.rb', line 15 def company_uuid @company_uuid end |
#expires_in ⇒ Integer (readonly)
Returns Time of access_token expiration in seconds.
17 18 19 |
# File 'lib/fern_gusto/companies/types/companies_create_response.rb', line 17 def expires_in @expires_in end |
#refresh_token ⇒ String (readonly)
Returns Refresh token that can be exchanged for a new access token.
13 14 15 |
# File 'lib/fern_gusto/companies/types/companies_create_response.rb', line 13 def refresh_token @refresh_token end |
Class Method Details
.from_json(json_object:) ⇒ Gusto::Companies::CompaniesCreateResponse
47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 |
# File 'lib/fern_gusto/companies/types/companies_create_response.rb', line 47 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"] refresh_token = parsed_json["refresh_token"] company_uuid = parsed_json["company_uuid"] expires_in = parsed_json["expires_in"] new( access_token: access_token, refresh_token: refresh_token, company_uuid: company_uuid, expires_in: expires_in, additional_properties: struct ) end |
.validate_raw(obj:) ⇒ Void
74 75 76 77 78 79 |
# File 'lib/fern_gusto/companies/types/companies_create_response.rb', line 74 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.refresh_token&.is_a?(String) != false || raise("Passed value for field obj.refresh_token is not the expected type, validation failed.") obj.company_uuid&.is_a?(String) != false || raise("Passed value for field obj.company_uuid is not the expected type, validation failed.") obj.expires_in&.is_a?(Integer) != false || raise("Passed value for field obj.expires_in is not the expected type, validation failed.") end |
Instance Method Details
#to_json ⇒ String
65 66 67 |
# File 'lib/fern_gusto/companies/types/companies_create_response.rb', line 65 def to_json @_field_set&.to_json end |