module Brandspotter class Client def base_uri(path='/') "http://brandspotter.herokuapp.com/api#{path}?user_token=#{self.user_token}&" end def configure_payload(path, opts={}) base_uri(path) + opts.to_params end def get_request(url) JSON.parse RestClient::Request.execute(method: :get, url: url) end def post_request(path, opts) JSON.parse RestClient.post(base_uri(path), opts) end def delete_request(path) JSON.parse RestClient::Request.execute(method: :delete, url: base_uri(path)) end end end