hipchat-api 1.0.1 → 1.0.2

Sign up to get free protection for your applications and to get access to all the features.
data/.rvmrc CHANGED
@@ -1 +1,2 @@
1
- rvm 1.9.2@hipchat-api
1
+ rvm --create 1.8.7@hipchat-api_gem
2
+ rvm --create 1.9.2@hipchat-api_gem
@@ -0,0 +1 @@
1
+ script: "bundle exec rake"
@@ -1,3 +1,7 @@
1
+ # hipchat-api 1.0.2 (2011-09-09)
2
+
3
+ * Added missing HipChat API methods: `rooms_create`, `rooms_delete`
4
+
1
5
  # hipchat-api 1.0.1 (2011-05-09)
2
6
 
3
7
  * Set the default HIPCHAT_API_URL to use https
data/Gemfile CHANGED
@@ -6,7 +6,7 @@ source "http://rubygems.org"
6
6
  # Add dependencies to develop your gem here.
7
7
  # Include everything needed to run rake, tests, features, etc.
8
8
  group :development do
9
- gem "rspec", "~> 2.3.0"
9
+ gem "rspec", "~> 2.6.0"
10
10
  gem "bundler", "~> 1.0.0"
11
11
  gem "jeweler", "~> 1.6.0"
12
12
  gem "rcov", ">= 0"
@@ -0,0 +1,73 @@
1
+ hipchat-api
2
+ ===========
3
+
4
+ [![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)
5
+
6
+ Ruby gem for interacting with HipChat API
7
+
8
+ * https://www.hipchat.com/docs/api
9
+
10
+ Compatibility
11
+ -------------
12
+
13
+ hipchat-API has been tested under Ruby 1.8.7 and Ruby 1.9.2
14
+
15
+ Requirements
16
+ ------------
17
+
18
+ * HTTParty
19
+
20
+ Install
21
+ -------
22
+
23
+ * gem install hipchat-api
24
+
25
+ Example
26
+ -------
27
+
28
+ ```ruby
29
+ ruby-1.9.2-p180 :001 > require 'hipchat-api'
30
+ => true
31
+ ruby-1.9.2-p180 :002 > hipchat_api = HipChat::API.new('api_token')
32
+ => #<HipChat::API:0x000001013d7280 @token="api_token", @hipchat_api_url="https://api.hipchat.com/v1">
33
+ ```
34
+
35
+ API methods
36
+ -----------
37
+
38
+ * Room-related methods
39
+
40
+ ```ruby
41
+ rooms_create(name, owner_user_id, privacy = 'public', topic = '', guest_access = 0)
42
+ rooms_delete(room_id)
43
+ rooms_list
44
+ rooms_history(room_id, date, timezone)
45
+ rooms_message(room_id, from, message, notify = 0, color = 'yellow')
46
+ rooms_show(room_id)
47
+ ```
48
+
49
+ * User-related methods
50
+
51
+ ```ruby
52
+ users_list
53
+ users_create(email, name, title, is_group_admin = 0, password = nil, timezone = 'UTC')
54
+ users_delete(user_id)
55
+ users_show(user_id)
56
+ users_update(user_id, email = nil, name = nil, title = nil, is_group_admin = nil, password = nil, timezone = nil)
57
+ ```
58
+
59
+ Contributing to hipchat-api
60
+ ---------------------------
61
+
62
+ * Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet
63
+ * Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it
64
+ * Fork the project
65
+ * Start a feature/bugfix branch
66
+ * Commit and push until you are happy with your contribution
67
+ * Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.
68
+ * Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.
69
+
70
+ Copyright
71
+ ---------
72
+
73
+ Copyright (c) 2011 David Czarnecki. See LICENSE.txt for further details.
data/Rakefile CHANGED
@@ -17,8 +17,8 @@ Jeweler::Tasks.new do |gem|
17
17
  gem.name = "hipchat-api"
18
18
  gem.homepage = "http://github.com/czarneckid/hipchat-api"
19
19
  gem.license = "MIT"
20
- gem.summary = %Q{Ruby API for interacting with HipChat}
21
- gem.description = %Q{Ruby API for interacting with HipChat}
20
+ gem.summary = %Q{Ruby gem for interacting with HipChat}
21
+ gem.description = %Q{Ruby gem for interacting with HipChat}
22
22
  gem.email = "czarneckid@acm.org"
23
23
  gem.authors = ["David Czarnecki"]
24
24
  # dependencies defined in Gemfile
@@ -29,6 +29,8 @@ require 'rspec/core'
29
29
  require 'rspec/core/rake_task'
30
30
  RSpec::Core::RakeTask.new(:spec) do |spec|
31
31
  spec.pattern = FileList['spec/**/*_spec.rb']
32
+ spec.rspec_opts = ['--backtrace']
33
+ # spec.ruby_opts = ['-w']
32
34
  end
33
35
 
34
36
  RSpec::Core::RakeTask.new(:rcov) do |spec|
@@ -51,6 +53,6 @@ end
51
53
  namespace :spec do
52
54
  desc "Runs specs on Ruby 1.8.7 and 1.9.2"
53
55
  task :rubies do
54
- system "rvm 1.8.7,1.9.2 rake"
56
+ system "rvm 1.8.7@hipchat-api_gem,1.9.2@hipchat-api_gem rake"
55
57
  end
56
58
  end
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.0.1
1
+ 1.0.2
@@ -5,30 +5,32 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{hipchat-api}
8
- s.version = "1.0.1"
8
+ s.version = "1.0.2"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
- s.authors = ["David Czarnecki"]
12
- s.date = %q{2011-05-09}
13
- s.description = %q{Ruby API for interacting with HipChat}
11
+ s.authors = [%q{David Czarnecki}]
12
+ s.date = %q{2011-09-09}
13
+ s.description = %q{Ruby gem for interacting with HipChat}
14
14
  s.email = %q{czarneckid@acm.org}
15
15
  s.extra_rdoc_files = [
16
16
  "LICENSE.txt",
17
- "README.rdoc"
17
+ "README.md"
18
18
  ]
19
19
  s.files = [
20
20
  ".document",
21
21
  ".rspec",
22
22
  ".rvmrc",
23
+ ".travis.yml",
23
24
  "CHANGLOG.markdown",
24
25
  "Gemfile",
25
- "Gemfile.lock",
26
26
  "LICENSE.txt",
27
- "README.rdoc",
27
+ "README.md",
28
28
  "Rakefile",
29
29
  "VERSION",
30
30
  "hipchat-api.gemspec",
31
31
  "lib/hipchat-api.rb",
32
+ "spec/fakeweb/rooms_create_response.json",
33
+ "spec/fakeweb/rooms_delete_response.json",
32
34
  "spec/fakeweb/rooms_history_response.json",
33
35
  "spec/fakeweb/rooms_list_response.json",
34
36
  "spec/fakeweb/rooms_message_response.json",
@@ -42,30 +44,30 @@ Gem::Specification.new do |s|
42
44
  "spec/spec_helper.rb"
43
45
  ]
44
46
  s.homepage = %q{http://github.com/czarneckid/hipchat-api}
45
- s.licenses = ["MIT"]
46
- s.require_paths = ["lib"]
47
- s.rubygems_version = %q{1.7.2}
48
- s.summary = %q{Ruby API for interacting with HipChat}
47
+ s.licenses = [%q{MIT}]
48
+ s.require_paths = [%q{lib}]
49
+ s.rubygems_version = %q{1.8.8}
50
+ s.summary = %q{Ruby gem for interacting with HipChat}
49
51
 
50
52
  if s.respond_to? :specification_version then
51
53
  s.specification_version = 3
52
54
 
53
55
  if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
54
56
  s.add_runtime_dependency(%q<httparty>, [">= 0"])
55
- s.add_development_dependency(%q<rspec>, ["~> 2.3.0"])
57
+ s.add_development_dependency(%q<rspec>, ["~> 2.6.0"])
56
58
  s.add_development_dependency(%q<bundler>, ["~> 1.0.0"])
57
59
  s.add_development_dependency(%q<jeweler>, ["~> 1.6.0"])
58
60
  s.add_development_dependency(%q<rcov>, [">= 0"])
59
61
  else
60
62
  s.add_dependency(%q<httparty>, [">= 0"])
61
- s.add_dependency(%q<rspec>, ["~> 2.3.0"])
63
+ s.add_dependency(%q<rspec>, ["~> 2.6.0"])
62
64
  s.add_dependency(%q<bundler>, ["~> 1.0.0"])
63
65
  s.add_dependency(%q<jeweler>, ["~> 1.6.0"])
64
66
  s.add_dependency(%q<rcov>, [">= 0"])
65
67
  end
66
68
  else
67
69
  s.add_dependency(%q<httparty>, [">= 0"])
68
- s.add_dependency(%q<rspec>, ["~> 2.3.0"])
70
+ s.add_dependency(%q<rspec>, ["~> 2.6.0"])
69
71
  s.add_dependency(%q<bundler>, ["~> 1.0.0"])
70
72
  s.add_dependency(%q<jeweler>, ["~> 1.6.0"])
71
73
  s.add_dependency(%q<rcov>, [">= 0"])
@@ -4,7 +4,7 @@ module HipChat
4
4
  class API
5
5
  include HTTParty
6
6
 
7
- VERSION = '1.0.1'.freeze
7
+ VERSION = '1.0.2'.freeze
8
8
  DEFAULT_TIMEOUT = 3
9
9
 
10
10
  DEFAULT_HEADERS = {
@@ -37,6 +37,17 @@ module HipChat
37
37
  def set_timeout(timeout)
38
38
  self.class.default_timeout(timeout)
39
39
  end
40
+
41
+ # https://www.hipchat.com/docs/api/method/rooms/create
42
+ def rooms_create(name, owner_user_id, privacy = 'public', topic = '', guest_access = 0)
43
+ self.class.post(hipchat_api_url_for('rooms/create'), :body => {:auth_token => @token, :name => name, :owner_user_id => owner_user_id,
44
+ :topic => topic, :privacy => privacy, :guest_access => guest_access})
45
+ end
46
+
47
+ # https://www.hipchat.com/docs/api/method/rooms/delete
48
+ def rooms_delete(room_id)
49
+ self.class.post(hipchat_api_url_for('rooms/delete'), :body => {:auth_token => @token, :room_id => room_id})
50
+ end
40
51
 
41
52
  # https://www.hipchat.com/docs/api/method/rooms/history
42
53
  def rooms_history(room_id, date, timezone)
@@ -0,0 +1 @@
1
+ { "room": { "room_id": 5, "name": "Development", "topic": "", "last_active": 0, "created": 1269010311, "owner_user_id": 5, "participants": [ ], "guest_access_url": null } }
@@ -0,0 +1 @@
1
+ { "deleted": true }
@@ -9,11 +9,11 @@ describe "HipChat::API" do
9
9
  end
10
10
 
11
11
  it "should be the correct version" do
12
- HipChat::API::VERSION.should == '1.0.1'
12
+ HipChat::API::VERSION.should == '1.0.2'
13
13
  end
14
14
 
15
15
  it "should create a new instance with the correct parameters" do
16
- @hipchat_api.token.should == 'token'
16
+ @hipchat_api.token.should be == 'token'
17
17
  @hipchat_api.hipchat_api_url.should == HipChat::API::HIPCHAT_API_URL
18
18
  end
19
19
 
@@ -29,6 +29,29 @@ describe "HipChat::API" do
29
29
  @hipchat_api.set_timeout(10)
30
30
  end
31
31
 
32
+ it "should allow you to create a room" do
33
+ FakeWeb.register_uri(:post,
34
+ %r|#{HipChat::API::HIPCHAT_API_URL}/rooms/create|,
35
+ :body => File.join(File.dirname(__FILE__), 'fakeweb', 'rooms_create_response.json'),
36
+ :content_type => "application/json")
37
+
38
+ rooms_create_response = @hipchat_api.rooms_create('Development', 5)
39
+ rooms_create_response.should_not be nil
40
+ rooms_create_response['room']['name'].should == 'Development'
41
+ rooms_create_response['room']['owner_user_id'].should == 5
42
+ end
43
+
44
+ it "should allow you to delete a room" do
45
+ FakeWeb.register_uri(:post,
46
+ %r|#{HipChat::API::HIPCHAT_API_URL}/rooms/delete|,
47
+ :body => File.join(File.dirname(__FILE__), 'fakeweb', 'rooms_delete_response.json'),
48
+ :content_type => "application/json")
49
+
50
+ rooms_delete_response = @hipchat_api.rooms_delete(5)
51
+ rooms_delete_response.should_not be nil
52
+ rooms_delete_response['deleted'].should be true
53
+ end
54
+
32
55
  it "should return a list of rooms" do
33
56
  FakeWeb.register_uri(:get,
34
57
  %r|#{HipChat::API::HIPCHAT_API_URL}/rooms/list|,
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: hipchat-api
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 1.0.1
5
+ version: 1.0.2
6
6
  platform: ruby
7
7
  authors:
8
8
  - David Czarnecki
@@ -10,7 +10,7 @@ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
12
 
13
- date: 2011-05-09 00:00:00 Z
13
+ date: 2011-09-09 00:00:00 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: httparty
@@ -30,7 +30,7 @@ dependencies:
30
30
  requirements:
31
31
  - - ~>
32
32
  - !ruby/object:Gem::Version
33
- version: 2.3.0
33
+ version: 2.6.0
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: *id002
@@ -67,7 +67,7 @@ dependencies:
67
67
  type: :development
68
68
  prerelease: false
69
69
  version_requirements: *id005
70
- description: Ruby API for interacting with HipChat
70
+ description: Ruby gem for interacting with HipChat
71
71
  email: czarneckid@acm.org
72
72
  executables: []
73
73
 
@@ -75,20 +75,22 @@ extensions: []
75
75
 
76
76
  extra_rdoc_files:
77
77
  - LICENSE.txt
78
- - README.rdoc
78
+ - README.md
79
79
  files:
80
80
  - .document
81
81
  - .rspec
82
82
  - .rvmrc
83
+ - .travis.yml
83
84
  - CHANGLOG.markdown
84
85
  - Gemfile
85
- - Gemfile.lock
86
86
  - LICENSE.txt
87
- - README.rdoc
87
+ - README.md
88
88
  - Rakefile
89
89
  - VERSION
90
90
  - hipchat-api.gemspec
91
91
  - lib/hipchat-api.rb
92
+ - spec/fakeweb/rooms_create_response.json
93
+ - spec/fakeweb/rooms_delete_response.json
92
94
  - spec/fakeweb/rooms_history_response.json
93
95
  - spec/fakeweb/rooms_list_response.json
94
96
  - spec/fakeweb/rooms_message_response.json
@@ -113,7 +115,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
113
115
  requirements:
114
116
  - - ">="
115
117
  - !ruby/object:Gem::Version
116
- hash: -2641781490993724861
118
+ hash: -4039051127565617653
117
119
  segments:
118
120
  - 0
119
121
  version: "0"
@@ -126,9 +128,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
126
128
  requirements: []
127
129
 
128
130
  rubyforge_project:
129
- rubygems_version: 1.7.2
131
+ rubygems_version: 1.8.8
130
132
  signing_key:
131
133
  specification_version: 3
132
- summary: Ruby API for interacting with HipChat
134
+ summary: Ruby gem for interacting with HipChat
133
135
  test_files: []
134
136
 
@@ -1,36 +0,0 @@
1
- GEM
2
- remote: http://rubygems.org/
3
- specs:
4
- crack (0.1.8)
5
- diff-lcs (1.1.2)
6
- fakeweb (1.3.0)
7
- git (1.2.5)
8
- httparty (0.7.7)
9
- crack (= 0.1.8)
10
- jeweler (1.6.0)
11
- bundler (~> 1.0.0)
12
- git (>= 1.2.5)
13
- rake
14
- mocha (0.9.12)
15
- rake (0.8.7)
16
- rcov (0.9.9)
17
- rspec (2.3.0)
18
- rspec-core (~> 2.3.0)
19
- rspec-expectations (~> 2.3.0)
20
- rspec-mocks (~> 2.3.0)
21
- rspec-core (2.3.0)
22
- rspec-expectations (2.3.0)
23
- diff-lcs (~> 1.1.2)
24
- rspec-mocks (2.3.0)
25
-
26
- PLATFORMS
27
- ruby
28
-
29
- DEPENDENCIES
30
- bundler (~> 1.0.0)
31
- fakeweb
32
- httparty
33
- jeweler (~> 1.6.0)
34
- mocha
35
- rcov
36
- rspec (~> 2.3.0)
@@ -1,40 +0,0 @@
1
- = hipchat-api
2
-
3
- Ruby API for interacting with HipChat API
4
-
5
- * https://www.hipchat.com/docs/api
6
-
7
- == Compatibility
8
-
9
- hipchat-API has been tested under Ruby 1.8.7 and Ruby 1.9.2
10
-
11
- == Requirements
12
-
13
- * HTTParty
14
-
15
- == Install
16
-
17
- * gem install hipchat-api
18
-
19
- == Example
20
-
21
- ruby-1.9.2-p180 :001 > require 'hipchat-api'
22
- => true
23
- ruby-1.9.2-p180 :002 > hipchat_api = HipChat::API.new('api_token')
24
- => #<HipChat::API:0x000001013d7280 @token="api_token", @hipchat_api_url="http://api.hipchat.com/v1">
25
-
26
- == Contributing to hipchat-api
27
-
28
- * Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet
29
- * Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it
30
- * Fork the project
31
- * Start a feature/bugfix branch
32
- * Commit and push until you are happy with your contribution
33
- * Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.
34
- * Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.
35
-
36
- == Copyright
37
-
38
- Copyright (c) 2011 David Czarnecki. See LICENSE.txt for
39
- further details.
40
-