Module: RestClient
- Defined in:
- lib/rest_client.rb,
lib/resource.rb
Overview
This module’s static methods are the entry point for using the REST client.
Defined Under Namespace
Class Method Summary collapse
- .delete(url, headers = {}) ⇒ Object
- .get(url, headers = {}) ⇒ Object
-
.post(url, payload, headers = {}) ⇒ Object
Payload can either be a string or a hash.
- .put(url, payload, headers = {}) ⇒ Object
Class Method Details
.delete(url, headers = {}) ⇒ Object
31 32 33 34 35 |
# File 'lib/rest_client.rb', line 31 def self.delete(url, headers={}) Request.execute(:method => :delete, :url => url, :headers => headers) end |
.get(url, headers = {}) ⇒ Object
8 9 10 11 12 |
# File 'lib/rest_client.rb', line 8 def self.get(url, headers={}) Request.execute(:method => :get, :url => url, :headers => headers) end |
.post(url, payload, headers = {}) ⇒ Object
Payload can either be a string or a hash. If it is a hash, your content-type will be set to www-form-urlencoded and the parameters converted to a CGI encoded string.
17 18 19 20 21 22 |
# File 'lib/rest_client.rb', line 17 def self.post(url, payload, headers={}) Request.execute(:method => :post, :url => url, :payload => payload, :headers => headers) end |