Class: HttpMini
- Inherits:
-
Object
- Object
- HttpMini
- Defined in:
- lib/http_mini.rb
Constant Summary collapse
- OPEN_TIMEOUT =
2- READ_TIMEOUT =
2- IGNORE_ERROR =
true
Instance Attribute Summary collapse
-
#opts ⇒ Object
Returns the value of attribute opts.
-
#uri ⇒ Object
readonly
Returns the value of attribute uri.
Class Method Summary collapse
Instance Method Summary collapse
- #delete ⇒ Object
- #get ⇒ Object
- #head ⇒ Object
-
#initialize(url, opts = {}) ⇒ HttpMini
constructor
A new instance of HttpMini.
- #options ⇒ Object
- #ping ⇒ Object
- #post(data) ⇒ Object
- #put(data) ⇒ Object
Constructor Details
#initialize(url, opts = {}) ⇒ HttpMini
Returns a new instance of HttpMini.
17 18 19 20 |
# File 'lib/http_mini.rb', line 17 def initialize(url, opts = {}) self.uri = url self.opts = opts end |
Instance Attribute Details
#opts ⇒ Object
Returns the value of attribute opts.
7 8 9 |
# File 'lib/http_mini.rb', line 7 def opts @opts end |
#uri ⇒ Object
Returns the value of attribute uri.
6 7 8 |
# File 'lib/http_mini.rb', line 6 def uri @uri end |
Class Method Details
.VERSION ⇒ Object
13 14 15 |
# File 'lib/http_mini.rb', line 13 def self.VERSION '0.1.1' end |
Instance Method Details
#delete ⇒ Object
38 39 40 |
# File 'lib/http_mini.rb', line 38 def delete request { |http| http.delete(path) } end |
#get ⇒ Object
26 27 28 |
# File 'lib/http_mini.rb', line 26 def get request { |http| http.get(path) } end |
#head ⇒ Object
22 23 24 |
# File 'lib/http_mini.rb', line 22 def head request { |http| http.head(path) } end |
#options ⇒ Object
42 43 44 |
# File 'lib/http_mini.rb', line 42 def request { |http| http.(path) } end |
#ping ⇒ Object
46 47 48 |
# File 'lib/http_mini.rb', line 46 def ping success? head end |
#post(data) ⇒ Object
30 31 32 |
# File 'lib/http_mini.rb', line 30 def post(data) request { |http| http.post(path, data) } end |
#put(data) ⇒ Object
34 35 36 |
# File 'lib/http_mini.rb', line 34 def put(data) request { |http| http.put(path, data) } end |