Class: Horseman::Connection
- Inherits:
-
Object
- Object
- Horseman::Connection
- Defined in:
- lib/horseman/connection.rb
Instance Attribute Summary collapse
-
#http ⇒ Object
readonly
Returns the value of attribute http.
-
#uri ⇒ Object
readonly
Returns the value of attribute uri.
Instance Method Summary collapse
Instance Attribute Details
#http ⇒ Object (readonly)
Returns the value of attribute http.
7 8 9 |
# File 'lib/horseman/connection.rb', line 7 def http @http end |
#uri ⇒ Object (readonly)
Returns the value of attribute uri.
7 8 9 |
# File 'lib/horseman/connection.rb', line 7 def uri @uri end |
Instance Method Details
#build_request(options = {}) ⇒ Object
18 19 20 21 22 23 |
# File 'lib/horseman/connection.rb', line 18 def build_request(={}) self.url = [:url] unless [:url].nil? puts "#{([:verb] || :get).to_s.upcase} #{[:url] || 'none given'}" [:verb] == (:get || nil) ? build_get_request : build_post_request([:body]) end |
#exec_request(request) ⇒ Object
14 15 16 |
# File 'lib/horseman/connection.rb', line 14 def exec_request(request) @http.request(request) end |
#url=(url) ⇒ Object
9 10 11 12 |
# File 'lib/horseman/connection.rb', line 9 def url=(url) @uri = URI.parse(url) build_http end |