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 CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- hugs (2.3.0)
4
+ hugs (2.4.0)
5
5
  multipart-post (~> 1.0.1)
6
6
  net-http-persistent (~> 1.4.1)
7
7
  nokogiri (~> 1.4.4)
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
@@ -1,3 +1,3 @@
1
1
  module Hugs
2
- VERSION = "2.4.0"
2
+ VERSION = "2.5.0"
3
3
  end
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: hugs
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 2.4.0
5
+ version: 2.5.0
6
6
  platform: ruby
7
7
  authors:
8
8
  - John Dewey