Class: RedashDynamicQuery::Client
- Inherits:
-
Object
- Object
- RedashDynamicQuery::Client
- Defined in:
- lib/redash_dynamic_query/client.rb
Instance Attribute Summary collapse
-
#api_key ⇒ Object
readonly
Returns the value of attribute api_key.
-
#endpoint ⇒ Object
readonly
Returns the value of attribute endpoint.
-
#interval ⇒ Object
readonly
Returns the value of attribute interval.
-
#timeout ⇒ Object
readonly
Returns the value of attribute timeout.
Instance Method Summary collapse
-
#initialize(user_apikey:, endpoint:, interval: 0.1, timeout: 10) ⇒ Client
constructor
A new instance of Client.
- #query(query_id:, params:) ⇒ Object
Constructor Details
#initialize(user_apikey:, endpoint:, interval: 0.1, timeout: 10) ⇒ Client
Returns a new instance of Client.
7 8 9 10 11 12 |
# File 'lib/redash_dynamic_query/client.rb', line 7 def initialize(user_apikey:, endpoint:, interval: 0.1, timeout: 10) @api_key = user_apikey @endpoint = endpoint @interval = interval @timeout = timeout end |
Instance Attribute Details
#api_key ⇒ Object (readonly)
Returns the value of attribute api_key.
5 6 7 |
# File 'lib/redash_dynamic_query/client.rb', line 5 def api_key @api_key end |
#endpoint ⇒ Object (readonly)
Returns the value of attribute endpoint.
5 6 7 |
# File 'lib/redash_dynamic_query/client.rb', line 5 def endpoint @endpoint end |
#interval ⇒ Object (readonly)
Returns the value of attribute interval.
5 6 7 |
# File 'lib/redash_dynamic_query/client.rb', line 5 def interval @interval end |
#timeout ⇒ Object (readonly)
Returns the value of attribute timeout.
5 6 7 |
# File 'lib/redash_dynamic_query/client.rb', line 5 def timeout @timeout end |
Instance Method Details
#query(query_id:, params:) ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/redash_dynamic_query/client.rb', line 14 def query(query_id:, params:) job_id = post_job_request(query_id: query_id, params: params) raise 'job_id not fuond.' if job_id.nil? query_result_id = poll_job(job_id: job_id) raise 'query_result_id not fuond.' if query_result_id.nil? get_query_result(query_result_id: query_result_id) end |