Method: Hachi::Clients::Base#get

Defined in:
lib/hachi/clients/base.rb

#get(path, params: {}, &block) ⇒ Object



17
18
19
20
21
22
23
24
# File 'lib/hachi/clients/base.rb', line 17

def get(path, params: {}, &block)
  url = url_for(path)
  url.query = URI.encode_www_form(params) unless params.empty?

  get = Net::HTTP::Get.new(url)
  get.add_field "Authorization", "Bearer #{api_key}"
  request(get, &block)
end