Class: Phocoder::HTTP
- Defined in:
- lib/phocoder/http.rb,
lib/phocoder/http/net_http.rb,
lib/phocoder/http/typhoeus.rb
Defined Under Namespace
Instance Attribute Summary collapse
-
#body ⇒ Object
Returns the value of attribute body.
-
#format ⇒ Object
Returns the value of attribute format.
-
#method ⇒ Object
Returns the value of attribute method.
-
#options ⇒ Object
Returns the value of attribute options.
-
#url ⇒ Object
Returns the value of attribute url.
Class Method Summary collapse
- .delete(url, options = {}) ⇒ Object
- .get(url, options = {}) ⇒ Object
- .post(url, body, options = {}) ⇒ Object
- .put(url, body, options = {}) ⇒ Object
Instance Method Summary collapse
- #default_options ⇒ Object
- #http_backend ⇒ Object
-
#initialize(method, url, options = {}) ⇒ HTTP
constructor
A new instance of HTTP.
- #perform_method ⇒ Object
Methods inherited from Base
api_key, base_url, decode, #decode, #encode, encode
Constructor Details
#initialize(method, url, options = {}) ⇒ HTTP
Returns a new instance of HTTP.
15 16 17 18 19 20 21 |
# File 'lib/phocoder/http.rb', line 15 def initialize(method, url, ={}) self.method = method self.url = url self.format = .delete(:format) self. = self.body = .delete(:body) end |
Instance Attribute Details
#body ⇒ Object
Returns the value of attribute body.
4 5 6 |
# File 'lib/phocoder/http.rb', line 4 def body @body end |
#format ⇒ Object
Returns the value of attribute format.
4 5 6 |
# File 'lib/phocoder/http.rb', line 4 def format @format end |
#method ⇒ Object
Returns the value of attribute method.
4 5 6 |
# File 'lib/phocoder/http.rb', line 4 def method @method end |
#options ⇒ Object
Returns the value of attribute options.
4 5 6 |
# File 'lib/phocoder/http.rb', line 4 def @options end |
#url ⇒ Object
Returns the value of attribute url.
4 5 6 |
# File 'lib/phocoder/http.rb', line 4 def url @url end |
Class Method Details
.delete(url, options = {}) ⇒ Object
35 36 37 |
# File 'lib/phocoder/http.rb', line 35 def self.delete(url, ={}) new(:delete, url, ).perform_method end |
.get(url, options = {}) ⇒ Object
31 32 33 |
# File 'lib/phocoder/http.rb', line 31 def self.get(url, ={}) new(:get, url, ).perform_method end |
.post(url, body, options = {}) ⇒ Object
23 24 25 |
# File 'lib/phocoder/http.rb', line 23 def self.post(url, body, ={}) new(:post, url, .merge(:body => body)).perform_method end |
.put(url, body, options = {}) ⇒ Object
27 28 29 |
# File 'lib/phocoder/http.rb', line 27 def self.put(url, body, ={}) new(:put, url, .merge(:body => body)).perform_method end |
Instance Method Details
#default_options ⇒ Object
67 68 69 |
# File 'lib/phocoder/http.rb', line 67 def self.class..recursive_with_indifferent_access end |
#http_backend ⇒ Object
63 64 65 |
# File 'lib/phocoder/http.rb', line 63 def http_backend self.class.http_backend end |