hipchat 0.11.0 → 0.12.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: b14a3d503b8dd0e2328c0428d84ce558d8610997
4
- data.tar.gz: 149915edf47032db069730107a43b85e00a57dfe
3
+ metadata.gz: be4faa179685cdd34630559010e1f4f8433d12d2
4
+ data.tar.gz: ceb3933c95e331a8735199c0cf3f284bfdad078c
5
5
  SHA512:
6
- metadata.gz: 2bc937a5155d8c7c7b5f666fec0bec676b26517a8c3b5834faafffa0097b8faab3d742fd66f521ebca98325aadd94c6d8acc7483c69393fb5fc45446ebb57051
7
- data.tar.gz: 3f03b59bb670761e06120cfc91e84e497b20418e7e9c7aa9b29d60ed1a14cfe73fbe0de0fd453f7be17b07d2beebb5d046e8639eb69fb3771671f5a664fbf848
6
+ metadata.gz: 6a0d5ce3f382e4ac4a4b04890361e92d7a886570752c21567c6e74c163e67b8873e15be661fc321f4c5267fd203d36dcb29a4815e22feabda17c22308862a871
7
+ data.tar.gz: 0b75dfbccbff349ca3eab259b458da322a7cc9875d0cba17fcf69183d37549231d175a9302d173083138503d6f4933e4be24ebc2027cc55c2cf1457ba8d61c69
data/.gitignore CHANGED
@@ -22,7 +22,7 @@ pkg
22
22
  .bundle
23
23
  .config
24
24
  .yardoc
25
- Gemfile.lock
25
+ /Gemfile.lock
26
26
  InstalledFiles
27
27
  _yardoc
28
28
  doc/
@@ -5,5 +5,3 @@ rvm:
5
5
  - 1.9.2
6
6
  - 1.9.3
7
7
  - 2.0.0
8
-
9
- script: bundle exec rspec spec
@@ -9,6 +9,7 @@ h2. Build Status
9
9
  h2. Usage
10
10
 
11
11
  bc.. client = HipChat::Client.new(api_token)
12
+ # 'username' is the name for which the message will be presented as from
12
13
  client['my room'].send('username', 'I talk')
13
14
 
14
15
  # Send notifications to users (default false)
data/Rakefile CHANGED
@@ -1,4 +1,10 @@
1
1
  require "bundler/gem_tasks"
2
+ require 'rspec/core/rake_task'
3
+
4
+ RSpec::Core::RakeTask.new do |t|
5
+ t.pattern = 'spec/**/*_spec.rb'
6
+ t.rspec_opts = '-c -fd'
7
+ end
2
8
 
3
9
  task :default => :spec
4
10
 
@@ -25,4 +25,5 @@ Gem::Specification.new do |spec|
25
25
  spec.add_development_dependency "bundler", "~> 1.3"
26
26
  spec.add_development_dependency "rake"
27
27
  spec.add_development_dependency "webmock"
28
+ spec.add_development_dependency 'rdoc', '> 2.4.2'
28
29
  end
@@ -16,8 +16,11 @@ module HipChat
16
16
  base_uri 'https://api.hipchat.com/v1/rooms'
17
17
  format :json
18
18
 
19
- def initialize(token)
19
+ def initialize(token, options={})
20
20
  @token = token
21
+
22
+ http_proxy = options[:http_proxy] || ENV['http_proxy']
23
+ setup_proxy(http_proxy) if http_proxy
21
24
  end
22
25
 
23
26
  def rooms
@@ -28,6 +31,16 @@ module HipChat
28
31
  def [](name)
29
32
  Room.new(@token, :room_id => name)
30
33
  end
34
+
35
+ private
36
+ def setup_proxy(proxy_url)
37
+ proxy_url = URI.parse(proxy_url)
38
+
39
+ self.class.http_proxy(proxy_url.host, proxy_url.port,
40
+ proxy_url.user, proxy_url.password)
41
+ HipChat::Room.http_proxy(proxy_url.host, proxy_url.port,
42
+ proxy_url.user, proxy_url.password)
43
+ end
31
44
  end
32
45
 
33
46
  class Room < OpenStruct
@@ -1,3 +1,3 @@
1
1
  module HipChat
2
- VERSION = "0.11.0"
2
+ VERSION = "0.12.0"
3
3
  end
@@ -172,4 +172,38 @@ describe HipChat do
172
172
  should raise_error(HipChat::UnknownResponseCode)
173
173
  end
174
174
  end
175
+
176
+ describe 'http_proxy' do
177
+ let(:proxy_user) { 'proxy_user' }
178
+ let(:proxy_pass) { 'proxy_pass' }
179
+ let(:proxy_host) { 'proxy.example.com' }
180
+ let(:proxy_port) { 2649 }
181
+ let(:proxy_url) { "http://#{proxy_user}:#{proxy_pass}@#{proxy_host}:#{proxy_port}" }
182
+
183
+ context 'specified by option of constructor' do
184
+ before do
185
+ HipChat::Client.new("blah", :http_proxy => proxy_url)
186
+ end
187
+
188
+ subject { HipChat::Client.default_options }
189
+
190
+ specify "Client's proxy settings should be changed" do
191
+ expect(subject[:http_proxyaddr]).to eql(proxy_host)
192
+ expect(subject[:http_proxyport]).to eql(proxy_port)
193
+ expect(subject[:http_proxyuser]).to eql(proxy_user)
194
+ expect(subject[:http_proxypass]).to eql(proxy_pass)
195
+ end
196
+
197
+ describe "Room class's proxy" do
198
+ subject { HipChat::Room.default_options }
199
+
200
+ specify "proxy settings should be changed" do
201
+ expect(subject[:http_proxyaddr]).to eql(proxy_host)
202
+ expect(subject[:http_proxyport]).to eql(proxy_port)
203
+ expect(subject[:http_proxyuser]).to eql(proxy_user)
204
+ expect(subject[:http_proxypass]).to eql(proxy_pass)
205
+ end
206
+ end
207
+ end
208
+ end
175
209
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hipchat
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.11.0
4
+ version: 0.12.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - HipChat/Atlassian
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-07-19 00:00:00.000000000 Z
11
+ date: 2013-09-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: httparty
@@ -94,6 +94,20 @@ dependencies:
94
94
  - - '>='
95
95
  - !ruby/object:Gem::Version
96
96
  version: '0'
97
+ - !ruby/object:Gem::Dependency
98
+ name: rdoc
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - '>'
102
+ - !ruby/object:Gem::Version
103
+ version: 2.4.2
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - '>'
109
+ - !ruby/object:Gem::Version
110
+ version: 2.4.2
97
111
  description: Ruby library to interact with HipChat
98
112
  email:
99
113
  - support@hipchat.com
@@ -105,7 +119,6 @@ files:
105
119
  - .gitignore
106
120
  - .travis.yml
107
121
  - Gemfile
108
- - Gemfile.lock
109
122
  - LICENSE
110
123
  - README.textile
111
124
  - Rakefile
@@ -140,7 +153,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
140
153
  version: '0'
141
154
  requirements: []
142
155
  rubyforge_project:
143
- rubygems_version: 2.0.3
156
+ rubygems_version: 2.0.6
144
157
  signing_key:
145
158
  specification_version: 4
146
159
  summary: Ruby library to interact with HipChat