Class: Appwrite::Models::Token

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

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(id:, created_at:, user_id:, secret:, expire:, phrase:) ⇒ Token

Returns a new instance of Token.



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

def initialize(
    id:,
    created_at:,
    user_id:,
    secret:,
    expire:,
    phrase:
)
    @id = id
    @created_at = created_at
    @user_id = user_id
    @secret = secret
    @expire = expire
    @phrase = phrase
end

Instance Attribute Details

#created_atObject (readonly)

Returns the value of attribute created_at.



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

def created_at
  @created_at
end

#expireObject (readonly)

Returns the value of attribute expire.



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

def expire
  @expire
end

#idObject (readonly)

Returns the value of attribute id.



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

def id
  @id
end

#phraseObject (readonly)

Returns the value of attribute phrase.



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

def phrase
  @phrase
end

#secretObject (readonly)

Returns the value of attribute secret.



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

def secret
  @secret
end

#user_idObject (readonly)

Returns the value of attribute user_id.



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

def user_id
  @user_id
end

Class Method Details

.from(map:) ⇒ Object



29
30
31
32
33
34
35
36
37
38
# File 'lib/appwrite/models/token.rb', line 29

def self.from(map:)
    Token.new(
        id: map["$id"],
        created_at: map["$createdAt"],
        user_id: map["userId"],
        secret: map["secret"],
        expire: map["expire"],
        phrase: map["phrase"]
    )
end

Instance Method Details

#to_mapObject



40
41
42
43
44
45
46
47
48
49
# File 'lib/appwrite/models/token.rb', line 40

def to_map
    {
        "$id": @id,
        "$createdAt": @created_at,
        "userId": @user_id,
        "secret": @secret,
        "expire": @expire,
        "phrase": @phrase
    }
end