Class: Appwrite::Models::Variable

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

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(id:, created_at:, updated_at:, key:, value:, resource_type:, resource_id:) ⇒ Variable

Returns a new instance of Variable.



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

def initialize(
    id:,
    created_at:,
    updated_at:,
    key:,
    value:,
    resource_type:,
    resource_id:
)
    @id = id
    @created_at = created_at
    @updated_at = updated_at
    @key = key
    @value = value
    @resource_type = resource_type
    @resource_id = resource_id
end

Instance Attribute Details

#created_atObject (readonly)

Returns the value of attribute created_at.



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

def created_at
  @created_at
end

#idObject (readonly)

Returns the value of attribute id.



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

def id
  @id
end

#keyObject (readonly)

Returns the value of attribute key.



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

def key
  @key
end

#resource_idObject (readonly)

Returns the value of attribute resource_id.



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

def resource_id
  @resource_id
end

#resource_typeObject (readonly)

Returns the value of attribute resource_type.



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

def resource_type
  @resource_type
end

#updated_atObject (readonly)

Returns the value of attribute updated_at.



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

def updated_at
  @updated_at
end

#valueObject (readonly)

Returns the value of attribute value.



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

def value
  @value
end

Class Method Details

.from(map:) ⇒ Object



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

def self.from(map:)
    Variable.new(
        id: map["$id"],
        created_at: map["$createdAt"],
        updated_at: map["$updatedAt"],
        key: map["key"],
        value: map["value"],
        resource_type: map["resourceType"],
        resource_id: map["resourceId"]
    )
end

Instance Method Details

#to_mapObject



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

def to_map
    {
        "$id": @id,
        "$createdAt": @created_at,
        "$updatedAt": @updated_at,
        "key": @key,
        "value": @value,
        "resourceType": @resource_type,
        "resourceId": @resource_id
    }
end