skyfallsin-ruby_bosh 0.3.1 → 0.3.2

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.
Files changed (3) hide show
  1. data/VERSION.yml +1 -1
  2. data/lib/ruby_bosh.rb +6 -2
  3. metadata +1 -1
data/VERSION.yml CHANGED
@@ -1,4 +1,4 @@
1
1
  ---
2
- :patch: 1
2
+ :patch: 2
3
3
  :major: 0
4
4
  :minor: 3
data/lib/ruby_bosh.rb CHANGED
@@ -3,6 +3,7 @@ require 'builder'
3
3
  require 'rexml/document'
4
4
  require 'base64'
5
5
  require 'hpricot'
6
+ require 'timeout'
6
7
  require 'system_timer'
7
8
 
8
9
  class RubyBOSH
@@ -14,6 +15,7 @@ class RubyBOSH
14
15
 
15
16
  class Timeout < StandardError; end
16
17
  class AuthFailed < StandardError; end
18
+ class ConnFailed < StandardError; end
17
19
 
18
20
  attr_accessor :jid, :rid, :sid, :success
19
21
  def initialize(jid, pw, service_url, opts={})
@@ -124,8 +126,10 @@ class RubyBOSH
124
126
  send(xml)
125
127
  recv(RestClient.post(@service_url, xml, @headers))
126
128
  end
127
- rescue Timeout::Error => e
128
- raise RubyBOSHClient::Timeout, e.message
129
+ rescue ::Timeout::Error => e
130
+ raise RubyBOSH::Timeout, e.message
131
+ rescue Errno::ECONNREFUSED => e
132
+ raise RubyBOSH::ConnFailed, "could not connect to #{@host}\n#{e.message}"
129
133
  end
130
134
 
131
135
  def send(msg)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: skyfallsin-ruby_bosh
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.1
4
+ version: 0.3.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Pradeep Elankumaran