Class: Gusto::Token::TokenGetInfoResponse

Inherits:
Object
  • Object
show all
Defined in:
lib/fern_gusto/token/types/token_get_info_response.rb

Constant Summary collapse

OMIT =
Object.new

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(scope:, resource:, resource_owner: OMIT, additional_properties: nil) ⇒ Gusto::Token::TokenGetInfoResponse

Parameters:



30
31
32
33
34
35
36
37
38
# File 'lib/fern_gusto/token/types/token_get_info_response.rb', line 30

def initialize(scope:, resource:, resource_owner: OMIT, additional_properties: nil)
  @scope = scope
  @resource = resource
  @resource_owner = resource_owner if resource_owner != OMIT
  @additional_properties = additional_properties
  @_field_set = { "scope": scope, "resource": resource, "resource_owner": resource_owner }.reject do | _k, v |
  v == OMIT
end
end

Instance Attribute Details

#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/fern_gusto/token/types/token_get_info_response.rb', line 18

def additional_properties
  @additional_properties
end

#resourceGusto::Token::TokenGetInfoResponseResource (readonly)

Returns Information about the token resource.

Returns:



14
15
16
# File 'lib/fern_gusto/token/types/token_get_info_response.rb', line 14

def resource
  @resource
end

#resource_ownerGusto::Token::TokenGetInfoResponseResourceOwner (readonly)

Returns Information about the token owner.

Returns:



16
17
18
# File 'lib/fern_gusto/token/types/token_get_info_response.rb', line 16

def resource_owner
  @resource_owner
end

#scopeString (readonly)

Returns Space delimited string of accessible scopes.

Returns:

  • (String)

    Space delimited string of accessible scopes.



12
13
14
# File 'lib/fern_gusto/token/types/token_get_info_response.rb', line 12

def scope
  @scope
end

Class Method Details

.from_json(json_object:) ⇒ Gusto::Token::TokenGetInfoResponse

Parameters:

  • json_object (String)

Returns:



43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
# File 'lib/fern_gusto/token/types/token_get_info_response.rb', line 43

def self.from_json(json_object:)
  struct = JSON.parse(json_object, object_class: OpenStruct)
  parsed_json = JSON.parse(json_object)
  scope = parsed_json["scope"]
  unless parsed_json["resource"].nil?
    resource = parsed_json["resource"].to_json
    resource = Gusto::Token::TokenGetInfoResponseResource.from_json(json_object: resource)
  else
    resource = nil
  end
  unless parsed_json["resource_owner"].nil?
    resource_owner = parsed_json["resource_owner"].to_json
    resource_owner = Gusto::Token::TokenGetInfoResponseResourceOwner.from_json(json_object: resource_owner)
  else
    resource_owner = nil
  end
  new(
    scope: scope,
    resource: resource,
    resource_owner: resource_owner,
    additional_properties: struct
  )
end

.validate_raw(obj:) ⇒ Void

Parameters:

  • obj (Object)

Returns:

  • (Void)


78
79
80
81
82
# File 'lib/fern_gusto/token/types/token_get_info_response.rb', line 78

def self.validate_raw(obj:)
  obj.scope.is_a?(String) != false || raise("Passed value for field obj.scope is not the expected type, validation failed.")
  Gusto::Token::TokenGetInfoResponseResource.validate_raw(obj: obj.resource)
  obj.resource_owner.nil? || Gusto::Token::TokenGetInfoResponseResourceOwner.validate_raw(obj: obj.resource_owner)
end

Instance Method Details

#to_jsonString

Returns:

  • (String)


69
70
71
# File 'lib/fern_gusto/token/types/token_get_info_response.rb', line 69

def to_json
  @_field_set&.to_json
end