Module: HackernewsRuby::Request

Included in:
Client
Defined in:
lib/hackernews_ruby/request.rb

Instance Method Summary collapse

Instance Method Details

#get(path, options) ⇒ Object



7
8
9
# File 'lib/hackernews_ruby/request.rb', line 7

def get(path, options)
  request(:get, path, options)
end

#request(method, path, options) ⇒ Object



11
12
13
14
15
16
17
18
19
20
# File 'lib/hackernews_ruby/request.rb', line 11

def request(method, path, options)
  response = connection.send(method) do |request|
    case method
    when :get
      request.url(path, options)
    end
  end

  response.body
end