Class: SearchmetricsClient::Query
- Inherits:
-
Object
- Object
- SearchmetricsClient::Query
- Defined in:
- lib/searchmetrics_client/query.rb
Overview
:nodoc:
Instance Attribute Summary collapse
-
#endpoint ⇒ Object
Returns the value of attribute endpoint.
-
#params ⇒ Object
Returns the value of attribute params.
-
#query ⇒ Object
Returns the value of attribute query.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(endpoint, params = {}) ⇒ Query
constructor
A new instance of Query.
- #to_h ⇒ Object
Constructor Details
permalink #initialize(endpoint, params = {}) ⇒ Query
Returns a new instance of Query.
11 12 13 14 15 |
# File 'lib/searchmetrics_client/query.rb', line 11 def initialize(endpoint, params = {}) @endpoint = endpoint @params = params @query = build_query end |
Instance Attribute Details
permalink #endpoint ⇒ Object
Returns the value of attribute endpoint.
3 4 5 |
# File 'lib/searchmetrics_client/query.rb', line 3 def endpoint @endpoint end |
permalink #params ⇒ Object
Returns the value of attribute params.
3 4 5 |
# File 'lib/searchmetrics_client/query.rb', line 3 def params @params end |
permalink #query ⇒ Object
Returns the value of attribute query.
3 4 5 |
# File 'lib/searchmetrics_client/query.rb', line 3 def query @query end |
Class Method Details
permalink .from_hash(hash) ⇒ Object
[View source]
5 6 7 8 9 |
# File 'lib/searchmetrics_client/query.rb', line 5 def self.from_hash(hash) endpoint = hash.fetch(:endpoint) params = hash.fetch(:params, {}) new(endpoint, params) end |
Instance Method Details
permalink #to_h ⇒ Object
[View source]
17 18 19 20 21 |
# File 'lib/searchmetrics_client/query.rb', line 17 def to_h hash = { endpoint: endpoint } hash[:params] = params unless params.empty? hash end |