class RiakJson::ClientTransport
Used by RiakJson::Client
to make HTTP requests
Public Instance Methods
get_request(url)
click to toggle source
# File lib/riak_json/client_transport.rb, line 26 def get_request(url) self.send_request(url, :get) end
send_request(url, http_method, data=nil)
click to toggle source
# File lib/riak_json/client_transport.rb, line 30 def send_request(url, http_method, data=nil) begin case http_method when :get response = RestClient.get url, {:content_type => :json, :params => data} when :put response = RestClient.put url, data, {:content_type => :json, :accept => :json} when :post response = RestClient.post url, data, {:content_type => :json, :accept => :json} when :delete response = RestClient.delete url else raise ArgumentError, "Invalid HTTP :method - #{http_method}" end # rescue Exception => e # puts e.inspect end response end