jaconda 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
data/LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2010 Jaconda Inc
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,58 @@
1
+ Jaconda API
2
+ --------------
3
+
4
+ The official ruby wrapper for working with the [Jaconda REST API](http://help.jaconda.im/faqs/api/jaconda-api-documentation)'s XML interface.
5
+
6
+ ## Installation
7
+
8
+ gem install jaconda
9
+
10
+ ## Requirements
11
+
12
+ ActiveResource
13
+
14
+ ## Usage
15
+
16
+ The first thing you need to set the authentication.
17
+
18
+ Jaconda::API.authenticate("API_TOKEN")
19
+
20
+ ### Finding rooms
21
+
22
+ Jaconda::Room.find(:all) # find all rooms for the current account.
23
+ Jaconda::Room.find(123) # find individual room by ID
24
+
25
+ ### Creating a Room
26
+
27
+ room = Jaconda::Room.new(:jid => 'awesome.project')
28
+ room.title = "Awesome Project Room"
29
+ room.save
30
+
31
+ ### Updating a Room
32
+
33
+ room = Jaconda::Room.find(123)
34
+ room.status_message = "Deadline: 3 apr"
35
+ room.save
36
+
37
+ ### Finding messages
38
+
39
+ room = Jaconda::Room.find(123)
40
+ room.messages
41
+
42
+ Jaconda::Message.find(:all, :params => { :room_id => 123 })
43
+ Jaconda::Message.find(:all, :params => { :room_id => 123, :per_page => 100, :page => 2 })
44
+
45
+ ### Creating a Message
46
+
47
+ Jaconda::Message.create(:room_id => 123, :text => "Hello from the API!")
48
+
49
+ ### Finding users
50
+
51
+ room = Jaconda::Room.find(123)
52
+ room.users
53
+
54
+ Jaconda::User.find(:all, :params => { :room_id => 123 })
55
+
56
+ ### Creating a User
57
+
58
+ Jaconda::User.create(:room_id => 123, :jid => "developer@gmail.com")
@@ -0,0 +1,52 @@
1
+ require 'rubygems'
2
+ require 'rake'
3
+
4
+ begin
5
+ require 'jeweler'
6
+ Jeweler::Tasks.new do |gem|
7
+ gem.name = "jaconda"
8
+ gem.summary = "The official ruby wrapper for Jaconda API"
9
+ gem.email = "ant.mironov@gmail.com"
10
+ gem.homepage = "http://github.com/mironov/jaconda"
11
+ gem.authors = ["Anton Mironov"]
12
+ gem.add_dependency "activeresource"
13
+ gem.add_development_dependency "thoughtbot-shoulda", ">= 0"
14
+ end
15
+ Jeweler::GemcutterTasks.new
16
+ rescue LoadError
17
+ puts "Jeweler (or a dependency) not available. Install it with: gem install jeweler"
18
+ end
19
+
20
+ require 'rake/testtask'
21
+ Rake::TestTask.new(:test) do |test|
22
+ test.libs << 'lib' << 'test'
23
+ test.pattern = 'test/**/test_*.rb'
24
+ test.verbose = true
25
+ end
26
+
27
+ begin
28
+ require 'rcov/rcovtask'
29
+ Rcov::RcovTask.new do |test|
30
+ test.libs << 'test'
31
+ test.pattern = 'test/**/test_*.rb'
32
+ test.verbose = true
33
+ end
34
+ rescue LoadError
35
+ task :rcov do
36
+ abort "RCov is not available. In order to run rcov, you must: sudo gem install spicycode-rcov"
37
+ end
38
+ end
39
+
40
+ task :test => :check_dependencies
41
+
42
+ task :default => :test
43
+
44
+ require 'rake/rdoctask'
45
+ Rake::RDocTask.new do |rdoc|
46
+ version = File.exist?('VERSION') ? File.read('VERSION') : ""
47
+
48
+ rdoc.rdoc_dir = 'rdoc'
49
+ rdoc.title = "jaconda #{version}"
50
+ rdoc.rdoc_files.include('README*')
51
+ rdoc.rdoc_files.include('lib/**/*.rb')
52
+ end
data/VERSION ADDED
@@ -0,0 +1 @@
1
+ 1.0.0
@@ -0,0 +1,31 @@
1
+ require 'active_resource'
2
+
3
+ module Jaconda
4
+ class API < ActiveResource::Base
5
+ self.site = "http://localhost:3000"
6
+ self.prefix = "/api/"
7
+
8
+ def self.authenticate(api_token)
9
+ self.password = 'x'
10
+ self.user = api_token
11
+ end
12
+ end
13
+
14
+ class Room < API
15
+ def users(options = {})
16
+ User.find(:all, :params => options.update(:room_id => id))
17
+ end
18
+
19
+ def messages(options = {})
20
+ Message.find(:all, :params => options.update(:room_id => id))
21
+ end
22
+ end
23
+
24
+ class User < API
25
+ self.prefix = "/api/rooms/:room_id/"
26
+ end
27
+
28
+ class Message < API
29
+ self.prefix = "/api/rooms/:room_id/"
30
+ end
31
+ end
@@ -0,0 +1,10 @@
1
+ require 'rubygems'
2
+ require 'test/unit'
3
+ require 'shoulda'
4
+
5
+ $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
6
+ $LOAD_PATH.unshift(File.dirname(__FILE__))
7
+ require 'jaconda'
8
+
9
+ class Test::Unit::TestCase
10
+ end
@@ -0,0 +1,7 @@
1
+ require 'helper'
2
+
3
+ class TestJaconda < Test::Unit::TestCase
4
+ should "probably rename this file and start testing for real" do
5
+ flunk "hey buddy, you should probably rename this file and start testing for real"
6
+ end
7
+ end
metadata ADDED
@@ -0,0 +1,93 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: jaconda
3
+ version: !ruby/object:Gem::Version
4
+ prerelease: false
5
+ segments:
6
+ - 1
7
+ - 0
8
+ - 0
9
+ version: 1.0.0
10
+ platform: ruby
11
+ authors:
12
+ - Anton Mironov
13
+ autorequire:
14
+ bindir: bin
15
+ cert_chain: []
16
+
17
+ date: 2010-03-24 00:00:00 +05:00
18
+ default_executable:
19
+ dependencies:
20
+ - !ruby/object:Gem::Dependency
21
+ name: activeresource
22
+ prerelease: false
23
+ requirement: &id001 !ruby/object:Gem::Requirement
24
+ requirements:
25
+ - - ">="
26
+ - !ruby/object:Gem::Version
27
+ segments:
28
+ - 0
29
+ version: "0"
30
+ type: :runtime
31
+ version_requirements: *id001
32
+ - !ruby/object:Gem::Dependency
33
+ name: thoughtbot-shoulda
34
+ prerelease: false
35
+ requirement: &id002 !ruby/object:Gem::Requirement
36
+ requirements:
37
+ - - ">="
38
+ - !ruby/object:Gem::Version
39
+ segments:
40
+ - 0
41
+ version: "0"
42
+ type: :development
43
+ version_requirements: *id002
44
+ description:
45
+ email: ant.mironov@gmail.com
46
+ executables: []
47
+
48
+ extensions: []
49
+
50
+ extra_rdoc_files:
51
+ - LICENSE
52
+ - README.markdown
53
+ files:
54
+ - LICENSE
55
+ - README.markdown
56
+ - Rakefile
57
+ - VERSION
58
+ - lib/jaconda.rb
59
+ - test/helper.rb
60
+ - test/test_jaconda.rb
61
+ has_rdoc: true
62
+ homepage: http://github.com/mironov/jaconda
63
+ licenses: []
64
+
65
+ post_install_message:
66
+ rdoc_options:
67
+ - --charset=UTF-8
68
+ require_paths:
69
+ - lib
70
+ required_ruby_version: !ruby/object:Gem::Requirement
71
+ requirements:
72
+ - - ">="
73
+ - !ruby/object:Gem::Version
74
+ segments:
75
+ - 0
76
+ version: "0"
77
+ required_rubygems_version: !ruby/object:Gem::Requirement
78
+ requirements:
79
+ - - ">="
80
+ - !ruby/object:Gem::Version
81
+ segments:
82
+ - 0
83
+ version: "0"
84
+ requirements: []
85
+
86
+ rubyforge_project:
87
+ rubygems_version: 1.3.6
88
+ signing_key:
89
+ specification_version: 3
90
+ summary: The official ruby wrapper for Jaconda API
91
+ test_files:
92
+ - test/helper.rb
93
+ - test/test_jaconda.rb