Class: Iter::Request Private
- Inherits:
-
Object
- Object
- Iter::Request
- Defined in:
- lib/iter/http_request.rb,
lib/iter/mock_request.rb
Overview
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
A mock version of HTTPRequest which returns pre-built responses.
Instance Method Summary collapse
-
#initialize(options = {}) ⇒ Request
constructor
private
Initializes an MockRequest object.
-
#run ⇒ Hash
private
Sends the request and returns the body parsed from the JSON response.
Constructor Details
#initialize(options = {}) ⇒ Request
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Initializes an MockRequest object.
22 23 24 25 |
# File 'lib/iter/http_request.rb', line 22 def initialize( = {}) @path = [:path] @body = [:body] end |
Instance Method Details
#run ⇒ Hash
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Sends the request and returns the body parsed from the JSON response.
31 32 33 34 35 36 |
# File 'lib/iter/http_request.rb', line 31 def run return {} if response.body.empty? JSON(response.body).tap do |data| raise Error, "#{data['errMsg']} #{data['Errors']}" unless data['errNo'].zero? end end |