Module: RestClient
- Defined in:
- lib/ext/rest_client.rb,
lib/rest_client_config.rb
Constant Summary collapse
- @@config =
{}
Class Method Summary collapse
- .clear_config ⇒ Object
- .delete(url, headers = {}, &block) ⇒ Object
- .get(url, headers = {}, &block) ⇒ Object
- .get_config ⇒ Object
- .head(url, headers = {}, &block) ⇒ Object
- .options(url, headers = {}, &block) ⇒ Object
- .patch(url, payload, headers = {}, &block) ⇒ Object
- .post(url, payload, headers = {}, &block) ⇒ Object
- .put(url, payload, headers = {}, &block) ⇒ Object
- .set_config(**config) ⇒ Object
Class Method Details
.clear_config ⇒ Object
14 15 16 |
# File 'lib/ext/rest_client.rb', line 14 def self.clear_config @@config = {} end |
.delete(url, headers = {}, &block) ⇒ Object
34 35 36 |
# File 'lib/ext/rest_client.rb', line 34 def self.delete(url, headers={}, &block) Request.execute(:method => :delete, :url => url, :headers => headers, **@@config, &block) end |
.get(url, headers = {}, &block) ⇒ Object
18 19 20 |
# File 'lib/ext/rest_client.rb', line 18 def self.get(url, headers={}, &block) Request.execute(:method => :get, :url => url, :headers => headers, **@@config, &block) end |
.get_config ⇒ Object
4 5 6 |
# File 'lib/ext/rest_client.rb', line 4 def self.get_config @@config end |
.head(url, headers = {}, &block) ⇒ Object
38 39 40 |
# File 'lib/ext/rest_client.rb', line 38 def self.head(url, headers={}, &block) Request.execute(:method => :head, :url => url, :headers => headers, **@@config, &block) end |
.options(url, headers = {}, &block) ⇒ Object
42 43 44 |
# File 'lib/ext/rest_client.rb', line 42 def self.(url, headers={}, &block) Request.execute(:method => :options, :url => url, :headers => headers, **@@config, &block) end |
.patch(url, payload, headers = {}, &block) ⇒ Object
26 27 28 |
# File 'lib/ext/rest_client.rb', line 26 def self.patch(url, payload, headers={}, &block) Request.execute(:method => :patch, :url => url, :payload => payload, :headers => headers, **@@config, &block) end |
.post(url, payload, headers = {}, &block) ⇒ Object
22 23 24 |
# File 'lib/ext/rest_client.rb', line 22 def self.post(url, payload, headers={}, &block) Request.execute(:method => :post, :url => url, :payload => payload, :headers => headers, **@@config, &block) end |
.put(url, payload, headers = {}, &block) ⇒ Object
30 31 32 |
# File 'lib/ext/rest_client.rb', line 30 def self.put(url, payload, headers={}, &block) Request.execute(:method => :put, :url => url, :payload => payload, :headers => headers, **@@config, &block) end |
.set_config(**config) ⇒ Object
8 9 10 11 12 |
# File 'lib/ext/rest_client.rb', line 8 def self.set_config(**config) config.each do |key, value| @@config[key] = value unless key == :url || key == :method end end |