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
#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
#endpoint ⇒ Object
Returns the value of attribute endpoint.
3 4 5 |
# File 'lib/searchmetrics_client/query.rb', line 3 def endpoint @endpoint end |
#params ⇒ Object
Returns the value of attribute params.
3 4 5 |
# File 'lib/searchmetrics_client/query.rb', line 3 def params @params end |
#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
.from_hash(hash) ⇒ Object
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
#to_h ⇒ Object
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 |