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
-
.delete(url, options = {}, &block) ⇒ Object
delete request.
-
.get(url, options = {}, &block) ⇒ Object
get request.
-
.head(url, options = {}, &block) ⇒ Object
head request.
-
.post(url, options = {}, &block) ⇒ Object
post request.
-
.put(url, options = {}, &block) ⇒ Object
put request.
- .req(type, url, options = {}, &block) ⇒ Object
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, = {}, &block) HTTPrb.req('DELETE', url, , &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, = {}, &block) HTTPrb.req('GET', url, , &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, = {}, &block) HTTPrb.req('HEAD', url, , &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, = {}, &block) HTTPrb.req('POST', url, , &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, = {}, &block) HTTPrb.req('PUT', url, , &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, = {}, &block) [:type] = type.upcase req = Request.new(url, ) #yield(req) if block_given? req.evaluate(&block) if block_given? HTTPrb::HTTPCache.instance.make_request(req) end |