hipchat 1.5.1 → 1.5.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.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 46a4547a9f0d2cd12a211d78560fe3dfe7305b7b
4
+ data.tar.gz: 9c32aee4cd61577dff4f2d7ada82de5fc7151b95
5
+ SHA512:
6
+ metadata.gz: a600e14c058610d0884bdc56a35838a5146a4603451b9f98eff32086af5452fb72193ed7d338ae56cbe3540d4817803223c7ae5db9988c5c801eaee74be5b84b
7
+ data.tar.gz: d4360c4bbf9958d8385c1e24d5fff0b22c13a36043b3943c05710a172a09b38c95b7a74e1da777ad5ef055b0f0c1cf0269f90149f210da8c4650a102ecb6fc68
@@ -154,6 +154,7 @@ bc.. # Required
154
154
  set :hipchat_token, "<your token>"
155
155
  set :hipchat_room_name, "Your room" # If you pass an array such as ["room_a", "room_b"] you can send announcements to multiple rooms.
156
156
  # Optional
157
+ set :hipchat_enabled, true # set to false to prevent any messages from being sent
157
158
  set :hipchat_announce, false # notify users
158
159
  set :hipchat_color, 'yellow' #normal message color
159
160
  set :hipchat_success_color, 'green' #finished deployment message color
@@ -201,6 +202,7 @@ room: ["Room name(s) or id(s)"] # this is an array
201
202
  user: "Your name" # Default to `whoami`
202
203
  notify: true # Defaults to false
203
204
  api_version: "v2" # optional, defaults to v1
205
+ color: "yellow"
204
206
 
205
207
  h2. Engine Yard
206
208
 
@@ -209,12 +211,12 @@ Use a "deploy hook":http://bit.ly/qnbIkP to send messages from Engine Yard's Clo
209
211
  RAILS_ROOT/deploy/after_restart.rb:
210
212
 
211
213
  bc.. on_app_master do
212
- message = "Deploying revision #{revision[0...6]} to #{node[:environment][:name]}"
213
- message += " (with migrations)" if migrate?
214
+ message = "Deploying revision #{config.active_revision} to #{config.environment_name}"
215
+ message += " (with migrations)" if config.migrate?
214
216
  message += "."
215
217
 
216
218
  # Send a message via rake task assuming a hipchat.yml in your config like above
217
- run "cd #{release_path} && bundle exec rake hipchat:send MESSAGE='#{message}'"
219
+ run "cd #{config.release_path} && bundle exec rake hipchat:send MESSAGE='#{message}'"
218
220
  end
219
221
 
220
222
  h2. Chef Handler
@@ -25,7 +25,7 @@ namespace :hipchat do
25
25
  end
26
26
 
27
27
  def send_message(message, options)
28
- return unless options[:notify]
28
+ return unless enabled?
29
29
 
30
30
  hipchat_token = fetch(:hipchat_token)
31
31
  hipchat_room_name = fetch(:hipchat_room_name)
@@ -51,6 +51,10 @@ namespace :hipchat do
51
51
  }
52
52
  end
53
53
 
54
+ def enabled?
55
+ fetch(:hipchat_enabled, true)
56
+ end
57
+
54
58
  def environment_string
55
59
  if fetch(:stage)
56
60
  "#{fetch(:stage)} (#{environment_name})"
@@ -58,6 +58,8 @@ Capistrano::Configuration.instance(:must_exist).load do
58
58
  end
59
59
 
60
60
  def send(message, options)
61
+ return unless enabled?
62
+
61
63
  hipchat_options = fetch(:hipchat_options, {})
62
64
  set :hipchat_client, HipChat::Client.new(hipchat_token, hipchat_options) if fetch(:hipchat_client, nil).nil?
63
65
 
@@ -79,6 +81,10 @@ Capistrano::Configuration.instance(:must_exist).load do
79
81
  }
80
82
  end
81
83
 
84
+ def enabled?
85
+ fetch(:hipchat_enabled, true)
86
+ end
87
+
82
88
  def deployment_name
83
89
  if fetch(:branch, nil)
84
90
  name = "#{application}/#{branch}"
@@ -230,11 +230,12 @@ module HipChat
230
230
  # (default "JSON")
231
231
  def history(options = {})
232
232
 
233
- options = {
234
- :date => 'recent',
235
- :timezone => 'UTC',
236
- :format => 'JSON',
237
- :'max-results' => 100
233
+ options = {
234
+ :date => 'recent',
235
+ :timezone => 'UTC',
236
+ :format => 'JSON',
237
+ :'max-results' => 100,
238
+ :'start-index' => 0
238
239
  }.merge options
239
240
 
240
241
  response = self.class.get(@api.history_config[:url],
@@ -244,6 +245,7 @@ module HipChat
244
245
  :timezone => options[:timezone],
245
246
  :format => options[:format],
246
247
  :'max-results' => options[:'max-results'],
248
+ :'start-index' => options[:'start-index'],
247
249
  :auth_token => @token
248
250
  },
249
251
  :headers => @api.headers
@@ -1,3 +1,3 @@
1
1
  module HipChat
2
- VERSION = '1.5.1'
2
+ VERSION = '1.5.2'
3
3
  end
@@ -15,8 +15,8 @@ describe "HipChat (API V1)" do
15
15
  end
16
16
 
17
17
  it "is successful with custom options" do
18
- mock_successful_history(:timezone => 'America/Los_Angeles', :date => '2010-11-19', :'max-results' => 10)
19
- expect(room.history(:timezone => 'America/Los_Angeles', :date => '2010-11-19', :'max-results' => 10)).to be_truthy
18
+ mock_successful_history(:timezone => 'America/Los_Angeles', :date => '2010-11-19', :'max-results' => 10, :'start-index' => 10)
19
+ expect(room.history(:timezone => 'America/Los_Angeles', :date => '2010-11-19', :'max-results' => 10, :'start-index' => 10)).to be_truthy
20
20
  end
21
21
 
22
22
  it "is successful from fetched room" do
@@ -16,8 +16,8 @@ describe "HipChat (API V2)" do
16
16
  end
17
17
 
18
18
  it "is successful with custom options" do
19
- mock_successful_history(:timezone => 'America/Los_Angeles', :date => '2010-11-19', :'max-results' => 10)
20
- expect(room.history(:timezone => 'America/Los_Angeles', :date => '2010-11-19', :'max-results' => 10)).to be_truthy
19
+ mock_successful_history(:timezone => 'America/Los_Angeles', :date => '2010-11-19', :'max-results' => 10, :'start-index' => 10)
20
+ expect(room.history(:timezone => 'America/Los_Angeles', :date => '2010-11-19', :'max-results' => 10, :'start-index' => 10)).to be_truthy
21
21
  end
22
22
 
23
23
  it "is successful from fetched room" do
@@ -35,4 +35,39 @@ describe HipChat do
35
35
  end
36
36
  end
37
37
  end
38
+
39
+ describe 'options' do
40
+
41
+ context "api_version" do
42
+
43
+ it "defaults to a v1 client" do
44
+ client = HipChat::Client.new("blah")
45
+ expect(client[:example].api_version).to eql('v1')
46
+ end
47
+
48
+ it "when given 'v1' it registers a v1 client" do
49
+ client = HipChat::Client.new("blah", :api_version => 'v1')
50
+ expect(client[:example].api_version).to eql('v1')
51
+ end
52
+
53
+ it "when given 'v2' it registers a v2 client" do
54
+ client = HipChat::Client.new("blah", :api_version => 'v2')
55
+ expect(client[:example].api_version).to eql('v2')
56
+ end
57
+ end
58
+
59
+ context "server_url" do
60
+
61
+ it "defaults to 'https://api.hipchat.com'" do
62
+ client = HipChat::Client.new("derr")
63
+ expect(client[:example].server_url).to eql('https://api.hipchat.com')
64
+ end
65
+
66
+ it "can be overridden to 'http://hipchat.example.com'" do
67
+ client = HipChat::Client.new("derr", :server_url => 'http://hipchat.example.com')
68
+ expect(client[:example].server_url).to eql('http://hipchat.example.com')
69
+ end
70
+ end
71
+ end
38
72
  end
73
+
@@ -41,13 +41,14 @@ shared_context "HipChatV1" do
41
41
  end
42
42
 
43
43
  def mock_successful_history(options={})
44
- options = { :date => 'recent', :timezone => 'UTC', :format => 'JSON', :'max-results' => 100 }.merge(options)
44
+ options = { :date => 'recent', :timezone => 'UTC', :format => 'JSON', :'max-results' => 100, :'start-index' => 0 }.merge(options)
45
45
  canned_response = File.new(HISTORY_JSON_PATH)
46
46
  stub_request(:get, "https://api.hipchat.com/v1/rooms/history").with(:query => {:auth_token => "blah",
47
47
  :room_id => "Hipchat",
48
48
  :date => options[:date],
49
49
  :timezone => options[:timezone],
50
50
  :'max-results' => options[:'max-results'],
51
+ :'start-index' => options[:'start-index'],
51
52
  :format => options[:format]}).to_return(canned_response)
52
53
  end
53
54
 
@@ -112,13 +113,14 @@ shared_context "HipChatV2" do
112
113
  end
113
114
 
114
115
  def mock_successful_history(options={})
115
- options = { :date => 'recent', :timezone => 'UTC', :format => 'JSON', :'max-results' => 100 }.merge(options)
116
+ options = { :date => 'recent', :timezone => 'UTC', :format => 'JSON', :'max-results' => 100, :'start-index' => 0 }.merge(options)
116
117
  canned_response = File.new(HISTORY_JSON_PATH)
117
118
  stub_request(:get, "https://api.hipchat.com/v2/room/Hipchat/history").with(:query => {:auth_token => "blah",
118
119
  :room_id => "Hipchat",
119
120
  :date => options[:date],
120
121
  :timezone => options[:timezone],
121
122
  :'max-results' => options[:'max-results'],
123
+ :'start-index' => options[:'start-index'],
122
124
  :format => options[:format]}).to_return(canned_response)
123
125
  end
124
126
 
metadata CHANGED
@@ -1,158 +1,139 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hipchat
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.5.1
5
- prerelease:
4
+ version: 1.5.2
6
5
  platform: ruby
7
6
  authors:
8
7
  - HipChat/Atlassian
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2015-04-08 00:00:00.000000000 Z
11
+ date: 2015-07-20 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: httparty
16
15
  requirement: !ruby/object:Gem::Requirement
17
- none: false
18
16
  requirements:
19
- - - ! '>='
17
+ - - ">="
20
18
  - !ruby/object:Gem::Version
21
19
  version: '0'
22
20
  type: :runtime
23
21
  prerelease: false
24
22
  version_requirements: !ruby/object:Gem::Requirement
25
- none: false
26
23
  requirements:
27
- - - ! '>='
24
+ - - ">="
28
25
  - !ruby/object:Gem::Version
29
26
  version: '0'
30
27
  - !ruby/object:Gem::Dependency
31
28
  name: mimemagic
32
29
  requirement: !ruby/object:Gem::Requirement
33
- none: false
34
30
  requirements:
35
- - - ! '>='
31
+ - - ">="
36
32
  - !ruby/object:Gem::Version
37
33
  version: '0'
38
34
  type: :runtime
39
35
  prerelease: false
40
36
  version_requirements: !ruby/object:Gem::Requirement
41
- none: false
42
37
  requirements:
43
- - - ! '>='
38
+ - - ">="
44
39
  - !ruby/object:Gem::Version
45
40
  version: '0'
46
41
  - !ruby/object:Gem::Dependency
47
42
  name: rspec
48
43
  requirement: !ruby/object:Gem::Requirement
49
- none: false
50
44
  requirements:
51
- - - ~>
45
+ - - "~>"
52
46
  - !ruby/object:Gem::Version
53
47
  version: '3.0'
54
48
  type: :development
55
49
  prerelease: false
56
50
  version_requirements: !ruby/object:Gem::Requirement
57
- none: false
58
51
  requirements:
59
- - - ~>
52
+ - - "~>"
60
53
  - !ruby/object:Gem::Version
61
54
  version: '3.0'
62
55
  - !ruby/object:Gem::Dependency
63
56
  name: rr
64
57
  requirement: !ruby/object:Gem::Requirement
65
- none: false
66
58
  requirements:
67
- - - ! '>='
59
+ - - ">="
68
60
  - !ruby/object:Gem::Version
69
61
  version: '0'
70
62
  type: :development
71
63
  prerelease: false
72
64
  version_requirements: !ruby/object:Gem::Requirement
73
- none: false
74
65
  requirements:
75
- - - ! '>='
66
+ - - ">="
76
67
  - !ruby/object:Gem::Version
77
68
  version: '0'
78
69
  - !ruby/object:Gem::Dependency
79
70
  name: bundler
80
71
  requirement: !ruby/object:Gem::Requirement
81
- none: false
82
72
  requirements:
83
- - - ~>
73
+ - - "~>"
84
74
  - !ruby/object:Gem::Version
85
75
  version: '1.3'
86
76
  type: :development
87
77
  prerelease: false
88
78
  version_requirements: !ruby/object:Gem::Requirement
89
- none: false
90
79
  requirements:
91
- - - ~>
80
+ - - "~>"
92
81
  - !ruby/object:Gem::Version
93
82
  version: '1.3'
94
83
  - !ruby/object:Gem::Dependency
95
84
  name: rake
96
85
  requirement: !ruby/object:Gem::Requirement
97
- none: false
98
86
  requirements:
99
- - - ! '>='
87
+ - - ">="
100
88
  - !ruby/object:Gem::Version
101
89
  version: '0'
102
90
  type: :development
103
91
  prerelease: false
104
92
  version_requirements: !ruby/object:Gem::Requirement
105
- none: false
106
93
  requirements:
107
- - - ! '>='
94
+ - - ">="
108
95
  - !ruby/object:Gem::Version
109
96
  version: '0'
110
97
  - !ruby/object:Gem::Dependency
111
98
  name: webmock
112
99
  requirement: !ruby/object:Gem::Requirement
113
- none: false
114
100
  requirements:
115
- - - ! '>='
101
+ - - ">="
116
102
  - !ruby/object:Gem::Version
117
103
  version: '0'
118
104
  type: :development
119
105
  prerelease: false
120
106
  version_requirements: !ruby/object:Gem::Requirement
121
- none: false
122
107
  requirements:
123
- - - ! '>='
108
+ - - ">="
124
109
  - !ruby/object:Gem::Version
125
110
  version: '0'
126
111
  - !ruby/object:Gem::Dependency
127
112
  name: rdoc
128
113
  requirement: !ruby/object:Gem::Requirement
129
- none: false
130
114
  requirements:
131
- - - ! '>'
115
+ - - ">"
132
116
  - !ruby/object:Gem::Version
133
117
  version: 2.4.2
134
118
  type: :development
135
119
  prerelease: false
136
120
  version_requirements: !ruby/object:Gem::Requirement
137
- none: false
138
121
  requirements:
139
- - - ! '>'
122
+ - - ">"
140
123
  - !ruby/object:Gem::Version
141
124
  version: 2.4.2
142
125
  - !ruby/object:Gem::Dependency
143
126
  name: coveralls
144
127
  requirement: !ruby/object:Gem::Requirement
145
- none: false
146
128
  requirements:
147
- - - ! '>='
129
+ - - ">="
148
130
  - !ruby/object:Gem::Version
149
131
  version: '0'
150
132
  type: :development
151
133
  prerelease: false
152
134
  version_requirements: !ruby/object:Gem::Requirement
153
- none: false
154
135
  requirements:
155
- - - ! '>='
136
+ - - ">="
156
137
  - !ruby/object:Gem::Version
157
138
  version: '0'
158
139
  description: Ruby library to interact with HipChat
@@ -162,12 +143,12 @@ executables: []
162
143
  extensions: []
163
144
  extra_rdoc_files: []
164
145
  files:
165
- - .coveralls.yml
166
- - .document
167
- - .gitignore
168
- - .ruby-gemset
169
- - .ruby-version
170
- - .travis.yml
146
+ - ".coveralls.yml"
147
+ - ".document"
148
+ - ".gitignore"
149
+ - ".ruby-gemset"
150
+ - ".ruby-version"
151
+ - ".travis.yml"
171
152
  - Gemfile
172
153
  - LICENSE
173
154
  - README.textile
@@ -197,27 +178,26 @@ files:
197
178
  homepage: https://github.com/hipchat/hipchat-rb
198
179
  licenses:
199
180
  - MIT
181
+ metadata: {}
200
182
  post_install_message:
201
183
  rdoc_options: []
202
184
  require_paths:
203
185
  - lib
204
186
  required_ruby_version: !ruby/object:Gem::Requirement
205
- none: false
206
187
  requirements:
207
- - - ! '>='
188
+ - - ">="
208
189
  - !ruby/object:Gem::Version
209
190
  version: 1.9.3
210
191
  required_rubygems_version: !ruby/object:Gem::Requirement
211
- none: false
212
192
  requirements:
213
- - - ! '>='
193
+ - - ">="
214
194
  - !ruby/object:Gem::Version
215
195
  version: '0'
216
196
  requirements: []
217
197
  rubyforge_project:
218
- rubygems_version: 1.8.29
198
+ rubygems_version: 2.4.6
219
199
  signing_key:
220
- specification_version: 3
200
+ specification_version: 4
221
201
  summary: Ruby library to interact with HipChat
222
202
  test_files:
223
203
  - spec/example/history.json