diff --git a/lib/service.rb b/lib/service.rb index e7dd61788..211177438 100644 --- a/lib/service.rb +++ b/lib/service.rb @@ -598,9 +598,9 @@ def http_get(url = nil, params = nil, headers = nil) # # Yields a Faraday::Request instance. # Returns a Faraday::Response instance. - def http_post(url = nil, body = nil, headers = nil) + def http_post(url = nil, body = nil, headers = nil, params = nil) block = Proc.new if block_given? - http_method :post, url, body, headers, &block + http_method :post, url, body, headers, params, &block end # Public: Makes an HTTP call. @@ -630,7 +630,7 @@ def http_post(url = nil, body = nil, headers = nil) # # Yields a Faraday::Request instance. # Returns a Faraday::Response instance. - def http_method(method, url = nil, body = nil, headers = nil) + def http_method(method, url = nil, body = nil, headers = nil, params = nil) block = Proc.new if block_given? raise_config_error("Invalid scheme") unless permitted_transport?(url) @@ -640,6 +640,7 @@ def http_method(method, url = nil, body = nil, headers = nil) req.url(url) if url req.headers.update(headers) if headers req.body = body if body + req.params = params if params block.call req if block end end diff --git a/lib/services/active_collab.rb b/lib/services/active_collab.rb index 601e547bd..64f4ebe21 100644 --- a/lib/services/active_collab.rb +++ b/lib/services/active_collab.rb @@ -36,14 +36,15 @@ def receive_push build_message = statuses * "\n" - http.url_prefix = data['url'] - http.headers['Accept'] = 'application/xml' + url = data['url'] + body = params(push_message, build_message) + headers = {:Accept => 'application/xml'} + params = { + :path_info => "projects/#{data['project_id']}/discussions/add", + :token => data['token'] + } - http.post do |req| - req.params['path_info'] = "projects/#{data['project_id']}/discussions/add" - req.params['token'] = data['token'] - req.body = params(push_message, build_message) - end + http_post url, body, headers, params end def params(name, message) diff --git a/test/active_collab_test.rb b/test/active_collab_test.rb index d78a0502e..3dc016096 100644 --- a/test/active_collab_test.rb +++ b/test/active_collab_test.rb @@ -38,6 +38,3 @@ def service(*args) super Service::ActiveCollab, *args end end - - -