Class: Instapaper::HTTP::Request
- Inherits:
-
Object
- Object
- Instapaper::HTTP::Request
- Defined in:
- lib/instapaper/http/request.rb
Constant Summary collapse
- BASE_URL =
'https://www.instapaper.com'
Instance Attribute Summary collapse
-
#client ⇒ Object
Returns the value of attribute client.
-
#headers ⇒ Object
Returns the value of attribute headers.
-
#options ⇒ Object
Returns the value of attribute options.
-
#path ⇒ Object
Returns the value of attribute path.
-
#request_method ⇒ Object
Returns the value of attribute request_method.
-
#uri ⇒ Object
Returns the value of attribute uri.
Instance Method Summary collapse
- #initialize(client, request_method, path, options = {}) ⇒ Instapaper::HTTP::Request constructor
- #perform ⇒ Array, Hash
Constructor Details
#initialize(client, request_method, path, options = {}) ⇒ Instapaper::HTTP::Request
17 18 19 20 21 22 23 |
# File 'lib/instapaper/http/request.rb', line 17 def initialize(client, request_method, path, = {}) @client = client @request_method = request_method @uri = Addressable::URI.parse(path.start_with?('http') ? path : BASE_URL + path) @path = uri.path @options = end |
Instance Attribute Details
#client ⇒ Object
Returns the value of attribute client.
10 11 12 |
# File 'lib/instapaper/http/request.rb', line 10 def client @client end |
#headers ⇒ Object
Returns the value of attribute headers.
10 11 12 |
# File 'lib/instapaper/http/request.rb', line 10 def headers @headers end |
#options ⇒ Object
Returns the value of attribute options.
10 11 12 |
# File 'lib/instapaper/http/request.rb', line 10 def @options end |
#path ⇒ Object
Returns the value of attribute path.
10 11 12 |
# File 'lib/instapaper/http/request.rb', line 10 def path @path end |
#request_method ⇒ Object
Returns the value of attribute request_method.
10 11 12 |
# File 'lib/instapaper/http/request.rb', line 10 def request_method @request_method end |
#uri ⇒ Object
Returns the value of attribute uri.
10 11 12 |
# File 'lib/instapaper/http/request.rb', line 10 def uri @uri end |
Instance Method Details
#perform ⇒ Array, Hash
26 27 28 29 30 |
# File 'lib/instapaper/http/request.rb', line 26 def perform raw = @options.delete(:raw) response = Instapaper::HTTP::Response.new(perform_request, path, raw) response.valid? && response.body end |