module Pixmatch::Request

Private Instance Methods

capture(response) click to toggle source
# File lib/pixmatch/request.rb, line 17
def capture(response)
  json = Utils.parse_json(response)
  Utils.handle_error(json)
  json
end
paramify(path, params) click to toggle source
# File lib/pixmatch/request.rb, line 23
def paramify(path, params)
  URI.encode("#{path}/?#{params.map { |k,v| "#{k}=#{v}" }.join('&')}")
end
request(http_method, path, query_params = {}, data_params = {}) click to toggle source
# File lib/pixmatch/request.rb, line 8
def request(http_method, path, query_params = {}, data_params = {})
  capture RestClient::Request.new({ 
    method: http_method,
    url: "#{endpoint}/#{paramify(path, query_params)}", 
    user: username,
    password: password
   }.merge(data_params)).execute                    
end