xrc 0.1.1 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 09c52dabd4cb36ef0aa8f4fe0a47e58513bde212
4
- data.tar.gz: e7de2dc52efff5426ac88f1e1250cf3d54f1e7b4
3
+ metadata.gz: 623e48f93776eca276667f03ee7830b090d0c944
4
+ data.tar.gz: 6337c2e1aa912e42b241e085ccb6b538bacafefd
5
5
  SHA512:
6
- metadata.gz: 1e6a674ed0dc77b987a883d9e8b7f6064b0dc6d786d96813a163c676d058f03b1952823ab136dc90cb40aec841d7610578e5589177c067f872afe6bb27af615f
7
- data.tar.gz: 5dd6a07664227ca0e391a6f0ee2cb424aba0e4d36f9facee7f9fdbfcaf2853c21629cae5cd4032860f961e98195e939f726d6acb597ceb50fa13c0de8e045577
6
+ metadata.gz: 2082dc713972a5e5737461c22286f0db35fab8010600c6db937b97b88d83ef14aaf0a7333e00a62a4402d8ba918d9dde397e2438fe79d693d29cb5492a136b82
7
+ data.tar.gz: f4cb58ec4f87312d03f533a0670fa9a286af53130c4d97c78f0efb8d81c61ef17baaea91e6695e162e223637a728dba9bc6249129781c9043ec19e944079cb0f
data/CHANGELOG.md CHANGED
@@ -1,3 +1,6 @@
1
+ ## 0.1.2
2
+ * Support hosts option
3
+
1
4
  ## 0.1.1
2
5
  * Support invite message
3
6
 
data/README.md CHANGED
@@ -11,6 +11,7 @@ client = Xrc::Client.new(
11
11
  jid: "foo@example.com", # required
12
12
  nickname: "bot" # optional
13
13
  password: "xxx", # optional
14
+ hosts: [ "example.com" ], # optional, automatically determined from JID in absence
14
15
  port: 5222, # optional, default: 5222
15
16
  room_jid: "bar@example.com", # optional, you can pass comma-separated multi room JIDs
16
17
  )
data/lib/xrc/client.rb CHANGED
@@ -180,6 +180,10 @@ module Xrc
180
180
  @options[:nickname]
181
181
  end
182
182
 
183
+ def hosts
184
+ @options[:hosts]
185
+ end
186
+
183
187
  def port
184
188
  @options[:port] || DEFAULT_PORT
185
189
  end
@@ -194,7 +198,7 @@ module Xrc
194
198
  end
195
199
 
196
200
  def connection
197
- @connection ||= Connection.new(domain: jid.domain, port: port) do |element|
201
+ @connection ||= Connection.new(domain: jid.domain, hosts: hosts, port: port) do |element|
198
202
  on_received(element)
199
203
  end
200
204
  end
@@ -1,15 +1,16 @@
1
1
  module Xrc
2
2
  class Connection
3
- attr_reader :block, :domain, :port, :socket
3
+ attr_reader :block, :domain, :hosts, :port, :socket
4
4
 
5
5
  def initialize(options, &block)
6
6
  @domain = options[:domain]
7
+ @hosts = options[:hosts]
7
8
  @port = options[:port]
8
9
  @block = block
9
10
  end
10
11
 
11
12
  def connect
12
- @socket = Connector.connect(domain: domain, port: port)
13
+ @socket = Connector.connect(domain: domain, hosts: hosts, port: port)
13
14
  start
14
15
  end
15
16
 
@@ -30,7 +30,7 @@ module Xrc
30
30
  end
31
31
 
32
32
  def hosts
33
- HostsResolver.call(domain)
33
+ options[:hosts] || HostsResolver.call(domain)
34
34
  end
35
35
 
36
36
  def connect_to(host)
data/lib/xrc/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Xrc
2
- VERSION = "0.1.1"
2
+ VERSION = "0.1.2"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: xrc
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ryo Nakamura
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-06-22 00:00:00.000000000 Z
11
+ date: 2014-08-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport