module EStat::Request

Public Instance Methods

get(path, options={}) click to toggle source
# File lib/e-stat/request.rb, line 3
def get(path, options={})
  request(:get, path, options)
end
post(path, options={}) click to toggle source
# File lib/e-stat/request.rb, line 7
def post(path, options={})
  request(:post, path, options)
end

Private Instance Methods

request(method, path, options) click to toggle source
# File lib/e-stat/request.rb, line 13
def request(method, path, options)
  options = options.merge(appId: app_id)
  response = connection.send(method) do |request|
    case method
    when :get, :delete
      request.url(path, options)
    when :post, :put
      request.path = path
      request.body = options unless options.empty?
    end
  end
  return response.body
end