Class: Net::Instagram::Api::Request
- Inherits:
-
Object
- Object
- Net::Instagram::Api::Request
- Defined in:
- lib/net/instagram/api/request.rb
Instance Method Summary collapse
-
#initialize(attrs = {}) ⇒ Request
constructor
A new instance of Request.
- #run ⇒ Object
Constructor Details
#initialize(attrs = {}) ⇒ Request
Returns a new instance of Request.
10 11 12 13 14 15 |
# File 'lib/net/instagram/api/request.rb', line 10 def initialize(attrs = {}) @host = 'api.instagram.com' @path = attrs.fetch :path, "/v1/#{attrs[:endpoint]}" @query = attrs[:params] if attrs[:params] @method = attrs.fetch :method, :get end |
Instance Method Details
#run ⇒ Object
17 18 19 20 21 22 23 24 25 |
# File 'lib/net/instagram/api/request.rb', line 17 def run #print "#{as_curl}\n" case response = run_http_request when Net::HTTPOK JSON(response.body)['data'] else raise Errors::ResponseError, response end end |