ticketmaster-unfuddle 0.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/.document ADDED
@@ -0,0 +1,5 @@
1
+ README.rdoc
2
+ lib/**/*.rb
3
+ bin/*
4
+ features/**/*.feature
5
+ LICENSE
data/.gitignore ADDED
@@ -0,0 +1,21 @@
1
+ ## MAC OS
2
+ .DS_Store
3
+
4
+ ## TEXTMATE
5
+ *.tmproj
6
+ tmtags
7
+
8
+ ## EMACS
9
+ *~
10
+ \#*
11
+ .\#*
12
+
13
+ ## VIM
14
+ *.swp
15
+
16
+ ## PROJECT::GENERAL
17
+ coverage
18
+ rdoc
19
+ pkg
20
+
21
+ ## PROJECT::SPECIFIC
data/LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2010 Hybrid Group
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.md ADDED
@@ -0,0 +1,17 @@
1
+ # ticketmaster-unfuddle
2
+
3
+ Ticketmaster provider for Unfuddle.
4
+
5
+ ## Note on Patches/Pull Requests
6
+
7
+ * Fork the project.
8
+ * Make your feature addition or bug fix.
9
+ * Add tests for it. This is important so I don't break it in a
10
+ future version unintentionally.
11
+ * Commit, do not mess with rakefile, version, or history.
12
+ (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)
13
+ * Send me a pull request. Bonus points for topic branches.
14
+
15
+ ## Copyright
16
+
17
+ Copyright (c) 2010 [Hybrid Group](http://hybridgroup.com). See LICENSE for details.
data/Rakefile ADDED
@@ -0,0 +1,54 @@
1
+ require 'rubygems'
2
+ require 'rake'
3
+
4
+ begin
5
+ require 'jeweler'
6
+ Jeweler::Tasks.new do |gem|
7
+ gem.name = "ticketmaster-unfuddle"
8
+ gem.summary = %Q{Ticketmaster provider for Unfuddle}
9
+ gem.description = %Q{Ticketmaster provider for Unfuddle}
10
+ gem.email = "simon@hoerup.dk"
11
+ gem.homepage = "http://ticketrb.com"
12
+ gem.authors = ["Sirupsen"]
13
+ gem.add_dependency "unfuddler", ">= 0"
14
+ gem.add_development_dependency "thoughtbot-shoulda", ">= 0"
15
+ # gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
16
+ end
17
+ Jeweler::GemcutterTasks.new
18
+ rescue LoadError
19
+ puts "Jeweler (or a dependency) not available. Install it with: gem install jeweler"
20
+ end
21
+
22
+ require 'rake/testtask'
23
+ Rake::TestTask.new(:test) do |test|
24
+ test.libs << 'lib' << 'test'
25
+ test.pattern = 'test/**/test_*.rb'
26
+ test.verbose = true
27
+ end
28
+
29
+ begin
30
+ require 'rcov/rcovtask'
31
+ Rcov::RcovTask.new do |test|
32
+ test.libs << 'test'
33
+ test.pattern = 'test/**/test_*.rb'
34
+ test.verbose = true
35
+ end
36
+ rescue LoadError
37
+ task :rcov do
38
+ abort "RCov is not available. In order to run rcov, you must: sudo gem install spicycode-rcov"
39
+ end
40
+ end
41
+
42
+ task :test => :check_dependencies
43
+
44
+ task :default => :test
45
+
46
+ require 'rake/rdoctask'
47
+ Rake::RDocTask.new do |rdoc|
48
+ version = File.exist?('VERSION') ? File.read('VERSION') : ""
49
+
50
+ rdoc.rdoc_dir = 'rdoc'
51
+ rdoc.title = "ticketmaster-unfuddle #{version}"
52
+ rdoc.rdoc_files.include('README*')
53
+ rdoc.rdoc_files.include('lib/**/*.rb')
54
+ end
data/VERSION ADDED
@@ -0,0 +1 @@
1
+ 0.0.0
@@ -0,0 +1,105 @@
1
+ require 'unfuddler'
2
+
3
+ module TicketMasterMod
4
+ module Unfuddle
5
+ class Ticket
6
+ def self.create(ticket)
7
+ Unfuddler.authenticate(ticket.project.authentication.to_hash)
8
+ project = Unfuddler::Project.find(ticket.project.name)
9
+
10
+ ticket = ticket.to_hash.select do |key, value|
11
+ [:summary, :priority, :description].include?(key.to_sym)
12
+ end
13
+ ticket["priority"] = ticket["priority"].to_s
14
+
15
+ project.ticket.create(ticket)
16
+ end
17
+
18
+ def self.save(ticket)
19
+ Unfuddler.authenticate(ticket.project.authentication.to_hash)
20
+ project = Unfuddler::Project.find(ticket.project.name)
21
+ unfuddle_ticket = project.tickets(:number => ticket.id).first # First because it always returns an array
22
+
23
+ # DRY this up!
24
+ status = right_status(ticket.status)
25
+ unfuddle_ticket.status = status if status
26
+ unfuddle_ticket.description = ticket.description
27
+ unfuddle_ticket.summary = ticket.summary
28
+
29
+ unfuddle_ticket.save
30
+ end
31
+
32
+ def self.close(ticket, resolution)
33
+ Unfuddler.authenticate(ticket.project.authentication.to_hash)
34
+ project = Unfuddler::Project.find(ticket.project.name)
35
+
36
+ ticket = project.tickets(:number => ticket.id).first # First because it always returns an array
37
+ ticket.close!(resolution)
38
+ end
39
+
40
+ private
41
+ def self.right_status(status)
42
+ case status
43
+ when :in_progress
44
+ "accepted"
45
+ when :resolved
46
+ "resolved"
47
+ when :reopen
48
+ "reopen"
49
+ else
50
+ nil
51
+ end
52
+ end
53
+ end
54
+
55
+ class Project
56
+ def self.find(query, options = {})
57
+ Unfuddler.authenticate(options[:authentication].to_hash)
58
+ projects = Unfuddler::Project.find
59
+ formatted_projects = []
60
+
61
+ unless projects.empty?
62
+ projects.each do |project|
63
+ formatted_projects << TicketMasterMod::Project.new({
64
+ :name => project.short_name,
65
+ :description => project.description,
66
+ :system => "unfuddle",
67
+ :authentication => options[:authentication],
68
+ :id => project.id,
69
+ })
70
+ end
71
+ end
72
+
73
+ formatted_projects
74
+ end
75
+
76
+ def self.tickets(project_instance)
77
+ Unfuddler.authenticate(project_instance.authentication.to_hash)
78
+ project = Unfuddler::Project.find("testproject")
79
+ formatted_tickets = []
80
+
81
+ unless project.tickets.empty?
82
+ project.tickets.each do |ticket|
83
+ formatted_tickets << TicketMasterMod::Ticket.new({
84
+ :summary => ticket.summary,
85
+ :id => ticket.number,
86
+ :status => ticket.status,
87
+ :description => ticket.description,
88
+
89
+ :resolution => ticket.resolution,
90
+ :resolution_description => ticket.resolution_description,
91
+
92
+ :created_at => ticket.created_at,
93
+
94
+ :system => "unfuddle",
95
+ :ticket => ticket,
96
+ :project => project_instance
97
+ })
98
+ end
99
+ end
100
+
101
+ formatted_tickets
102
+ end
103
+ end
104
+ end
105
+ end
data/test/helper.rb ADDED
@@ -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 'ticketmaster-unfuddle'
8
+
9
+ class Test::Unit::TestCase
10
+ end
@@ -0,0 +1,4 @@
1
+ require 'helper'
2
+
3
+ class TestTicketmasterUnfuddle < Test::Unit::TestCase
4
+ end
metadata ADDED
@@ -0,0 +1,104 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: ticketmaster-unfuddle
3
+ version: !ruby/object:Gem::Version
4
+ hash: 31
5
+ prerelease: false
6
+ segments:
7
+ - 0
8
+ - 0
9
+ - 0
10
+ version: 0.0.0
11
+ platform: ruby
12
+ authors:
13
+ - Sirupsen
14
+ autorequire:
15
+ bindir: bin
16
+ cert_chain: []
17
+
18
+ date: 2010-06-07 00:00:00 +02:00
19
+ default_executable:
20
+ dependencies:
21
+ - !ruby/object:Gem::Dependency
22
+ name: unfuddler
23
+ prerelease: false
24
+ requirement: &id001 !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ">="
28
+ - !ruby/object:Gem::Version
29
+ hash: 3
30
+ segments:
31
+ - 0
32
+ version: "0"
33
+ type: :runtime
34
+ version_requirements: *id001
35
+ - !ruby/object:Gem::Dependency
36
+ name: thoughtbot-shoulda
37
+ prerelease: false
38
+ requirement: &id002 !ruby/object:Gem::Requirement
39
+ none: false
40
+ requirements:
41
+ - - ">="
42
+ - !ruby/object:Gem::Version
43
+ hash: 3
44
+ segments:
45
+ - 0
46
+ version: "0"
47
+ type: :development
48
+ version_requirements: *id002
49
+ description: Ticketmaster provider for Unfuddle
50
+ email: simon@hoerup.dk
51
+ executables: []
52
+
53
+ extensions: []
54
+
55
+ extra_rdoc_files:
56
+ - LICENSE
57
+ - README.md
58
+ files:
59
+ - .document
60
+ - .gitignore
61
+ - LICENSE
62
+ - README.md
63
+ - Rakefile
64
+ - VERSION
65
+ - lib/ticketmaster-unfuddle.rb
66
+ - test/helper.rb
67
+ - test/test_ticketmaster-unfuddle.rb
68
+ has_rdoc: true
69
+ homepage: http://ticketrb.com
70
+ licenses: []
71
+
72
+ post_install_message:
73
+ rdoc_options:
74
+ - --charset=UTF-8
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
+ hash: 3
83
+ segments:
84
+ - 0
85
+ version: "0"
86
+ required_rubygems_version: !ruby/object:Gem::Requirement
87
+ none: false
88
+ requirements:
89
+ - - ">="
90
+ - !ruby/object:Gem::Version
91
+ hash: 3
92
+ segments:
93
+ - 0
94
+ version: "0"
95
+ requirements: []
96
+
97
+ rubyforge_project:
98
+ rubygems_version: 1.3.7
99
+ signing_key:
100
+ specification_version: 3
101
+ summary: Ticketmaster provider for Unfuddle
102
+ test_files:
103
+ - test/helper.rb
104
+ - test/test_ticketmaster-unfuddle.rb