Class: CandidApiClient::Auth::V2::Types::AuthGetTokenResponse

Inherits:
Object
  • Object
show all
Defined in:
lib/candidhealth/auth/v_2/types/auth_get_token_response.rb

Constant Summary collapse

OMIT =
Object.new

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(access_token:, expires_in:, token_type:, additional_properties: nil) ⇒ CandidApiClient::Auth::V2::Types::AuthGetTokenResponse

Parameters:

  • access_token (String)
  • expires_in (Integer)

    Time in seconds.

  • token_type (String)
  • additional_properties (OpenStruct) (defaults to: nil)

    Additional properties unmapped to the current class definition



30
31
32
33
34
35
36
# File 'lib/candidhealth/auth/v_2/types/auth_get_token_response.rb', line 30

def initialize(access_token:, expires_in:, token_type:, additional_properties: nil)
  @access_token = access_token
  @expires_in = expires_in
  @token_type = token_type
  @additional_properties = additional_properties
  @_field_set = { "access_token": access_token, "expires_in": expires_in, "token_type": token_type }
end

Instance Attribute Details

#access_tokenString (readonly)

Returns:

  • (String)


12
13
14
# File 'lib/candidhealth/auth/v_2/types/auth_get_token_response.rb', line 12

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



18
19
20
# File 'lib/candidhealth/auth/v_2/types/auth_get_token_response.rb', line 18

def additional_properties
  @additional_properties
end

#expires_inInteger (readonly)

Returns Time in seconds.

Returns:

  • (Integer)

    Time in seconds.



14
15
16
# File 'lib/candidhealth/auth/v_2/types/auth_get_token_response.rb', line 14

def expires_in
  @expires_in
end

#token_typeString (readonly)

Returns:

  • (String)


16
17
18
# File 'lib/candidhealth/auth/v_2/types/auth_get_token_response.rb', line 16

def token_type
  @token_type
end

Class Method Details

.from_json(json_object:) ⇒ CandidApiClient::Auth::V2::Types::AuthGetTokenResponse

Deserialize a JSON object to an instance of AuthGetTokenResponse

Parameters:

  • json_object (String)

Returns:



42
43
44
45
46
47
48
49
50
51
52
53
# File 'lib/candidhealth/auth/v_2/types/auth_get_token_response.rb', line 42

def self.from_json(json_object:)
  struct = JSON.parse(json_object, object_class: OpenStruct)
  access_token = struct["access_token"]
  expires_in = struct["expires_in"]
  token_type = struct["token_type"]
  new(
    access_token: access_token,
    expires_in: expires_in,
    token_type: token_type,
    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.

Parameters:

  • obj (Object)

Returns:

  • (Void)


68
69
70
71
72
# File 'lib/candidhealth/auth/v_2/types/auth_get_token_response.rb', line 68

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

Instance Method Details

#to_json(*_args) ⇒ String

Serialize an instance of AuthGetTokenResponse to a JSON object

Returns:

  • (String)


58
59
60
# File 'lib/candidhealth/auth/v_2/types/auth_get_token_response.rb', line 58

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