Module: HTTPrb

Defined in:
lib/httprb.rb,
lib/httprb/dsl.rb,
lib/httprb/request.rb,
lib/httprb/version.rb,
lib/httprb/delegate.rb,
lib/httprb/http_cache.rb

Defined Under Namespace

Modules: Delegator Classes: HTTPCache, Request

Constant Summary collapse

VERSION =

HTTPrb version

'0.1.3'
VERSION_ARRAY =

:nodoc:

VERSION.split(/\./).map { |x| x.to_i }
VERSION_MAJOR =

:nodoc:

VERSION_ARRAY[0]
VERSION_MINOR =

:nodoc:

VERSION_ARRAY[1]
VERSION_BUILD =

:nodoc:

VERSION_ARRAY[2]

Class Method Summary collapse

Class Method Details

.delete(url, options = {}) {|req| ... } ⇒ Object

delete request

  • options are not generally used; HTTPrb::Request offers additional methods for option generation/ handling.

  • accepts a block, handing off the HTTPrb::Request object to it, if provided.

Yields:

  • (req)


84
85
86
87
88
89
# File 'lib/httprb/dsl.rb', line 84

def HTTPrb.delete(url, options = {})
  options[:type] = 'DELETE'
  req = Request.new(url, options)
  yield(req) if block_given?
  HTTPrb::HTTPCache.instance.make_request(req)
end

.get(url, options = {}) {|req| ... } ⇒ Object

get request

  • options are not generally used; HTTPrb::Request offers additional methods for option generation/ handling.

  • accepts a block, handing off the HTTPrb::Request object to it, if provided.

Yields:

  • (req)


28
29
30
31
32
33
# File 'lib/httprb/dsl.rb', line 28

def HTTPrb.get(url, options = {})
  options[:type] = 'GET'
  req = Request.new(url, options)
  yield(req) if block_given?
  HTTPrb::HTTPCache.instance.make_request(req)
end

.head(url, options = {}) {|req| ... } ⇒ Object

head request

  • options are not generally used; HTTPrb::Request offers additional methods for option generation/ handling.

  • accepts a block, handing off the HTTPrb::Request object to it, if provided.

Yields:

  • (req)


42
43
44
45
46
47
# File 'lib/httprb/dsl.rb', line 42

def HTTPrb.head(url, options = {})
  options[:type] = 'HEAD'
  req = Request.new(url, options)
  yield(req) if block_given?
  HTTPrb::HTTPCache.instance.make_request(req)
end

.post(url, options = {}) {|req| ... } ⇒ Object

post request

  • options are not generally used; HTTPrb::Request offers additional methods for option generation/ handling.

  • accepts a block, handing off the HTTPrb::Request object to it, if provided.

Yields:

  • (req)


56
57
58
59
60
61
# File 'lib/httprb/dsl.rb', line 56

def HTTPrb.post(url, options = {})
  options[:type] = 'POST'
  req = Request.new(url, options)
  yield(req) if block_given?
  HTTPrb::HTTPCache.instance.make_request(req)
end

.put(url, options = {}) {|req| ... } ⇒ Object

put request

  • options are not generally used; HTTPrb::Request offers additional methods for option generation/ handling.

  • accepts a block, handing off the HTTPrb::Request object to it, if provided.

Yields:

  • (req)


70
71
72
73
74
75
# File 'lib/httprb/dsl.rb', line 70

def HTTPrb.put(url, options = {})
  options[:type] = 'PUT'
  req = Request.new(url, options)
  yield(req) if block_given?
  HTTPrb::HTTPCache.instance.make_request(req)
end