oruen_redmine_client 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
data/.document ADDED
@@ -0,0 +1,5 @@
1
+ README.rdoc
2
+ lib/**/*.rb
3
+ bin/*
4
+ features/**/*.feature
5
+ LICENSE
data/LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2010 Eric Davis
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.
data/README.rdoc ADDED
@@ -0,0 +1,23 @@
1
+ = Redmine API Client
2
+
3
+ Rubygem to access the Redmine API. Based on the documentation from http://www.redmine.org/wiki/redmine/Rest_api_with_ruby
4
+
5
+ == Usage
6
+
7
+ *This gem and the Redmine API is under development and subject to change at any notice.*
8
+
9
+ There is an example script in bin/test.rb showing the basic usage.
10
+
11
+ == Note on Patches/Pull Requests
12
+
13
+ * Fork the project.
14
+ * Make your feature addition or bug fix.
15
+ * Add tests for it. This is important so I don't break it in a
16
+ future version unintentionally.
17
+ * Commit, do not mess with rakefile, version, or history.
18
+ (if you want to have your own version, that is fine but bump version in a commit by itself I can ignore when I pull)
19
+ * Send me a pull request. Bonus points for topic branches.
20
+
21
+ == Copyright
22
+
23
+ Copyright (c) 2010 Eric Davis. See LICENSE for details.
data/Rakefile ADDED
@@ -0,0 +1,55 @@
1
+ require 'rubygems'
2
+ require 'rake'
3
+
4
+ begin
5
+ require 'jeweler'
6
+ Jeweler::Tasks.new do |gem|
7
+ gem.name = "oruen_redmine_client"
8
+ gem.summary = %Q{Redmine API client}
9
+ gem.description = %Q{Access the Redmine REST API with ActiveResource}
10
+ gem.email = "oruenu@gmail.com"
11
+ gem.homepage = "http://github.com/oruen/redmine_client"
12
+ gem.authors = ["Eric Davis", "Nick Recobra"]
13
+ gem.add_dependency "activeresource", ">= 2.3.0"
14
+ gem.add_development_dependency "thoughtbot-shoulda", ">= 0"
15
+ gem.add_development_dependency "webmock", ">= 0"
16
+ # gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
17
+ end
18
+ Jeweler::GemcutterTasks.new
19
+ rescue LoadError
20
+ puts "Jeweler (or a dependency) not available. Install it with: gem install jeweler"
21
+ end
22
+
23
+ require 'rake/testtask'
24
+ Rake::TestTask.new(:test) do |test|
25
+ test.libs << 'lib' << 'test'
26
+ test.pattern = 'test/**/test_*.rb'
27
+ test.verbose = true
28
+ end
29
+
30
+ begin
31
+ require 'rcov/rcovtask'
32
+ Rcov::RcovTask.new do |test|
33
+ test.libs << 'test'
34
+ test.pattern = 'test/**/test_*.rb'
35
+ test.verbose = true
36
+ end
37
+ rescue LoadError
38
+ task :rcov do
39
+ abort "RCov is not available. In order to run rcov, you must: sudo gem install spicycode-rcov"
40
+ end
41
+ end
42
+
43
+ task :test => :check_dependencies
44
+
45
+ task :default => :test
46
+
47
+ require 'rake/rdoctask'
48
+ Rake::RDocTask.new do |rdoc|
49
+ version = File.exist?('VERSION') ? File.read('VERSION') : ""
50
+
51
+ rdoc.rdoc_dir = 'rdoc'
52
+ rdoc.title = "redmine_client #{version}"
53
+ rdoc.rdoc_files.include('README*')
54
+ rdoc.rdoc_files.include('lib/**/*.rb')
55
+ end
data/VERSION ADDED
@@ -0,0 +1,2 @@
1
+ 0.0.1
2
+
data/bin/test.rb ADDED
@@ -0,0 +1,13 @@
1
+ #!/usr/bin/env ruby
2
+ require 'rubygems'
3
+ $LOAD_PATH << File.expand_path(File.dirname(__FILE__) + '/../lib')
4
+
5
+ require 'redmine_client'
6
+
7
+ RedmineClient::Base.configure do
8
+ self.site = 'http://localhost:3000'
9
+ self.user = 'admin'
10
+ self.password = 'test'
11
+ end
12
+
13
+ puts "Found #{RedmineClient::Issue.find(:all).count} issues"
@@ -0,0 +1,6 @@
1
+ require 'active_resource'
2
+
3
+ require 'redmine_client/base'
4
+ require 'redmine_client/project'
5
+ require 'redmine_client/issue'
6
+ require 'redmine_client/news'
@@ -0,0 +1,20 @@
1
+ module RedmineClient
2
+ class Base < ActiveResource::Base
3
+
4
+ class << self
5
+ def configure(&block)
6
+ instance_eval &block
7
+ end
8
+
9
+ # Get your API key at "My account" page
10
+ def token= val
11
+ if val
12
+ (descendants + [self]).each do |resource|
13
+ resource.headers['X-Redmine-API-Key'] = val
14
+ end
15
+ end
16
+ end
17
+ end
18
+ end
19
+ end
20
+
@@ -0,0 +1,4 @@
1
+ module RedmineClient
2
+ class Issue < RedmineClient::Base
3
+ end
4
+ end
@@ -0,0 +1,4 @@
1
+ module RedmineClient
2
+ class News < RedmineClient::Base
3
+ end
4
+ end
@@ -0,0 +1,4 @@
1
+ module RedmineClient
2
+ class Project < RedmineClient::Base
3
+ end
4
+ end
@@ -0,0 +1,59 @@
1
+ # Generated by jeweler
2
+ # DO NOT EDIT THIS FILE DIRECTLY
3
+ # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
4
+ # -*- encoding: utf-8 -*-
5
+
6
+ Gem::Specification.new do |s|
7
+ s.name = %q{oruen_redmine_client}
8
+ s.version = "0.0.1"
9
+
10
+ s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
+ s.authors = [%q{Eric Davis}, %q{Nick Recobra}]
12
+ s.date = %q{2011-08-25}
13
+ s.description = %q{Access the Redmine REST API with ActiveResource}
14
+ s.email = %q{oruenu@gmail.com}
15
+ s.executables = [%q{test.rb}]
16
+ s.extra_rdoc_files = [
17
+ "LICENSE",
18
+ "README.rdoc"
19
+ ]
20
+ s.files = [
21
+ ".document",
22
+ "LICENSE",
23
+ "README.rdoc",
24
+ "Rakefile",
25
+ "VERSION",
26
+ "bin/test.rb",
27
+ "lib/redmine_client.rb",
28
+ "lib/redmine_client/base.rb",
29
+ "lib/redmine_client/issue.rb",
30
+ "lib/redmine_client/news.rb",
31
+ "lib/redmine_client/project.rb",
32
+ "oruen_redmine_client.gemspec",
33
+ "test/helper.rb",
34
+ "test/test_redmine_client.rb"
35
+ ]
36
+ s.homepage = %q{http://github.com/oruen/redmine_client}
37
+ s.require_paths = [%q{lib}]
38
+ s.rubygems_version = %q{1.8.6}
39
+ s.summary = %q{Redmine API client}
40
+
41
+ if s.respond_to? :specification_version then
42
+ s.specification_version = 3
43
+
44
+ if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
45
+ s.add_runtime_dependency(%q<activeresource>, [">= 2.3.0"])
46
+ s.add_development_dependency(%q<thoughtbot-shoulda>, [">= 0"])
47
+ s.add_development_dependency(%q<webmock>, [">= 0"])
48
+ else
49
+ s.add_dependency(%q<activeresource>, [">= 2.3.0"])
50
+ s.add_dependency(%q<thoughtbot-shoulda>, [">= 0"])
51
+ s.add_dependency(%q<webmock>, [">= 0"])
52
+ end
53
+ else
54
+ s.add_dependency(%q<activeresource>, [">= 2.3.0"])
55
+ s.add_dependency(%q<thoughtbot-shoulda>, [">= 0"])
56
+ s.add_dependency(%q<webmock>, [">= 0"])
57
+ end
58
+ end
59
+
data/test/helper.rb ADDED
@@ -0,0 +1,11 @@
1
+ require 'rubygems'
2
+ require 'test/unit'
3
+ require 'shoulda'
4
+ require 'webmock/test_unit'
5
+
6
+ $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
7
+ $LOAD_PATH.unshift(File.dirname(__FILE__))
8
+ require 'redmine_client'
9
+
10
+ class Test::Unit::TestCase
11
+ end
@@ -0,0 +1,17 @@
1
+ require 'helper'
2
+
3
+ class TestRedmineClient < Test::Unit::TestCase
4
+ context "token authentication" do
5
+ should "request should include X-Redmine-API-Key header when token is set" do
6
+ token = "12345"
7
+ stub_request(:get, "http://redmine.org/issues.xml")
8
+ RedmineClient::Base.configure do
9
+ self.site = "http://redmine.org"
10
+ self.token = token
11
+ end
12
+ RedmineClient::Issue.find(:all)
13
+ assert_requested :get, "http://redmine.org/issues.xml",
14
+ :headers => {'X-Redmine-API-Key' => token}, :times => 1
15
+ end
16
+ end
17
+ end
metadata ADDED
@@ -0,0 +1,95 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: oruen_redmine_client
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Eric Davis
9
+ - Nick Recobra
10
+ autorequire:
11
+ bindir: bin
12
+ cert_chain: []
13
+ date: 2011-08-25 00:00:00.000000000Z
14
+ dependencies:
15
+ - !ruby/object:Gem::Dependency
16
+ name: activeresource
17
+ requirement: &2156840360 !ruby/object:Gem::Requirement
18
+ none: false
19
+ requirements:
20
+ - - ! '>='
21
+ - !ruby/object:Gem::Version
22
+ version: 2.3.0
23
+ type: :runtime
24
+ prerelease: false
25
+ version_requirements: *2156840360
26
+ - !ruby/object:Gem::Dependency
27
+ name: thoughtbot-shoulda
28
+ requirement: &2156839760 !ruby/object:Gem::Requirement
29
+ none: false
30
+ requirements:
31
+ - - ! '>='
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: *2156839760
37
+ - !ruby/object:Gem::Dependency
38
+ name: webmock
39
+ requirement: &2156828700 !ruby/object:Gem::Requirement
40
+ none: false
41
+ requirements:
42
+ - - ! '>='
43
+ - !ruby/object:Gem::Version
44
+ version: '0'
45
+ type: :development
46
+ prerelease: false
47
+ version_requirements: *2156828700
48
+ description: Access the Redmine REST API with ActiveResource
49
+ email: oruenu@gmail.com
50
+ executables:
51
+ - test.rb
52
+ extensions: []
53
+ extra_rdoc_files:
54
+ - LICENSE
55
+ - README.rdoc
56
+ files:
57
+ - .document
58
+ - LICENSE
59
+ - README.rdoc
60
+ - Rakefile
61
+ - VERSION
62
+ - bin/test.rb
63
+ - lib/redmine_client.rb
64
+ - lib/redmine_client/base.rb
65
+ - lib/redmine_client/issue.rb
66
+ - lib/redmine_client/news.rb
67
+ - lib/redmine_client/project.rb
68
+ - oruen_redmine_client.gemspec
69
+ - test/helper.rb
70
+ - test/test_redmine_client.rb
71
+ homepage: http://github.com/oruen/redmine_client
72
+ licenses: []
73
+ post_install_message:
74
+ rdoc_options: []
75
+ require_paths:
76
+ - lib
77
+ required_ruby_version: !ruby/object:Gem::Requirement
78
+ none: false
79
+ requirements:
80
+ - - ! '>='
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
83
+ required_rubygems_version: !ruby/object:Gem::Requirement
84
+ none: false
85
+ requirements:
86
+ - - ! '>='
87
+ - !ruby/object:Gem::Version
88
+ version: '0'
89
+ requirements: []
90
+ rubyforge_project:
91
+ rubygems_version: 1.8.6
92
+ signing_key:
93
+ specification_version: 3
94
+ summary: Redmine API client
95
+ test_files: []