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