hugs 2.4.0 → 2.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/Gemfile.lock +1 -1
- data/lib/hugs/client.rb +8 -8
- data/lib/hugs/version.rb +1 -1
- metadata +1 -1
data/Gemfile.lock
CHANGED
data/lib/hugs/client.rb
CHANGED
@@ -8,8 +8,8 @@ require "yajl"
|
|
8
8
|
module Hugs
|
9
9
|
class Client
|
10
10
|
attr_accessor :headers
|
11
|
-
attr_accessor :raise_4xx, :raise_5xx, :debug
|
12
|
-
attr_writer :raise_4xx, :raise_5xx, :debug
|
11
|
+
attr_accessor :raise_4xx, :raise_5xx, :debug, :http
|
12
|
+
attr_writer :raise_4xx, :raise_5xx, :debug, :http
|
13
13
|
|
14
14
|
Headers = {
|
15
15
|
:json => "application/json",
|
@@ -40,6 +40,9 @@ module Hugs
|
|
40
40
|
@scheme = options[:scheme] || "http"
|
41
41
|
@type = options[:type] || :json
|
42
42
|
@headers = options[:headers] || {}
|
43
|
+
|
44
|
+
@http = Net::HTTP::Persistent.new
|
45
|
+
@url = URI.parse "#{@scheme}://#{@host}:#{@port}"
|
43
46
|
end
|
44
47
|
|
45
48
|
##
|
@@ -79,14 +82,11 @@ module Hugs
|
|
79
82
|
# Method arguments have been documented in the callers.
|
80
83
|
|
81
84
|
def response_for request, path, params
|
82
|
-
query = params[:query] && params.delete(:query)
|
83
|
-
body = params[:body] && params.delete(:body)
|
84
|
-
upload = params[:upload] && params.delete(:upload)
|
85
|
-
|
86
|
-
@http ||= Net::HTTP::Persistent.new
|
87
85
|
@http.debug_output = $stdout if debug
|
88
|
-
@url ||= URI.parse "#{@scheme}://#{@host}:#{@port}"
|
89
86
|
|
87
|
+
query = params[:query] && params.delete(:query)
|
88
|
+
body = params[:body] && params.delete(:body)
|
89
|
+
upload = params[:upload] && params.delete(:upload)
|
90
90
|
full_path = path_with_query path, query
|
91
91
|
|
92
92
|
if upload && request.class === Net::HTTP::Post
|
data/lib/hugs/version.rb
CHANGED