Class: Appwrite::Models::Oauth2Token

Inherits:
Object
  • Object
show all
Defined in:
lib/appwrite/models/oauth2_token.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(access_token:, token_type:, expires_in:, refresh_token:, scope:, authorization_details:, id_token:) ⇒ Oauth2Token

Returns a new instance of Oauth2Token.



14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/appwrite/models/oauth2_token.rb', line 14

def initialize(
    access_token:,
    token_type:,
    expires_in:,
    refresh_token:,
    scope:,
    authorization_details: ,
    id_token: 
)
    @access_token = access_token
    @token_type = token_type
    @expires_in = expires_in
    @refresh_token = refresh_token
    @scope = scope
    @authorization_details = authorization_details
    @id_token = id_token
end

Instance Attribute Details

#access_tokenObject (readonly)

Returns the value of attribute access_token.



6
7
8
# File 'lib/appwrite/models/oauth2_token.rb', line 6

def access_token
  @access_token
end

#authorization_detailsObject (readonly)

Returns the value of attribute authorization_details.



11
12
13
# File 'lib/appwrite/models/oauth2_token.rb', line 11

def authorization_details
  @authorization_details
end

#expires_inObject (readonly)

Returns the value of attribute expires_in.



8
9
10
# File 'lib/appwrite/models/oauth2_token.rb', line 8

def expires_in
  @expires_in
end

#id_tokenObject (readonly)

Returns the value of attribute id_token.



12
13
14
# File 'lib/appwrite/models/oauth2_token.rb', line 12

def id_token
  @id_token
end

#refresh_tokenObject (readonly)

Returns the value of attribute refresh_token.



9
10
11
# File 'lib/appwrite/models/oauth2_token.rb', line 9

def refresh_token
  @refresh_token
end

#scopeObject (readonly)

Returns the value of attribute scope.



10
11
12
# File 'lib/appwrite/models/oauth2_token.rb', line 10

def scope
  @scope
end

#token_typeObject (readonly)

Returns the value of attribute token_type.



7
8
9
# File 'lib/appwrite/models/oauth2_token.rb', line 7

def token_type
  @token_type
end

Class Method Details

.from(map:) ⇒ Object



32
33
34
35
36
37
38
39
40
41
42
# File 'lib/appwrite/models/oauth2_token.rb', line 32

def self.from(map:)
    Oauth2Token.new(
        access_token: map["access_token"],
        token_type: map["token_type"],
        expires_in: map["expires_in"],
        refresh_token: map["refresh_token"],
        scope: map["scope"],
        authorization_details: map["authorization_details"],
        id_token: map["id_token"]
    )
end

Instance Method Details

#to_mapObject



44
45
46
47
48
49
50
51
52
53
54
# File 'lib/appwrite/models/oauth2_token.rb', line 44

def to_map
    {
        "access_token": @access_token,
        "token_type": @token_type,
        "expires_in": @expires_in,
        "refresh_token": @refresh_token,
        "scope": @scope,
        "authorization_details": @authorization_details,
        "id_token": @id_token
    }
end