Class: Pago::V2026_04::Models::TokenResponse

Inherits:
Model
  • Object
show all
Defined in:
lib/pago/v2026_04/models.rb,
sig/pago/v2026_04/generated.rbs

Constant Summary collapse

JSON_KEYS =

Returns:

  • (Hash[Symbol, String])
{
  access_token: "access_token",
  token_type: "token_type",
  expires_in: "expires_in",
  refresh_token: "refresh_token",
  scope: "scope",
  id_token: "id_token"
}.freeze
REQUIRED_KEYS =

Returns:

  • (Array[String])
["access_token", "token_type", "expires_in", "scope"].freeze

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Model

#==, #[], #field_set?, #hash, #inspect, json_keys, required_json_keys, #to_json, #to_json_hash, wrap_raw

Constructor Details

#initialize(access_token:, token_type:, expires_in:, refresh_token: ::Pago::UNSET, scope:, id_token: ::Pago::UNSET) ⇒ TokenResponse

Returns a new instance of TokenResponse.

Parameters:

  • access_token: (String)
  • token_type: (String)
  • expires_in: (Integer)
  • refresh_token: (String, nil) (defaults to: ::Pago::UNSET)
  • scope: (String)
  • id_token: (String, nil) (defaults to: ::Pago::UNSET)


43447
43448
43449
43450
43451
43452
43453
43454
43455
43456
43457
43458
43459
43460
43461
43462
# File 'lib/pago/v2026_04/models.rb', line 43447

def initialize(
  access_token:,
  token_type:,
  expires_in:,
  refresh_token: ::Pago::UNSET,
  scope:,
  id_token: ::Pago::UNSET
)
  super()
  assign(:access_token, access_token)
  assign(:token_type, token_type)
  assign(:expires_in, expires_in)
  assign(:refresh_token, refresh_token)
  assign(:scope, scope)
  assign(:id_token, id_token)
end

Instance Attribute Details

#access_tokenString (readonly)

Returns:

  • (String)


43430
43431
43432
# File 'lib/pago/v2026_04/models.rb', line 43430

def access_token
  @access_token
end

#expires_inInteger (readonly)

Returns:

  • (Integer)


43436
43437
43438
# File 'lib/pago/v2026_04/models.rb', line 43436

def expires_in
  @expires_in
end

#id_tokenString? (readonly)

Returns:

  • (String, nil)


43445
43446
43447
# File 'lib/pago/v2026_04/models.rb', line 43445

def id_token
  @id_token
end

#refresh_tokenString? (readonly)

Returns:

  • (String, nil)


43439
43440
43441
# File 'lib/pago/v2026_04/models.rb', line 43439

def refresh_token
  @refresh_token
end

#scopeString (readonly)

Returns:

  • (String)


43442
43443
43444
# File 'lib/pago/v2026_04/models.rb', line 43442

def scope
  @scope
end

#token_typeString (readonly)

Returns:

  • (String)


43433
43434
43435
# File 'lib/pago/v2026_04/models.rb', line 43433

def token_type
  @token_type
end

Class Method Details

.from_json(data) ⇒ TokenResponse?

Parameters:

  • data (Hash, String, nil)

Returns:



43466
43467
43468
43469
43470
43471
43472
43473
43474
43475
43476
43477
43478
43479
43480
43481
43482
# File 'lib/pago/v2026_04/models.rb', line 43466

def self.from_json(data)
  data = ::JSON.parse(data) if data.is_a?(String)
  data = ::Pago::Serde.object(data)
  return nil if data.nil?

  wrap_raw(
    new(
      access_token: (data.key?("access_token") ? data["access_token"] : ::Pago::UNSET),
      token_type: (data.key?("token_type") ? data["token_type"] : ::Pago::UNSET),
      expires_in: (data.key?("expires_in") ? data["expires_in"] : ::Pago::UNSET),
      refresh_token: (data.key?("refresh_token") ? data["refresh_token"] : ::Pago::UNSET),
      scope: (data.key?("scope") ? data["scope"] : ::Pago::UNSET),
      id_token: (data.key?("id_token") ? data["id_token"] : ::Pago::UNSET)
    ),
    data
  )
end