Class: Zillabyte::API::Queries
- Defined in:
- lib/zillabyte/api/queries.rb
Instance Method Summary collapse
- #agnostic(expression, options = {}) ⇒ Object
-
#sql(expression, options = {}) ⇒ Object
GET /sql.
-
#sxp(expression, options = {}) ⇒ Object
GET /sxp.
Methods inherited from Base
Constructor Details
This class inherits a constructor from Zillabyte::API::Base
Instance Method Details
#agnostic(expression, options = {}) ⇒ Object
44 45 46 47 48 49 50 51 52 53 |
# File 'lib/zillabyte/api/queries.rb', line 44 def agnostic(expression, = {}) case expression when Array return sxp(expression, ) when String return sql(expression, ) else throw "unknown expression type: #{expression}" end end |
#sql(expression, options = {}) ⇒ Object
GET /sql
25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/zillabyte/api/queries.rb', line 25 def sql(expression, = {}) = { 'sql' => expression }.merge() res = request( :expects => 200, :method => :post, :path => "/query_sql", :body => .to_json ) res.body end |
#sxp(expression, options = {}) ⇒ Object
GET /sxp
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/zillabyte/api/queries.rb', line 5 def sxp(expression, = {}) = { 'sxp' => expression }.merge() res = request( :expects => 200, :method => :post, :path => "/query_sxp", :body => .to_json ) res.body end |