lita-hipchat 2.0.1 → 2.1.0

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: e12641b30c087c18ee3b25a1b4157f740f010de6
4
- data.tar.gz: 8eb8b306212cfcd1a42ea2234de06956c2d38639
3
+ metadata.gz: 518a294fc9b098810837c5ae37baedf74b41dd1d
4
+ data.tar.gz: 839c1911a104d0192263ac8ca50d7bdd57a1b812
5
5
  SHA512:
6
- metadata.gz: 0e381dfe3ce2c885fb2b4412f8b740bf1442f7e01558703c4c9972fdef4df5ea869ee1cf6f2c0f3e6c2de3f6bd64eb6830838aa8481ce7dd510b73038bbbe1cf
7
- data.tar.gz: 10e6eeb25e03551147db619926d9c48c9b90ac2e791a9953ebb7e558ed39e049bb16b431b028cfb69813d6dc3c00ca410e9093033b86adf146b99ce66dd64157
6
+ metadata.gz: 0124b4e76b0e2e11019b03acd41271a2c5e043b69e1217eb547807ebfef0e505cff46f0080adf31702bb71a08b4b20c138bcf70fd59aa3e2bf58344da7e6564c
7
+ data.tar.gz: 03c37f96b4b3c029906f2a9543cf1962efd4ecbe8fd10562c66bdfc9b4dfe470e387394e6a64004f61e87aa758b1f3e922443ba5d45583c182d801489cadf521
data/README.md CHANGED
@@ -25,6 +25,7 @@ Values for all of the following attributes can be found on the "XMPP/Jabber info
25
25
 
26
26
  ### Optional attributes
27
27
 
28
+ * `server` (String) - The HipChat Server address. Override this with the full domain of your server if using a private HipChat Server installation. Default: `"chat.hipchat.com"`
28
29
  * `debug` (Boolean) - If `true`, turns on the underlying Jabber library's (xmpp4r) logger, which is fairly verbose. Default: `false`.
29
30
  * `rooms` (Symbol, Array<String>) - An array of room JIDs that Lita should join upon connection. Can also be the symbol `:all`, which will cause Lita to discover and join all rooms. Default: `nil` (no rooms).
30
31
  * `muc_domain` (String) - The XMPP Multi-User Chat domain to use. Default: `"conf.hipchat.com"`.
@@ -44,7 +45,6 @@ Lita.configure do |config|
44
45
  config.adapters.hipchat.password = "secret"
45
46
  config.adapters.hipchat.debug = true
46
47
  config.adapters.hipchat.rooms = :all
47
- config.adapters.hipchat.muc_domain = "conf.hipchat.com"
48
48
  end
49
49
  ```
50
50
 
@@ -11,6 +11,7 @@ module Lita
11
11
  config :password, type: String, required: true
12
12
 
13
13
  # Optional attributes
14
+ config :server, type: String, default: "chat.hipchat.com"
14
15
  config :debug, type: [TrueClass, FalseClass], default: false
15
16
  config :rooms, type: [Symbol, Array]
16
17
  config :muc_domain, type: String, default: "conf.hipchat.com"
@@ -20,7 +21,7 @@ module Lita
20
21
 
21
22
  def initialize(robot)
22
23
  super
23
- @connector = Connector.new(robot, config.jid, config.password, debug: config.debug)
24
+ @connector = Connector.new(robot, config.jid, config.password, config.server, debug: config.debug)
24
25
  end
25
26
 
26
27
  def join(room_id)
@@ -11,10 +11,11 @@ module Lita
11
11
  class Connector
12
12
  attr_reader :robot, :client, :roster
13
13
 
14
- def initialize(robot, jid, password, debug: false)
14
+ def initialize(robot, jid, password, server, debug: false)
15
15
  @robot = robot
16
16
  @jid = normalized_jid(jid, "chat.hipchat.com", "bot")
17
17
  @password = password
18
+ @server = server
18
19
  @client = Jabber::Client.new(@jid)
19
20
  if debug
20
21
  Lita.logger.info("Enabling Jabber log.")
@@ -108,7 +109,7 @@ module Lita
108
109
 
109
110
  def client_connect
110
111
  Lita.logger.info("Connecting to HipChat.")
111
- client.connect
112
+ client.connect(@server)
112
113
  Lita.logger.debug("Authenticating with HipChat.")
113
114
  client.auth(@password)
114
115
  end
data/lita-hipchat.gemspec CHANGED
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |spec|
2
2
  spec.name = "lita-hipchat"
3
- spec.version = "2.0.1"
3
+ spec.version = "2.1.0"
4
4
  spec.authors = ["Jimmy Cuadra"]
5
5
  spec.email = ["jimmy@jimmycuadra.com"]
6
6
  spec.description = %q{A HipChat adapter for Lita.}
@@ -1,7 +1,7 @@
1
1
  require "spec_helper"
2
2
 
3
3
  describe Lita::Adapters::HipChat::Connector, lita: true do
4
- subject { described_class.new(robot, "user", "secret") }
4
+ subject { described_class.new(robot, "user", "secret", "chat.hipchat.com") }
5
5
 
6
6
  let(:client) do
7
7
  client = instance_double("Jabber::Client")
@@ -17,23 +17,23 @@ describe Lita::Adapters::HipChat::Connector, lita: true do
17
17
  before { allow(subject).to receive(:client).and_return(client) }
18
18
 
19
19
  it "sets the JID properly when only a node is supplied" do
20
- subject = described_class.new(robot, "user", "secret")
20
+ subject = described_class.new(robot, "user", "secret", "chat.hipchat.com")
21
21
  expect(subject.jid).to eq("user@chat.hipchat.com/bot")
22
22
  end
23
23
 
24
24
  it "sets the JID properly when a node and domain are supplied" do
25
- subject = described_class.new(robot, "user@example.com", "secret")
25
+ subject = described_class.new(robot, "user@example.com", "secret", "chat.hipchat.com")
26
26
  expect(subject.jid).to eq("user@example.com/bot")
27
27
  end
28
28
 
29
29
  it "sets the JID properly when a resource is supplied" do
30
- subject = described_class.new(robot, "user@example.com/wrong", "secret")
30
+ subject = described_class.new(robot, "user@example.com/wrong", "secret", "chat.hipchat.com")
31
31
  expect(subject.jid).to eq("user@example.com/bot")
32
32
  end
33
33
 
34
34
  it "turns on the xmpp4r logger if debug: true is supplied" do
35
35
  expect(Jabber).to receive(:debug=).with(true)
36
- subject = described_class.new(robot, "user", "secret", debug: true)
36
+ subject = described_class.new(robot, "user", "secret", "chat.hipchat.com", debug: true)
37
37
  end
38
38
 
39
39
  describe "#connect" do
@@ -57,7 +57,14 @@ describe Lita::Adapters::HipChat::Connector, lita: true do
57
57
  end
58
58
 
59
59
  it "connects to HipChat" do
60
- expect(subject.client).to receive(:connect)
60
+ expect(subject.client).to receive(:connect).with("chat.hipchat.com")
61
+ subject.connect
62
+ end
63
+
64
+ it "connects to HipChat Server" do
65
+ subject = described_class.new(robot, "user", "secret", "hipchat.example.com")
66
+ allow(subject).to receive(:client).and_return(client)
67
+ expect(subject.client).to receive(:connect).with("hipchat.example.com")
61
68
  subject.connect
62
69
  end
63
70
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lita-hipchat
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.1
4
+ version: 2.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jimmy Cuadra
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-11-05 00:00:00.000000000 Z
11
+ date: 2014-11-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: lita