Class: Fogbugz::Adapter::HTTP::NetHttp
- Inherits:
-
Object
- Object
- Fogbugz::Adapter::HTTP::NetHttp
- Defined in:
- lib/ruby_fogbugz/adapters/http/net_http.rb
Instance Attribute Summary collapse
-
#requester ⇒ Object
Returns the value of attribute requester.
-
#root_url ⇒ Object
Returns the value of attribute root_url.
Instance Method Summary collapse
-
#initialize(options = {}) ⇒ NetHttp
constructor
A new instance of NetHttp.
- #request(action, options) ⇒ Object
Constructor Details
#initialize(options = {}) ⇒ NetHttp
Returns a new instance of NetHttp.
10 11 12 |
# File 'lib/ruby_fogbugz/adapters/http/net_http.rb', line 10 def initialize( = {}) @root_url = [:uri] end |
Instance Attribute Details
#requester ⇒ Object
Returns the value of attribute requester.
8 9 10 |
# File 'lib/ruby_fogbugz/adapters/http/net_http.rb', line 8 def requester @requester end |
#root_url ⇒ Object
Returns the value of attribute root_url.
8 9 10 |
# File 'lib/ruby_fogbugz/adapters/http/net_http.rb', line 8 def root_url @root_url end |
Instance Method Details
#request(action, options) ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/ruby_fogbugz/adapters/http/net_http.rb', line 14 def request(action, ) uri = URI("#{@root_url}/api.asp") params = { 'cmd' => action } params.merge!([:params]) # build up the form request request = Net::HTTP::Post.new(uri.request_uri) request.set_form_data(params) http = Net::HTTP.new(uri.host, uri.port) http.use_ssl = @root_url.start_with? 'https' response = http.start {|http| http.request(request) } response.body end |