Module: RestClient

Defined in:
lib/allplayers/monkey_patches/rest_client.rb

Overview

monkey patch RestClient to support custom timeouts.

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.open_timeoutObject

Returns the value of attribute open_timeout.



33
34
35
# File 'lib/allplayers/monkey_patches/rest_client.rb', line 33

def open_timeout
  @open_timeout
end

.timeoutObject

Returns the value of attribute timeout.



32
33
34
# File 'lib/allplayers/monkey_patches/rest_client.rb', line 32

def timeout
  @timeout
end

Class Method Details

.delete(url, headers = {}, &block) ⇒ Object



19
20
21
# File 'lib/allplayers/monkey_patches/rest_client.rb', line 19

def self.delete(url, headers={}, &block)
  Request.execute(:method => :delete, :url => url, :headers => headers, :timeout => @timeout, :open_timeout => @open_timeout, &block)
end

.get(url, headers = {}, &block) ⇒ Object



7
8
9
# File 'lib/allplayers/monkey_patches/rest_client.rb', line 7

def self.get(url, headers={}, &block)
  Request.execute(:method => :get, :url => url, :headers => headers, :timeout => @timeout, :open_timeout => @open_timeout, &block)
end

.head(url, headers = {}, &block) ⇒ Object



23
24
25
# File 'lib/allplayers/monkey_patches/rest_client.rb', line 23

def self.head(url, headers={}, &block)
  Request.execute(:method => :head, :url => url, :headers => headers, :timeout => @timeout, :open_timeout => @open_timeout, &block)
end

.options(url, headers = {}, &block) ⇒ Object



27
28
29
# File 'lib/allplayers/monkey_patches/rest_client.rb', line 27

def self.options(url, headers={}, &block)
  Request.execute(:method => :options, :url => url, :headers => headers, :timeout => @timeout, :open_timeout => @open_timeout, &block)
end

.post(url, payload, headers = {}, &block) ⇒ Object



11
12
13
# File 'lib/allplayers/monkey_patches/rest_client.rb', line 11

def self.post(url, payload, headers={}, &block)
  Request.execute(:method => :post, :url => url, :payload => payload, :headers => headers, :timeout => @timeout, :open_timeout => @open_timeout, &block)
end

.put(url, payload, headers = {}, &block) ⇒ Object



15
16
17
# File 'lib/allplayers/monkey_patches/rest_client.rb', line 15

def self.put(url, payload, headers={}, &block)
  Request.execute(:method => :put, :url => url, :payload => payload, :headers => headers, :timeout => @timeout, :open_timeout => @open_timeout, &block)
end