bolster 0.0.4 → 0.0.5

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f3fa90d2e5ef85a2306366a33f9372f7d3466760
4
- data.tar.gz: f92efc9250dc49ddcb10ac9cf3888f924308a50a
3
+ metadata.gz: e0e28364ff6dd31f50a96a983ddab6409f4bd798
4
+ data.tar.gz: ae7c69fb931c1c24b94c113805e3a16d38f56184
5
5
  SHA512:
6
- metadata.gz: ff07f7409076c1edb0e9fffef31d65d0a844d522cbcf03e60f5b3355551a27253032dacdac6765e54aa911c2900c3974868cf38fabc82927aea37361674a2251
7
- data.tar.gz: e76a9c8200de6890a78d32fb75de79cd0523fe198a87e0c1890fdc167ecfcbf105c0b5745a5b6b135c67844561301ad1a361b29035dc826d5379aa748420b079
6
+ metadata.gz: dbf7f4c2abafe21570dce8329ccef330dc832c55ec45de6a38feaaff9cf1a4ce4bcbc86534daef8961154e5459a39e1e6f6a52b8c96b569bd47c82a9166869ab
7
+ data.tar.gz: 3f70dfd9e9d70a9281fb2ab356292e4e40caf9853e58fc08c61d4145c12cbfaf28440b553bae98c78e86b2abe146a684f848c0958b775a6aaa424867d8b462cf
data/lib/bolster.rb CHANGED
@@ -3,11 +3,10 @@ require 'net/http'
3
3
 
4
4
  module Bolster
5
5
  class Server
6
- def initialize(host, port, user = '', pass = '')
6
+ def initialize(host, port, options = {})
7
7
  @host = host
8
8
  @port = port
9
- @user = user
10
- @pass = pass
9
+ @options = options
11
10
  end
12
11
 
13
12
  def delete(uri)
@@ -35,10 +34,11 @@ module Bolster
35
34
  end
36
35
 
37
36
  def request(req)
38
- res = Net::HTTP.start(@host, @port) do |h|
39
- req.basic_auth(@user, @pass) unless @user.empty?
40
- h.request(req)
37
+ if @options.has_key?(:user) && @options.has_key?(:password)
38
+ req.basic_auth(@options[:user], @options[:password])
41
39
  end
40
+
41
+ res = Net::HTTP.start(@host, @port) { |http| http.request(req) }
42
42
  unless res.kind_of?(Net::HTTPSuccess)
43
43
  handle_error(req, res)
44
44
  end
@@ -1,3 +1,3 @@
1
1
  module Bolster
2
- VERSION = '0.0.4'
3
- end
2
+ VERSION = '0.0.5'
3
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bolster
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Leon Rische
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-12-02 00:00:00.000000000 Z
11
+ date: 2013-12-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler