Class: Appwrite::Query
- Inherits:
-
Object
- Object
- Appwrite::Query
- Defined in:
- lib/appwrite/query.rb
Defined Under Namespace
Classes: Query
Instance Method Summary collapse
-
#initialize(method, attribute = nil, values = nil) ⇒ Query
constructor
A new instance of Query.
- #to_json(*args) ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize(method, attribute = nil, values = nil) ⇒ Query
Returns a new instance of Query.
5 6 7 8 9 10 11 12 13 14 15 16 |
# File 'lib/appwrite/query.rb', line 5 def initialize(method, attribute = nil, values = nil) @method = method @attribute = attribute if values != nil if values.is_a?(Array) @values = values else @values = [values] end end end |
Instance Method Details
#to_json(*args) ⇒ Object
18 19 20 21 22 23 24 |
# File 'lib/appwrite/query.rb', line 18 def to_json(*args) { method: @method, attribute: @attribute, values: @values }.compact.to_json(*args) end |
#to_s ⇒ Object
26 27 28 |
# File 'lib/appwrite/query.rb', line 26 def to_s return self.to_json end |