Class: Appwrite::Models::File

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

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(id:, bucket_id:, created_at:, updated_at:, permissions:, name:, signature:, mime_type:, size_original:, chunks_total:, chunks_uploaded:) ⇒ File

Returns a new instance of File.



18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
# File 'lib/appwrite/models/file.rb', line 18

def initialize(
    id:,
    bucket_id:,
    created_at:,
    updated_at:,
    permissions:,
    name:,
    signature:,
    mime_type:,
    size_original:,
    chunks_total:,
    chunks_uploaded:
)
    @id = id
    @bucket_id = bucket_id
    @created_at = created_at
    @updated_at = updated_at
    @permissions = permissions
    @name = name
    @signature = signature
    @mime_type = mime_type
    @size_original = size_original
    @chunks_total = chunks_total
    @chunks_uploaded = chunks_uploaded
end

Instance Attribute Details

#bucket_idObject (readonly)

Returns the value of attribute bucket_id.



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

def bucket_id
  @bucket_id
end

#chunks_totalObject (readonly)

Returns the value of attribute chunks_total.



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

def chunks_total
  @chunks_total
end

#chunks_uploadedObject (readonly)

Returns the value of attribute chunks_uploaded.



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

def chunks_uploaded
  @chunks_uploaded
end

#created_atObject (readonly)

Returns the value of attribute created_at.



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

def created_at
  @created_at
end

#idObject (readonly)

Returns the value of attribute id.



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

def id
  @id
end

#mime_typeObject (readonly)

Returns the value of attribute mime_type.



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

def mime_type
  @mime_type
end

#nameObject (readonly)

Returns the value of attribute name.



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

def name
  @name
end

#permissionsObject (readonly)

Returns the value of attribute permissions.



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

def permissions
  @permissions
end

#signatureObject (readonly)

Returns the value of attribute signature.



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

def signature
  @signature
end

#size_originalObject (readonly)

Returns the value of attribute size_original.



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

def size_original
  @size_original
end

#updated_atObject (readonly)

Returns the value of attribute updated_at.



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

def updated_at
  @updated_at
end

Class Method Details

.from(map:) ⇒ Object



44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
# File 'lib/appwrite/models/file.rb', line 44

def self.from(map:)
    File.new(
        id: map["$id"],
        bucket_id: map["bucketId"],
        created_at: map["$createdAt"],
        updated_at: map["$updatedAt"],
        permissions: map["$permissions"],
        name: map["name"],
        signature: map["signature"],
        mime_type: map["mimeType"],
        size_original: map["sizeOriginal"],
        chunks_total: map["chunksTotal"],
        chunks_uploaded: map["chunksUploaded"]
    )
end

Instance Method Details

#to_mapObject



60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
# File 'lib/appwrite/models/file.rb', line 60

def to_map
    {
        "$id": @id,
        "bucketId": @bucket_id,
        "$createdAt": @created_at,
        "$updatedAt": @updated_at,
        "$permissions": @permissions,
        "name": @name,
        "signature": @signature,
        "mimeType": @mime_type,
        "sizeOriginal": @size_original,
        "chunksTotal": @chunks_total,
        "chunksUploaded": @chunks_uploaded
    }
end