Class: Gusto::Companies::CompaniesCreateResponse

Inherits:
Object
  • Object
show all
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

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(access_token: OMIT, refresh_token: OMIT, company_uuid: OMIT, expires_in: OMIT, additional_properties: nil) ⇒ Gusto::Companies::CompaniesCreateResponse

Parameters:

  • refresh_token (String) (defaults to: OMIT)

    Refresh token that can be exchanged for a new access token.

  • company_uuid (String) (defaults to: OMIT)

    Gusto’s UUID for the company

  • expires_in (Integer) (defaults to: OMIT)

    Time of access_token expiration in seconds

  • additional_properties (OpenStruct) (defaults to: nil)

    Additional properties unmapped to the current class definition



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_tokenObject (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_propertiesOpenStruct (readonly)

Returns Additional properties unmapped to the current class definition.

Returns:

  • (OpenStruct)

    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_uuidString (readonly)

Returns Gusto’s UUID for the company.

Returns:

  • (String)

    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_inInteger (readonly)

Returns Time of access_token expiration in seconds.

Returns:

  • (Integer)

    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_tokenString (readonly)

Returns Refresh token that can be exchanged for a new access token.

Returns:

  • (String)

    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

Parameters:

  • json_object (String)

Returns:



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

Parameters:

  • obj (Object)

Returns:

  • (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_jsonString

Returns:

  • (String)


65
66
67
# File 'lib/fern_gusto/companies/types/companies_create_response.rb', line 65

def to_json
  @_field_set&.to_json
end