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 more...
Overview
A small library to provide basic interaction with the Quasar Rest API.
Copyright © 2016 Bluewater, LLC.
MIT License
Defined Under Namespace
Constant Summary collapse
- VERSION =
"0.1.0"
Class Method Summary collapse
-
.config ⇒ Object
Access the configuration to set and retrieve information.
-
.configure {|Base.config| ... } ⇒ Object
Provide block-style configuration:.
-
.simple_query(q = '', opts = {}) ⇒ Object
Call Quasar with a simple query.
Class Method Details
permalink .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 |
permalink .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 |
permalink .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 |