hipchat-api 1.0.4 → 1.0.5
Sign up to get free protection for your applications and to get access to all the features.
- data/.rspec +1 -0
- data/CHANGELOG.md +12 -5
- data/README.md +3 -1
- data/hipchat-api.gemspec +1 -1
- data/lib/hipchat-api.rb +20 -0
- data/lib/hipchat-api/version.rb +1 -1
- data/spec/fakeweb/rooms_topic_response.json +1 -0
- data/spec/fakeweb/users_undelete_response.json +1 -0
- data/spec/hipchat-api_spec.rb +23 -1
- metadata +13 -9
data/.rspec
CHANGED
data/CHANGELOG.md
CHANGED
@@ -1,19 +1,26 @@
|
|
1
|
-
#
|
1
|
+
# CHANGELOG
|
2
|
+
|
3
|
+
## 1.0.5 (2012-12-04)
|
4
|
+
|
5
|
+
* Added `rooms_topic` method to set a room's topic.
|
6
|
+
* Added `users_undelete` method to undelete a user.
|
7
|
+
|
8
|
+
## 1.0.4 (2012-07-16)
|
2
9
|
|
3
10
|
* Change reject! to reject to fix create user issue. Fixes #2. Thanks @bradleybuda.
|
4
11
|
|
5
|
-
|
12
|
+
## 1.0.3 (2012-07-13)
|
6
13
|
|
7
14
|
* Add support to the new message_format param when publishing messages to a room. Thanks @rtopitt.
|
8
15
|
|
9
|
-
|
16
|
+
## 1.0.2 (2011-09-09)
|
10
17
|
|
11
18
|
* Added missing HipChat API methods: `rooms_create`, `rooms_delete`
|
12
19
|
|
13
|
-
|
20
|
+
## 1.0.1 (2011-05-09)
|
14
21
|
|
15
22
|
* Set the default HIPCHAT_API_URL to use https
|
16
23
|
|
17
|
-
|
24
|
+
## 1.0.0 (2011-05-07)
|
18
25
|
|
19
26
|
* Initial release
|
data/README.md
CHANGED
@@ -39,6 +39,7 @@ rooms_delete(room_id)
|
|
39
39
|
rooms_list
|
40
40
|
rooms_history(room_id, date, timezone)
|
41
41
|
rooms_message(room_id, from, message, notify = 0, color = 'yellow', message_format = 'html')
|
42
|
+
rooms_topic(toom_id, topic, from = 'API')
|
42
43
|
rooms_show(room_id)
|
43
44
|
```
|
44
45
|
|
@@ -48,7 +49,8 @@ rooms_show(room_id)
|
|
48
49
|
users_list
|
49
50
|
users_create(email, name, title, is_group_admin = 0, password = nil, timezone = 'UTC')
|
50
51
|
users_delete(user_id)
|
51
|
-
users_show(user_id)
|
52
|
+
users_show(user_id)
|
53
|
+
users_undelete(user_id)
|
52
54
|
users_update(user_id, email = nil, name = nil, title = nil, is_group_admin = nil, password = nil, timezone = nil)
|
53
55
|
```
|
54
56
|
|
data/hipchat-api.gemspec
CHANGED
@@ -23,6 +23,6 @@ Gem::Specification.new do |s|
|
|
23
23
|
|
24
24
|
s.add_development_dependency('fakeweb')
|
25
25
|
s.add_development_dependency('mocha', '~> 0.11.4')
|
26
|
-
s.add_development_dependency('rspec'
|
26
|
+
s.add_development_dependency('rspec')
|
27
27
|
s.add_development_dependency('rake')
|
28
28
|
end
|
data/lib/hipchat-api.rb
CHANGED
@@ -113,6 +113,17 @@ module HipChat
|
|
113
113
|
:message => message, :notify => notify, :color => color, :message_format => message_format})
|
114
114
|
end
|
115
115
|
|
116
|
+
# Set a room's topic. Useful for displaying statistics, important links, server status, you name it!
|
117
|
+
#
|
118
|
+
# @param room_id [int] ID of the room.
|
119
|
+
# @param topic [String] The topic body. 250 characters max.
|
120
|
+
# @param from [String, 'API'] Name of the service changing the topic. (default: API).
|
121
|
+
#
|
122
|
+
# @see https://www.hipchat.com/docs/api/method/rooms/topic
|
123
|
+
def rooms_topic(room_id, topic, from = 'API')
|
124
|
+
self.class.post(hipchat_api_url_for('rooms/topic'), :body => {:auth_token => @token, :room_id => room_id, :topic => topic, :from => from})
|
125
|
+
end
|
126
|
+
|
116
127
|
# Get room details.
|
117
128
|
#
|
118
129
|
# @param room_id [int] ID of the room.
|
@@ -162,6 +173,15 @@ module HipChat
|
|
162
173
|
self.class.get(hipchat_api_url_for('users/show'), :query => {:auth_token => @token, :user_id => user_id})
|
163
174
|
end
|
164
175
|
|
176
|
+
# Undelete a user. They will be sent an email requiring them to click a link to reactivate the account.
|
177
|
+
#
|
178
|
+
# @param user_id [String] ID or email address of the user.
|
179
|
+
#
|
180
|
+
# @see https://www.hipchat.com/docs/api/method/users/undelete
|
181
|
+
def users_undelete(user_id)
|
182
|
+
self.class.post(hipchat_api_url_for('users/undelete'), :body => {:auth_token => @token, :user_id => user_id})
|
183
|
+
end
|
184
|
+
|
165
185
|
# Update a user.
|
166
186
|
#
|
167
187
|
# @param email [String] User's email.
|
data/lib/hipchat-api/version.rb
CHANGED
@@ -0,0 +1 @@
|
|
1
|
+
{ "status": "ok" }
|
@@ -0,0 +1 @@
|
|
1
|
+
{ "undeleted": true }
|
data/spec/hipchat-api_spec.rb
CHANGED
@@ -14,7 +14,7 @@ describe "HipChat::API" do
|
|
14
14
|
end
|
15
15
|
|
16
16
|
it "should be the correct version" do
|
17
|
-
HipChat::API::VERSION.should == '1.0.
|
17
|
+
HipChat::API::VERSION.should == '1.0.5'
|
18
18
|
end
|
19
19
|
|
20
20
|
it "should create a new instance with the correct parameters" do
|
@@ -90,6 +90,17 @@ describe "HipChat::API" do
|
|
90
90
|
rooms_message_response['status'].should == 'sent'
|
91
91
|
end
|
92
92
|
|
93
|
+
it "should update a room's topic" do
|
94
|
+
FakeWeb.register_uri(:post,
|
95
|
+
%r|#{HipChat::API::HIPCHAT_API_URL}/rooms/topic|,
|
96
|
+
:body => File.join(File.dirname(__FILE__), 'fakeweb', 'rooms_topic_response.json'),
|
97
|
+
:content_type => "application/json")
|
98
|
+
|
99
|
+
rooms_message_response = @hipchat_api.rooms_topic(10, 'This is a new topic')
|
100
|
+
rooms_message_response.should_not be nil
|
101
|
+
rooms_message_response['status'].should == 'ok'
|
102
|
+
end
|
103
|
+
|
93
104
|
it "should return a history of messages" do
|
94
105
|
FakeWeb.register_uri(:get,
|
95
106
|
%r|#{HipChat::API::HIPCHAT_API_URL}/rooms/history|,
|
@@ -149,6 +160,17 @@ describe "HipChat::API" do
|
|
149
160
|
users_show_response['user']['name'].should == 'Garret Heaton'
|
150
161
|
end
|
151
162
|
|
163
|
+
it "should undelete a user" do
|
164
|
+
FakeWeb.register_uri(:post,
|
165
|
+
%r|#{HipChat::API::HIPCHAT_API_URL}/users/undelete|,
|
166
|
+
:body => File.join(File.dirname(__FILE__), 'fakeweb', 'users_undelete_response.json'),
|
167
|
+
:content_type => "application/json")
|
168
|
+
|
169
|
+
users_update_response = @hipchat_api.users_undelete('new-email-address@hipchat.com')
|
170
|
+
users_update_response.should_not be nil
|
171
|
+
users_update_response['undeleted'].should be true
|
172
|
+
end
|
173
|
+
|
152
174
|
it "should update a user" do
|
153
175
|
FakeWeb.register_uri(:post,
|
154
176
|
%r|#{HipChat::API::HIPCHAT_API_URL}/users/update|,
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: hipchat-api
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.5
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-
|
12
|
+
date: 2012-12-04 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: httparty
|
@@ -64,17 +64,17 @@ dependencies:
|
|
64
64
|
requirement: !ruby/object:Gem::Requirement
|
65
65
|
none: false
|
66
66
|
requirements:
|
67
|
-
- -
|
67
|
+
- - ! '>='
|
68
68
|
- !ruby/object:Gem::Version
|
69
|
-
version:
|
69
|
+
version: '0'
|
70
70
|
type: :development
|
71
71
|
prerelease: false
|
72
72
|
version_requirements: !ruby/object:Gem::Requirement
|
73
73
|
none: false
|
74
74
|
requirements:
|
75
|
-
- -
|
75
|
+
- - ! '>='
|
76
76
|
- !ruby/object:Gem::Version
|
77
|
-
version:
|
77
|
+
version: '0'
|
78
78
|
- !ruby/object:Gem::Dependency
|
79
79
|
name: rake
|
80
80
|
requirement: !ruby/object:Gem::Requirement
|
@@ -117,10 +117,12 @@ files:
|
|
117
117
|
- spec/fakeweb/rooms_list_response.json
|
118
118
|
- spec/fakeweb/rooms_message_response.json
|
119
119
|
- spec/fakeweb/rooms_show_response.json
|
120
|
+
- spec/fakeweb/rooms_topic_response.json
|
120
121
|
- spec/fakeweb/users_create_response.json
|
121
122
|
- spec/fakeweb/users_delete_response.json
|
122
123
|
- spec/fakeweb/users_list_response.json
|
123
124
|
- spec/fakeweb/users_show_response.json
|
125
|
+
- spec/fakeweb/users_undelete_response.json
|
124
126
|
- spec/fakeweb/users_update_response.json
|
125
127
|
- spec/hipchat-api_spec.rb
|
126
128
|
- spec/spec_helper.rb
|
@@ -138,7 +140,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
138
140
|
version: '0'
|
139
141
|
segments:
|
140
142
|
- 0
|
141
|
-
hash:
|
143
|
+
hash: -2445592630498617141
|
142
144
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
143
145
|
none: false
|
144
146
|
requirements:
|
@@ -147,10 +149,10 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
147
149
|
version: '0'
|
148
150
|
segments:
|
149
151
|
- 0
|
150
|
-
hash:
|
152
|
+
hash: -2445592630498617141
|
151
153
|
requirements: []
|
152
154
|
rubyforge_project: hipchat-api
|
153
|
-
rubygems_version: 1.8.
|
155
|
+
rubygems_version: 1.8.24
|
154
156
|
signing_key:
|
155
157
|
specification_version: 3
|
156
158
|
summary: Ruby gem for interacting with HipChat
|
@@ -161,10 +163,12 @@ test_files:
|
|
161
163
|
- spec/fakeweb/rooms_list_response.json
|
162
164
|
- spec/fakeweb/rooms_message_response.json
|
163
165
|
- spec/fakeweb/rooms_show_response.json
|
166
|
+
- spec/fakeweb/rooms_topic_response.json
|
164
167
|
- spec/fakeweb/users_create_response.json
|
165
168
|
- spec/fakeweb/users_delete_response.json
|
166
169
|
- spec/fakeweb/users_list_response.json
|
167
170
|
- spec/fakeweb/users_show_response.json
|
171
|
+
- spec/fakeweb/users_undelete_response.json
|
168
172
|
- spec/fakeweb/users_update_response.json
|
169
173
|
- spec/hipchat-api_spec.rb
|
170
174
|
- spec/spec_helper.rb
|