Class: SearchmetricsClient::Request
- Inherits:
-
Object
- Object
- SearchmetricsClient::Request
- Extended by:
- Forwardable
- Defined in:
- lib/searchmetrics_client/request.rb
Overview
:nodoc:
Instance Attribute Summary collapse
-
#query ⇒ Object
readonly
Returns the value of attribute query.
-
#response ⇒ Object
readonly
Returns the value of attribute response.
-
#url ⇒ Object
readonly
Returns the value of attribute url.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(query) ⇒ Request
constructor
A new instance of Request.
- #send_request ⇒ Object
Constructor Details
#initialize(query) ⇒ Request
Returns a new instance of Request.
20 21 22 23 |
# File 'lib/searchmetrics_client/request.rb', line 20 def initialize(query) @query = query @url = build_url end |
Instance Attribute Details
#query ⇒ Object (readonly)
Returns the value of attribute query.
6 7 8 |
# File 'lib/searchmetrics_client/request.rb', line 6 def query @query end |
#response ⇒ Object (readonly)
Returns the value of attribute response.
6 7 8 |
# File 'lib/searchmetrics_client/request.rb', line 6 def response @response end |
#url ⇒ Object (readonly)
Returns the value of attribute url.
6 7 8 |
# File 'lib/searchmetrics_client/request.rb', line 6 def url @url end |
Class Method Details
.send_request(query) ⇒ Object
11 12 13 |
# File 'lib/searchmetrics_client/request.rb', line 11 def self.send_request(query) new(query).send_request end |
.send_request_from_hash(hash) ⇒ Object
15 16 17 18 |
# File 'lib/searchmetrics_client/request.rb', line 15 def self.send_request_from_hash(hash) query = SearchmetricsClient::Query.from_hash(hash) SearchmetricsClient::Request.send_request(query) end |
Instance Method Details
#send_request ⇒ Object
25 26 27 28 29 30 31 |
# File 'lib/searchmetrics_client/request.rb', line 25 def send_request check_credentials result = Client.instance.public_send(method, url) @response = SearchmetricsClient::Response.new(self, result) rescue OAuth2::Error => e check_errors(e.response) end |