Class: Appwrite::Models::Document
- Inherits:
-
Object
- Object
- Appwrite::Models::Document
- Defined in:
- lib/appwrite/models/document.rb
Instance Attribute Summary collapse
-
#collection_id ⇒ Object
readonly
Returns the value of attribute collection_id.
-
#created_at ⇒ Object
readonly
Returns the value of attribute created_at.
-
#data ⇒ Object
readonly
Returns the value of attribute data.
-
#database_id ⇒ Object
readonly
Returns the value of attribute database_id.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#permissions ⇒ Object
readonly
Returns the value of attribute permissions.
-
#updated_at ⇒ Object
readonly
Returns the value of attribute updated_at.
Class Method Summary collapse
Instance Method Summary collapse
- #convert_to(from_json) ⇒ Object
-
#initialize(id:, collection_id:, database_id:, created_at:, updated_at:, permissions:, data:) ⇒ Document
constructor
A new instance of Document.
- #to_map ⇒ Object
Constructor Details
#initialize(id:, collection_id:, database_id:, created_at:, updated_at:, permissions:, data:) ⇒ Document
Returns a new instance of Document.
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/appwrite/models/document.rb', line 14 def initialize( id:, collection_id:, database_id:, created_at:, updated_at:, permissions:, data: ) @id = id @collection_id = collection_id @database_id = database_id @created_at = created_at @updated_at = updated_at @permissions = @data = data end |
Instance Attribute Details
#collection_id ⇒ Object (readonly)
Returns the value of attribute collection_id.
7 8 9 |
# File 'lib/appwrite/models/document.rb', line 7 def collection_id @collection_id end |
#created_at ⇒ Object (readonly)
Returns the value of attribute created_at.
9 10 11 |
# File 'lib/appwrite/models/document.rb', line 9 def created_at @created_at end |
#data ⇒ Object (readonly)
Returns the value of attribute data.
12 13 14 |
# File 'lib/appwrite/models/document.rb', line 12 def data @data end |
#database_id ⇒ Object (readonly)
Returns the value of attribute database_id.
8 9 10 |
# File 'lib/appwrite/models/document.rb', line 8 def database_id @database_id end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
6 7 8 |
# File 'lib/appwrite/models/document.rb', line 6 def id @id end |
#permissions ⇒ Object (readonly)
Returns the value of attribute permissions.
11 12 13 |
# File 'lib/appwrite/models/document.rb', line 11 def @permissions end |
#updated_at ⇒ Object (readonly)
Returns the value of attribute updated_at.
10 11 12 |
# File 'lib/appwrite/models/document.rb', line 10 def updated_at @updated_at end |
Class Method Details
.from(map:) ⇒ Object
32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/appwrite/models/document.rb', line 32 def self.from(map:) Document.new( id: map["$id"], collection_id: map["$collectionId"], database_id: map["$databaseId"], created_at: map["$createdAt"], updated_at: map["$updatedAt"], permissions: map["$permissions"], data: map ) end |
Instance Method Details
#convert_to(from_json) ⇒ Object
56 57 58 |
# File 'lib/appwrite/models/document.rb', line 56 def convert_to(from_json) from_json.call(data) end |
#to_map ⇒ Object
44 45 46 47 48 49 50 51 52 53 54 |
# File 'lib/appwrite/models/document.rb', line 44 def to_map { "$id": @id, "$collectionId": @collection_id, "$databaseId": @database_id, "$createdAt": @created_at, "$updatedAt": @updated_at, "$permissions": @permissions, "data": @data } end |