hipchat-api 1.0.5 → 1.0.6

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,15 @@
1
+ ---
2
+ !binary "U0hBMQ==":
3
+ metadata.gz: !binary |-
4
+ NTkwZDUwZWE0MjY5OWNjMjYzNzQ1MTdlYWViNmZhN2I3YmI0Mzc4Nw==
5
+ data.tar.gz: !binary |-
6
+ Zjg0MWI4ZGQyNWYwYjMxMTk2MWJjNjA5ZjNjZDI4OGQ2MDZiYWQxZQ==
7
+ SHA512:
8
+ metadata.gz: !binary |-
9
+ NDU3NWI3ZGIyMDFmNWJmNDA2ZDRhZjkxNzI4MTRhYzA5NjE4ZjJmNDQwMTQ2
10
+ ODA1YThjZjc0ZTc3ODY5MjZhMjliMTdmYjYyZWY1NGM1MWEwMzYzOTJkODAw
11
+ Nzg0MzQ5YmZhOWNiYWMzYWU1ZjU5YWViNWZjYzVmZTUxNDM1NTc=
12
+ data.tar.gz: !binary |-
13
+ NjljNzhhY2I0Y2JhYWZlYmJmNDY1MjE5ZWU4Yjc0ODA4ZWY1YTFjZGM0NDk1
14
+ ZTFhMWE2ZDAyY2M4NDAyMGIwYWVkMTdkMTVjODQzNGFmMzZmZGVmMzBhM2Q5
15
+ NTc1ZDUyOGI5ZDM1YzZmNjBiNmE2ODI3Y2JkMmZjNWFmZTNjN2Q=
@@ -0,0 +1 @@
1
+ hipchat-api_gem
@@ -0,0 +1 @@
1
+ 1.9.3
@@ -1,6 +1,4 @@
1
1
  rvm:
2
- - 1.8.7
3
- - 1.9.2
4
2
  - 1.9.3
5
3
  gemfile:
6
4
  - Gemfile
@@ -1,5 +1,9 @@
1
1
  # CHANGELOG
2
2
 
3
+ ## 1.0.6 (2014-03-09)
4
+
5
+ * Added `include_deleted` parameter to `users_list` method [#7](https://github.com/czarneckid/hipchat-api/pull/7)
6
+
3
7
  ## 1.0.5 (2012-12-04)
4
8
 
5
9
  * Added `rooms_topic` method to set a room's topic.
@@ -16,7 +20,7 @@
16
20
  ## 1.0.2 (2011-09-09)
17
21
 
18
22
  * Added missing HipChat API methods: `rooms_create`, `rooms_delete`
19
-
23
+
20
24
  ## 1.0.1 (2011-05-09)
21
25
 
22
26
  * Set the default HIPCHAT_API_URL to use https
data/Gemfile CHANGED
@@ -1,3 +1,3 @@
1
- source "http://rubygems.org"
1
+ source 'https://rubygems.org'
2
2
 
3
3
  gemspec
@@ -1,4 +1,4 @@
1
- Copyright (c) 2011-2012 David Czarnecki
1
+ Copyright (c) 2011-2014 David Czarnecki
2
2
 
3
3
  Permission is hereby granted, free of charge, to any person obtaining
4
4
  a copy of this software and associated documentation files (the
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # hipchat-api
2
2
 
3
- [![Project Status](http://stillmaintained.com/czarneckid/hipchat-api.png)](http://stillmaintained.com/czarneckid/hipchat-api) [![Build Status](http://travis-ci.org/czarneckid/hipchat-api.png)](http://travis-ci.org/czarneckid/hipchat-api)
3
+ [![Project Status](http://stillmaintained.com/czarneckid/hipchat-api.png)](http://stillmaintained.com/czarneckid/hipchat-api) [![Build Status](https://travis-ci.org/czarneckid/hipchat-api.png)](https://travis-ci.org/czarneckid/hipchat-api)
4
4
 
5
5
  Ruby gem for interacting with HipChat API
6
6
 
@@ -8,7 +8,7 @@ Ruby gem for interacting with HipChat API
8
8
 
9
9
  ## Compatibility
10
10
 
11
- hipchat-API has been tested under Ruby 1.8.7 and Ruby 1.9.2
11
+ hipchat-API has been tested under Ruby 1.9.3
12
12
 
13
13
  ## Requirements
14
14
 
@@ -24,11 +24,11 @@ gem install hipchat-api
24
24
 
25
25
  ```ruby
26
26
  require 'hipchat-api'
27
- => true
27
+ => true
28
28
  hipchat_api = HipChat::API.new('api_token')
29
- => #<HipChat::API:0x000001013d7280 @token="api_token", @hipchat_api_url="https://api.hipchat.com/v1">
29
+ => #<HipChat::API:0x000001013d7280 @token="api_token", @hipchat_api_url="https://api.hipchat.com/v1">
30
30
  ```
31
-
31
+
32
32
  ## API methods
33
33
 
34
34
  * Room-related methods
@@ -36,26 +36,26 @@ hipchat_api = HipChat::API.new('api_token')
36
36
  ```ruby
37
37
  rooms_create(name, owner_user_id, privacy = 'public', topic = '', guest_access = 0)
38
38
  rooms_delete(room_id)
39
- rooms_list
40
- rooms_history(room_id, date, timezone)
41
- rooms_message(room_id, from, message, notify = 0, color = 'yellow', message_format = 'html')
39
+ rooms_list
40
+ rooms_history(room_id, date, timezone)
41
+ rooms_message(room_id, from, message, notify = 0, color = 'yellow', message_format = 'html')
42
42
  rooms_topic(toom_id, topic, from = 'API')
43
- rooms_show(room_id)
43
+ rooms_show(room_id)
44
44
  ```
45
-
45
+
46
46
  * User-related methods
47
47
 
48
48
  ```ruby
49
- users_list
49
+ users_list(include_deleted = 0)
50
50
  users_create(email, name, title, is_group_admin = 0, password = nil, timezone = 'UTC')
51
- users_delete(user_id)
51
+ users_delete(user_id)
52
52
  users_show(user_id)
53
53
  users_undelete(user_id)
54
54
  users_update(user_id, email = nil, name = nil, title = nil, is_group_admin = nil, password = nil, timezone = nil)
55
55
  ```
56
-
56
+
57
57
  ## Contributing to hipchat-api
58
-
58
+
59
59
  * Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet
60
60
  * Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it
61
61
  * Fork the project
@@ -66,4 +66,4 @@ users_update(user_id, email = nil, name = nil, title = nil, is_group_admin = nil
66
66
 
67
67
  ## Copyright
68
68
 
69
- Copyright (c) 2011-2012 David Czarnecki. See LICENSE.txt for further details.
69
+ Copyright (c) 2011-2014 David Czarnecki. See LICENSE.txt for further details.
data/Rakefile CHANGED
@@ -6,14 +6,7 @@ require 'rspec/core/rake_task'
6
6
  RSpec::Core::RakeTask.new(:spec) do |spec|
7
7
  spec.pattern = FileList['spec/**/*_spec.rb']
8
8
  spec.rspec_opts = ['--backtrace']
9
- # spec.ruby_opts = ['-w']
9
+ # spec.ruby_opts = ['-w']
10
10
  end
11
11
 
12
12
  task :default => :spec
13
-
14
- namespace :spec do
15
- desc "Runs specs on Ruby 1.8.7 and 1.9.2"
16
- task :rubies do
17
- system "rvm 1.8.7@hipchat-api_gem,1.9.2@hipchat-api_gem,1.9.3@hipchat-api_gem do rake"
18
- end
19
- end
@@ -113,10 +113,10 @@ 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!
116
+ # Set a room's topic. Useful for displaying statistics, important links, server status, you name it!
117
117
  #
118
118
  # @param room_id [int] ID of the room.
119
- # @param topic [String] The topic body. 250 characters max.
119
+ # @param topic [String] The topic body. 250 characters max.
120
120
  # @param from [String, 'API'] Name of the service changing the topic. (default: API).
121
121
  #
122
122
  # @see https://www.hipchat.com/docs/api/method/rooms/topic
@@ -159,9 +159,13 @@ module HipChat
159
159
 
160
160
  # List all users in the group.
161
161
  #
162
+ # @param notify [bool] Boolean flag of whether or not include deleted users 0 = false, 1 = true. (default: 0)
163
+ #
162
164
  # @see https://www.hipchat.com/docs/api/method/users/list
163
- def users_list
164
- self.class.get(hipchat_api_url_for('users/list'), :query => {:auth_token => @token})
165
+ def users_list(include_deleted = 0)
166
+ query = {:auth_token => @token}
167
+ query[:include_deleted] = 1 if include_deleted == 1
168
+ self.class.get(hipchat_api_url_for('users/list'), :query => query)
165
169
  end
166
170
 
167
171
  # Get a user's details.
@@ -173,7 +177,7 @@ module HipChat
173
177
  self.class.get(hipchat_api_url_for('users/show'), :query => {:auth_token => @token, :user_id => user_id})
174
178
  end
175
179
 
176
- # Undelete a user. They will be sent an email requiring them to click a link to reactivate the account.
180
+ # Undelete a user. They will be sent an email requiring them to click a link to reactivate the account.
177
181
  #
178
182
  # @param user_id [String] ID or email address of the user.
179
183
  #
@@ -1,5 +1,5 @@
1
1
  module HipChat
2
2
  class API
3
- VERSION = '1.0.5'.freeze
3
+ VERSION = '1.0.6'.freeze
4
4
  end
5
5
  end
@@ -0,0 +1,29 @@
1
+ { "users" : [ { "email" : "chris@hipchat.com",
2
+ "is_group_admin" : 1,
3
+ "name" : "Chris Rivers",
4
+ "photo_url" : "https://www.hipchat.com/chris.png",
5
+ "status" : "away",
6
+ "status_message" : "gym, bbl",
7
+ "title" : "Developer",
8
+ "user_id" : 1
9
+ },
10
+ { "email" : "pete@hipchat.com",
11
+ "is_group_admin" : 1,
12
+ "name" : "Peter Curley",
13
+ "photo_url" : "https://www.hipchat.com/pete.png",
14
+ "status" : "offline",
15
+ "status_message" : "",
16
+ "title" : "Designer",
17
+ "user_id" : 3
18
+ },
19
+ { "email" : "garret@hipchat.com",
20
+ "is_group_admin" : 1,
21
+ "name" : "Garret Heaton",
22
+ "photo_url" : "https://www.hipchat.com/garret.png",
23
+ "status" : "available",
24
+ "status_message" : "Come see what I'm working on!",
25
+ "title" : "Co-founder",
26
+ "user_id" : 5,
27
+ "is_deleted" : 1
28
+ }
29
+ ] }
@@ -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.5'
17
+ HipChat::API::VERSION.should == '1.0.6'
18
18
  end
19
19
 
20
20
  it "should create a new instance with the correct parameters" do
@@ -98,7 +98,7 @@ describe "HipChat::API" do
98
98
 
99
99
  rooms_message_response = @hipchat_api.rooms_topic(10, 'This is a new topic')
100
100
  rooms_message_response.should_not be nil
101
- rooms_message_response['status'].should == 'ok'
101
+ rooms_message_response['status'].should == 'ok'
102
102
  end
103
103
 
104
104
  it "should return a history of messages" do
@@ -149,6 +149,19 @@ describe "HipChat::API" do
149
149
  users_list_response['users'].size.should be 3
150
150
  end
151
151
 
152
+ it "should return a list of users including deleted" do
153
+ FakeWeb.register_uri(:get,
154
+ %r|#{HipChat::API::HIPCHAT_API_URL}/users/list.*include_deleted=1|,
155
+ :body => File.join(File.dirname(__FILE__), 'fakeweb', 'users_list_include_deleted_response.json'),
156
+ :content_type => "application/json")
157
+
158
+ users_list_response = @hipchat_api.users_list(include_deleted = 1)
159
+ users_list_response.should_not be nil
160
+ users_list_response['users'].size.should be 3
161
+ users_list_response['users'].select { |u| u['is_deleted'] == 1 }.size.should be 1
162
+ users_list_response['users'].select { |u| u['is_deleted'] != 1 }.size.should be 2
163
+ end
164
+
152
165
  it "should show the details for a user" do
153
166
  FakeWeb.register_uri(:get,
154
167
  %r|#{HipChat::API::HIPCHAT_API_URL}/users/show|,
metadata CHANGED
@@ -1,20 +1,18 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hipchat-api
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.5
5
- prerelease:
4
+ version: 1.0.6
6
5
  platform: ruby
7
6
  authors:
8
7
  - David Czarnecki
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2012-12-04 00:00:00.000000000 Z
11
+ date: 2014-03-10 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
@@ -22,7 +20,6 @@ dependencies:
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
@@ -30,7 +27,6 @@ dependencies:
30
27
  - !ruby/object:Gem::Dependency
31
28
  name: fakeweb
32
29
  requirement: !ruby/object:Gem::Requirement
33
- none: false
34
30
  requirements:
35
31
  - - ! '>='
36
32
  - !ruby/object:Gem::Version
@@ -38,7 +34,6 @@ dependencies:
38
34
  type: :development
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
@@ -46,7 +41,6 @@ dependencies:
46
41
  - !ruby/object:Gem::Dependency
47
42
  name: mocha
48
43
  requirement: !ruby/object:Gem::Requirement
49
- none: false
50
44
  requirements:
51
45
  - - ~>
52
46
  - !ruby/object:Gem::Version
@@ -54,7 +48,6 @@ dependencies:
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
@@ -62,7 +55,6 @@ dependencies:
62
55
  - !ruby/object:Gem::Dependency
63
56
  name: rspec
64
57
  requirement: !ruby/object:Gem::Requirement
65
- none: false
66
58
  requirements:
67
59
  - - ! '>='
68
60
  - !ruby/object:Gem::Version
@@ -70,7 +62,6 @@ dependencies:
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
@@ -78,7 +69,6 @@ dependencies:
78
69
  - !ruby/object:Gem::Dependency
79
70
  name: rake
80
71
  requirement: !ruby/object:Gem::Requirement
81
- none: false
82
72
  requirements:
83
73
  - - ! '>='
84
74
  - !ruby/object:Gem::Version
@@ -86,7 +76,6 @@ dependencies:
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
@@ -101,7 +90,8 @@ files:
101
90
  - .document
102
91
  - .gitignore
103
92
  - .rspec
104
- - .rvmrc
93
+ - .ruby-gemset
94
+ - .ruby-version
105
95
  - .travis.yml
106
96
  - CHANGELOG.md
107
97
  - Gemfile
@@ -120,6 +110,7 @@ files:
120
110
  - spec/fakeweb/rooms_topic_response.json
121
111
  - spec/fakeweb/users_create_response.json
122
112
  - spec/fakeweb/users_delete_response.json
113
+ - spec/fakeweb/users_list_include_deleted_response.json
123
114
  - spec/fakeweb/users_list_response.json
124
115
  - spec/fakeweb/users_show_response.json
125
116
  - spec/fakeweb/users_undelete_response.json
@@ -128,33 +119,26 @@ files:
128
119
  - spec/spec_helper.rb
129
120
  homepage: http://github.com/czarneckid/hipchat-api
130
121
  licenses: []
122
+ metadata: {}
131
123
  post_install_message:
132
124
  rdoc_options: []
133
125
  require_paths:
134
126
  - lib
135
127
  required_ruby_version: !ruby/object:Gem::Requirement
136
- none: false
137
128
  requirements:
138
129
  - - ! '>='
139
130
  - !ruby/object:Gem::Version
140
131
  version: '0'
141
- segments:
142
- - 0
143
- hash: -2445592630498617141
144
132
  required_rubygems_version: !ruby/object:Gem::Requirement
145
- none: false
146
133
  requirements:
147
134
  - - ! '>='
148
135
  - !ruby/object:Gem::Version
149
136
  version: '0'
150
- segments:
151
- - 0
152
- hash: -2445592630498617141
153
137
  requirements: []
154
138
  rubyforge_project: hipchat-api
155
- rubygems_version: 1.8.24
139
+ rubygems_version: 2.2.2
156
140
  signing_key:
157
- specification_version: 3
141
+ specification_version: 4
158
142
  summary: Ruby gem for interacting with HipChat
159
143
  test_files:
160
144
  - spec/fakeweb/rooms_create_response.json
@@ -166,6 +150,7 @@ test_files:
166
150
  - spec/fakeweb/rooms_topic_response.json
167
151
  - spec/fakeweb/users_create_response.json
168
152
  - spec/fakeweb/users_delete_response.json
153
+ - spec/fakeweb/users_list_include_deleted_response.json
169
154
  - spec/fakeweb/users_list_response.json
170
155
  - spec/fakeweb/users_show_response.json
171
156
  - spec/fakeweb/users_undelete_response.json
data/.rvmrc DELETED
@@ -1,3 +0,0 @@
1
- rvm --create 1.8.7@hipchat-api_gem
2
- rvm --create 1.9.2@hipchat-api_gem
3
- rvm --create 1.9.3@hipchat-api_gem