Class: Appwrite::Models::Session

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

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(id:, created_at:, updated_at:, user_id:, user_name:, expire:, provider:, provider_uid:, provider_access_token:, provider_access_token_expiry:, provider_refresh_token:, ip:, os_code:, os_name:, os_version:, client_type:, client_code:, client_name:, client_version:, client_engine:, client_engine_version:, device_name:, device_brand:, device_model:, country_code:, country_name:, current:, factors:, secret:, mfa_updated_at:) ⇒ Session

Returns a new instance of Session.



37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
# File 'lib/appwrite/models/session.rb', line 37

def initialize(
    id:,
    created_at:,
    updated_at:,
    user_id:,
    user_name:,
    expire:,
    provider:,
    provider_uid:,
    provider_access_token:,
    provider_access_token_expiry:,
    provider_refresh_token:,
    ip:,
    os_code:,
    os_name:,
    os_version:,
    client_type:,
    client_code:,
    client_name:,
    client_version:,
    client_engine:,
    client_engine_version:,
    device_name:,
    device_brand:,
    device_model:,
    country_code:,
    country_name:,
    current:,
    factors:,
    secret:,
    mfa_updated_at:
)
    @id = id
    @created_at = created_at
    @updated_at = updated_at
    @user_id = user_id
    @user_name = user_name
    @expire = expire
    @provider = provider
    @provider_uid = provider_uid
    @provider_access_token = provider_access_token
    @provider_access_token_expiry = provider_access_token_expiry
    @provider_refresh_token = provider_refresh_token
    @ip = ip
    @os_code = os_code
    @os_name = os_name
    @os_version = os_version
    @client_type = client_type
    @client_code = client_code
    @client_name = client_name
    @client_version = client_version
    @client_engine = client_engine
    @client_engine_version = client_engine_version
    @device_name = device_name
    @device_brand = device_brand
    @device_model = device_model
    @country_code = country_code
    @country_name = country_name
    @current = current
    @factors = factors
    @secret = secret
    @mfa_updated_at = mfa_updated_at
end

Instance Attribute Details

#client_code ⇒ Object (readonly)

Returns the value of attribute client_code.



22
23
24
# File 'lib/appwrite/models/session.rb', line 22

def client_code
  @client_code
end

#client_engine ⇒ Object (readonly)

Returns the value of attribute client_engine.



25
26
27
# File 'lib/appwrite/models/session.rb', line 25

def client_engine
  @client_engine
end

#client_engine_version ⇒ Object (readonly)

Returns the value of attribute client_engine_version.



26
27
28
# File 'lib/appwrite/models/session.rb', line 26

def client_engine_version
  @client_engine_version
end

#client_name ⇒ Object (readonly)

Returns the value of attribute client_name.



23
24
25
# File 'lib/appwrite/models/session.rb', line 23

def client_name
  @client_name
end

#client_type ⇒ Object (readonly)

Returns the value of attribute client_type.



21
22
23
# File 'lib/appwrite/models/session.rb', line 21

def client_type
  @client_type
end

#client_version ⇒ Object (readonly)

Returns the value of attribute client_version.



24
25
26
# File 'lib/appwrite/models/session.rb', line 24

def client_version
  @client_version
end

#country_code ⇒ Object (readonly)

Returns the value of attribute country_code.



30
31
32
# File 'lib/appwrite/models/session.rb', line 30

def country_code
  @country_code
end

#country_name ⇒ Object (readonly)

Returns the value of attribute country_name.



31
32
33
# File 'lib/appwrite/models/session.rb', line 31

def country_name
  @country_name
end

#created_at ⇒ Object (readonly)

Returns the value of attribute created_at.



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

def created_at
  @created_at
end

#current ⇒ Object (readonly)

Returns the value of attribute current.



32
33
34
# File 'lib/appwrite/models/session.rb', line 32

def current
  @current
end

#device_brand ⇒ Object (readonly)

Returns the value of attribute device_brand.



28
29
30
# File 'lib/appwrite/models/session.rb', line 28

def device_brand
  @device_brand
end

#device_model ⇒ Object (readonly)

Returns the value of attribute device_model.



29
30
31
# File 'lib/appwrite/models/session.rb', line 29

def device_model
  @device_model
end

#device_name ⇒ Object (readonly)

Returns the value of attribute device_name.



27
28
29
# File 'lib/appwrite/models/session.rb', line 27

def device_name
  @device_name
end

#expire ⇒ Object (readonly)

Returns the value of attribute expire.



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

def expire
  @expire
end

#factors ⇒ Object (readonly)

Returns the value of attribute factors.



33
34
35
# File 'lib/appwrite/models/session.rb', line 33

def factors
  @factors
end

#id ⇒ Object (readonly)

Returns the value of attribute id.



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

def id
  @id
end

#ip ⇒ Object (readonly)

Returns the value of attribute ip.



17
18
19
# File 'lib/appwrite/models/session.rb', line 17

def ip
  @ip
end

#mfa_updated_at ⇒ Object (readonly)

Returns the value of attribute mfa_updated_at.



35
36
37
# File 'lib/appwrite/models/session.rb', line 35

def mfa_updated_at
  @mfa_updated_at
end

#os_code ⇒ Object (readonly)

Returns the value of attribute os_code.



18
19
20
# File 'lib/appwrite/models/session.rb', line 18

def os_code
  @os_code
end

#os_name ⇒ Object (readonly)

Returns the value of attribute os_name.



19
20
21
# File 'lib/appwrite/models/session.rb', line 19

def os_name
  @os_name
end

#os_version ⇒ Object (readonly)

Returns the value of attribute os_version.



20
21
22
# File 'lib/appwrite/models/session.rb', line 20

def os_version
  @os_version
end

#provider ⇒ Object (readonly)

Returns the value of attribute provider.



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

def provider
  @provider
end

#provider_access_token ⇒ Object (readonly)

Returns the value of attribute provider_access_token.



14
15
16
# File 'lib/appwrite/models/session.rb', line 14

def provider_access_token
  @provider_access_token
end

#provider_access_token_expiry ⇒ Object (readonly)

Returns the value of attribute provider_access_token_expiry.



15
16
17
# File 'lib/appwrite/models/session.rb', line 15

def provider_access_token_expiry
  @provider_access_token_expiry
end

#provider_refresh_token ⇒ Object (readonly)

Returns the value of attribute provider_refresh_token.



16
17
18
# File 'lib/appwrite/models/session.rb', line 16

def provider_refresh_token
  @provider_refresh_token
end

#provider_uid ⇒ Object (readonly)

Returns the value of attribute provider_uid.



13
14
15
# File 'lib/appwrite/models/session.rb', line 13

def provider_uid
  @provider_uid
end

#secret ⇒ Object (readonly)

Returns the value of attribute secret.



34
35
36
# File 'lib/appwrite/models/session.rb', line 34

def secret
  @secret
end

#updated_at ⇒ Object (readonly)

Returns the value of attribute updated_at.



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

def updated_at
  @updated_at
end

#user_id ⇒ Object (readonly)

Returns the value of attribute user_id.



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

def user_id
  @user_id
end

#user_name ⇒ Object (readonly)

Returns the value of attribute user_name.



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

def user_name
  @user_name
end

Class Method Details

.from(map:) ⇒ Object



101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
# File 'lib/appwrite/models/session.rb', line 101

def self.from(map:)
    map = { "$id" => "", "$createdAt" => "", "$updatedAt" => "", "userId" => "", "userName" => "", "expire" => "", "provider" => "", "providerUid" => "", "providerAccessToken" => "", "providerAccessTokenExpiry" => "", "providerRefreshToken" => "", "ip" => "", "osCode" => "", "osName" => "", "osVersion" => "", "clientType" => "", "clientCode" => "", "clientName" => "", "clientVersion" => "", "clientEngine" => "", "clientEngineVersion" => "", "deviceName" => "", "deviceBrand" => "", "deviceModel" => "", "countryCode" => "", "countryName" => "", "current" => false, "factors" => [], "secret" => "", "mfaUpdatedAt" => "" }.merge(map)
    Session.new(
        id: map["$id"],
        created_at: map["$createdAt"],
        updated_at: map["$updatedAt"],
        user_id: map["userId"],
        user_name: map["userName"],
        expire: map["expire"],
        provider: map["provider"],
        provider_uid: map["providerUid"],
        provider_access_token: map["providerAccessToken"],
        provider_access_token_expiry: map["providerAccessTokenExpiry"],
        provider_refresh_token: map["providerRefreshToken"],
        ip: map["ip"],
        os_code: map["osCode"],
        os_name: map["osName"],
        os_version: map["osVersion"],
        client_type: map["clientType"],
        client_code: map["clientCode"],
        client_name: map["clientName"],
        client_version: map["clientVersion"],
        client_engine: map["clientEngine"],
        client_engine_version: map["clientEngineVersion"],
        device_name: map["deviceName"],
        device_brand: map["deviceBrand"],
        device_model: map["deviceModel"],
        country_code: map["countryCode"],
        country_name: map["countryName"],
        current: map["current"],
        factors: map["factors"],
        secret: map["secret"],
        mfa_updated_at: map["mfaUpdatedAt"]
    )
end

Instance Method Details

#to_map ⇒ Object



137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
# File 'lib/appwrite/models/session.rb', line 137

def to_map
    {
        "$id": @id,
        "$createdAt": @created_at,
        "$updatedAt": @updated_at,
        "userId": @user_id,
        "userName": @user_name,
        "expire": @expire,
        "provider": @provider,
        "providerUid": @provider_uid,
        "providerAccessToken": @provider_access_token,
        "providerAccessTokenExpiry": @provider_access_token_expiry,
        "providerRefreshToken": @provider_refresh_token,
        "ip": @ip,
        "osCode": @os_code,
        "osName": @os_name,
        "osVersion": @os_version,
        "clientType": @client_type,
        "clientCode": @client_code,
        "clientName": @client_name,
        "clientVersion": @client_version,
        "clientEngine": @client_engine,
        "clientEngineVersion": @client_engine_version,
        "deviceName": @device_name,
        "deviceBrand": @device_brand,
        "deviceModel": @device_model,
        "countryCode": @country_code,
        "countryName": @country_name,
        "current": @current,
        "factors": @factors,
        "secret": @secret,
        "mfaUpdatedAt": @mfa_updated_at
    }
end