Module: QuasarRestClient
- Defined in:
- lib/quasar_rest_client.rb,
lib/quasar_rest_client/base.rb,
lib/quasar_rest_client/proxy.rb,
lib/quasar_rest_client/config.rb,
lib/quasar_rest_client/version.rb,
lib/quasar_rest_client/mogrify_vars.rb
Overview
Include this module
Defined Under Namespace
Modules: MogrifyVars Classes: Base, Config, Proxy
Constant Summary collapse
- VERSION =
"0.2.0"
Class Method Summary collapse
-
.config ⇒ Object
Access the configuration to set and retrieve information.
-
.configure {|Base.config| ... } ⇒ Object
Provide block-style configuration:.
-
.delete_data(coll = '', opts = {}) ⇒ String
JSON reponse.
-
.get_data(coll = '', opts = {}) ⇒ String
JSON reponse.
-
.long_query(q = '', dest = '', opts = {}) ⇒ String
JSON reponse.
-
.simple_query(q = '', opts = {}) ⇒ Object
Call Quasar with a simple query.
Class Method Details
.config ⇒ Object
Access the configuration to set and retrieve information
QuasarRestClient.config.endpoint # => returns value
QuasarRestClient.config.endpoint = 'https://example.com' # => sets endpoint
31 32 33 |
# File 'lib/quasar_rest_client.rb', line 31 def self.config return Base.config end |
.configure {|Base.config| ... } ⇒ Object
Provide block-style configuration:
QuasarRestClient.configure do |config|
config.endpoint = 'http://example.com'
end
22 23 24 |
# File 'lib/quasar_rest_client.rb', line 22 def self.configure yield Base.config end |
.delete_data(coll = '', opts = {}) ⇒ String
Returns JSON reponse.
94 95 96 97 |
# File 'lib/quasar_rest_client.rb', line 94 def self.delete_data(coll='', opts={}) proxy = Proxy.new(nil, opts) proxy.delete_data(collection: coll) end |
.get_data(coll = '', opts = {}) ⇒ String
Returns JSON reponse.
86 87 88 89 |
# File 'lib/quasar_rest_client.rb', line 86 def self.get_data(coll='', opts={}) proxy = Proxy.new(nil, opts) proxy.get_data(collection: coll) end |
.long_query(q = '', dest = '', opts = {}) ⇒ String
Returns JSON reponse.
78 79 80 81 |
# File 'lib/quasar_rest_client.rb', line 78 def self.long_query(q='', dest='', opts={}) proxy = Proxy.new(q, opts) proxy.long_query(destination: dest) end |
.simple_query(q = '', opts = {}) ⇒ Object
Call Quasar with a simple query
For the last option, :var, the hash keys match the variable name used in the query string. For example, given a query string of:
SELECT * WHERE pop < :cutoff
The var hash should have:
{ cutoff: 100 }
To set the value of the cutoff.
Example:
QuasarRestClient.simple_query(
'SELECT * WHERE pop < :cutoff',
{
limit: 10,
offset: 20,
var: {
cutoff: 100
}
}
)
69 70 71 72 |
# File 'lib/quasar_rest_client.rb', line 69 def self.simple_query(q='', opts={}) proxy = Proxy.new(q, opts) proxy.simple_query end |