module Postmates::Request

Public Instance Methods

get(path, options = {}) click to toggle source
# File lib/postmates/request.rb, line 5
def get(path, options = {})
  request(:get, path, options)
end
post(path, options = {}) click to toggle source
# File lib/postmates/request.rb, line 9
def post(path, options = {})
  request(:post, path, options)
end

Private Instance Methods

request(method, path, options) click to toggle source
# File lib/postmates/request.rb, line 15
def request(method, path, options)
  response = connection.send(method) do |request|
    case method
    when :get 
      request.url(path, options)
    when :post
      request.path = path
      request.body = options unless options.empty?
    end
  end
  raw_response ? response : Response.build(response.body)
end