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.5'
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 = {}, &block) ⇒ 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.



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

def HTTPrb.delete(url, options = {}, &block)
  HTTPrb.req('DELETE', url, options, &block)
end

.get(url, options = {}, &block) ⇒ 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.



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

def HTTPrb.get(url, options = {}, &block)
  HTTPrb.req('GET', url, options, &block)
end

.head(url, options = {}, &block) ⇒ 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.



40
41
42
# File 'lib/httprb/dsl.rb', line 40

def HTTPrb.head(url, options = {}, &block)
  HTTPrb.req('HEAD', url, options, &block)
end

.post(url, options = {}, &block) ⇒ 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.



51
52
53
# File 'lib/httprb/dsl.rb', line 51

def HTTPrb.post(url, options = {}, &block)
  HTTPrb.req('POST', url, options, &block)
end

.put(url, options = {}, &block) ⇒ 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.



62
63
64
# File 'lib/httprb/dsl.rb', line 62

def HTTPrb.put(url, options = {}, &block)
  HTTPrb.req('PUT', url, options, &block)
end

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



14
15
16
17
18
19
20
# File 'lib/httprb/dsl.rb', line 14

def HTTPrb.req(type, url, options = {}, &block)
  options[:type] = type.upcase
  req = Request.new(url, options)
  #yield(req) if block_given?
  req.evaluate(&block) if block_given?
  HTTPrb::HTTPCache.instance.make_request(req)
end