Class: Appwrite::Models::Block

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

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(created_at:, resource_type:, resource_id:, reason:, expired_at:) ⇒ Block

Returns a new instance of Block.



12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/appwrite/models/block.rb', line 12

def initialize(
    created_at:,
    resource_type:,
    resource_id:,
    reason: ,
    expired_at: 
)
    @created_at = created_at
    @resource_type = resource_type
    @resource_id = resource_id
    @reason = reason
    @expired_at = expired_at
end

Instance Attribute Details

#created_atObject (readonly)

Returns the value of attribute created_at.



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

def created_at
  @created_at
end

#expired_atObject (readonly)

Returns the value of attribute expired_at.



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

def expired_at
  @expired_at
end

#reasonObject (readonly)

Returns the value of attribute reason.



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

def reason
  @reason
end

#resource_idObject (readonly)

Returns the value of attribute resource_id.



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

def resource_id
  @resource_id
end

#resource_typeObject (readonly)

Returns the value of attribute resource_type.



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

def resource_type
  @resource_type
end

Class Method Details

.from(map:) ⇒ Object



26
27
28
29
30
31
32
33
34
# File 'lib/appwrite/models/block.rb', line 26

def self.from(map:)
    Block.new(
        created_at: map["$createdAt"],
        resource_type: map["resourceType"],
        resource_id: map["resourceId"],
        reason: map["reason"],
        expired_at: map["expiredAt"]
    )
end

Instance Method Details

#to_mapObject



36
37
38
39
40
41
42
43
44
# File 'lib/appwrite/models/block.rb', line 36

def to_map
    {
        "$createdAt": @created_at,
        "resourceType": @resource_type,
        "resourceId": @resource_id,
        "reason": @reason,
        "expiredAt": @expired_at
    }
end