ticketmaster-lighthouse 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
data/Rakefile CHANGED
@@ -11,6 +11,7 @@ begin
11
11
  gem.homepage = "http://github.com/kiafaldorius/ticketmaster-lighthouse"
12
12
  gem.authors = ["Hong"]
13
13
  gem.add_development_dependency "rspec", ">= 1.2.9"
14
+ gem.add_dependency "ticketmaster", ">= 0.1.0"
14
15
  gem.add_dependency "activesupport", ">= 2.3.2"
15
16
  gem.add_dependency "activeresource", ">= 2.3.2"
16
17
  gem.add_dependency "addressable", ">= 2.1.2"
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.0
1
+ 0.1.1
@@ -87,6 +87,21 @@ module TicketMaster::Provider
87
87
  Ticket.find(:first, {:project_id => self.id}.merge(:q => first))
88
88
  end
89
89
  end
90
+
91
+ # Save this project
92
+ def save
93
+ lighthouse = @system_data[:client]
94
+ lighthouse.attributes.each do |k, v|
95
+ lighthouse.send(k + '=', self.send(k)) if self.send(k) != v
96
+ end
97
+ lighthouse.save
98
+ end
99
+
100
+ # Delete this project
101
+ def destroy
102
+ result = self.system_data[:client].destroy
103
+ result.is_a?(Net::HTTPOK)
104
+ end
90
105
 
91
106
  end
92
107
  end
@@ -2,8 +2,6 @@ module TicketMaster::Provider
2
2
  module Lighthouse
3
3
  # Ticket class for ticketmaster-lighthouse
4
4
  class Ticket < TicketMaster::Provider::Base::Ticket
5
- # This is an exhaustive list, but should contain the most common ones, add as necessary
6
- @@allowed_attributes = ["number", "permalink", "milestone_id", "created_at", "title", "closed", "updated_at", "raw_data", "priority", "tag", "url", "attachments_count", "creator_id", "milestone_due_on", "original_body_html", "user_id", "user_name", "original_body", "latest_body", "assigned_user_id", "creator_name", "state"]
7
5
  @@allowed_states = ['new', 'open', 'resolved', 'hold', 'invalid']
8
6
  attr_accessor :prefix_options
9
7
 
@@ -38,6 +36,9 @@ module TicketMaster::Provider
38
36
  end
39
37
  end
40
38
 
39
+ def id
40
+ @system_data[:client].number
41
+ end
41
42
 
42
43
  def self.qize(params)
43
44
  return params unless params[:q] and params[:q].is_a?(Hash)
@@ -53,11 +54,10 @@ module TicketMaster::Provider
53
54
 
54
55
  # The find helper
55
56
  def self.search(options, limit = 1000)
56
- tickets = LighthouseAPI::Ticket.find(:all, :params => qize(options))
57
- options.delete(:project_id) || options.delete('project_id')
57
+ tickets = LighthouseAPI::Ticket.find(:all, :params => ({:project_id => (options.delete(:project_id) || options.delete('project_id')).to_i}.merge(qize(:q => options))))
58
58
  tickets.find_all do |t|
59
59
  options.keys.reduce(true) do |memo, key|
60
- p.send(key) == options[key] and (limit-=1) > 0
60
+ t.send(key) == options[key] and (limit-=1) > 0
61
61
  end
62
62
  end
63
63
  end
@@ -78,25 +78,27 @@ module TicketMaster::Provider
78
78
 
79
79
  # The creator
80
80
  def self.create(*options)
81
- ticket_attr = options.delete_if { |k, v| !@@allowed_attributes.include?(k) }
82
- new_ticket = LighthouseAPI::Ticket.new(ticket_attr)
83
- ticket_attr.delete(:project_id) || ticket_attr.delete('project_id')
81
+ new_ticket = LighthouseAPI::Ticket.new(:project_id => (options.first.delete(:project_id) || options.first.delete('project_id')).to_i)
84
82
  ticket_attr.each do |k, v|
85
83
  new_ticket.send(k + '=', v)
86
84
  end
87
85
  new_ticket.save
86
+ self.new new_ticket
88
87
  end
89
88
 
90
89
  # The saver
91
- def save
92
- ticket_attr = self.to_hash.delete_if { |k, v| !@@allowed_attributes.include?(k) || ticket.system_data[:client].send(k) == v }
93
- lh_ticket = ticket.system_data[:client]
94
- ticket_attr.each do |k, v|
95
- lh_ticket.send(k + '=', v)
90
+ def save(*options)
91
+ lh_ticket = @system_data[:client]
92
+ self.keys.each do |key|
93
+ lh_ticket.send(key + '=', self.send(key)) if self.send(key) != lh_ticket.send(key)
96
94
  end
97
95
  lh_ticket.save
98
96
  end
99
97
 
98
+ def destroy(*options)
99
+ @system_data[:client].destroy
100
+ end
101
+
100
102
  # The closer
101
103
  def close(resolution = 'resolved')
102
104
  resolution = 'resolved' unless @@allowed_states.include?(resolution)
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{ticketmaster-lighthouse}
8
- s.version = "0.1.0"
8
+ s.version = "0.1.1"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Hong"]
12
- s.date = %q{2010-06-22}
12
+ s.date = %q{2010-06-25}
13
13
  s.description = %q{Allows ticketmaster to interact with Lighthouse's issue tracking system.}
14
14
  s.email = %q{hong.quach@abigfisch.com}
15
15
  s.extra_rdoc_files = [
@@ -51,17 +51,20 @@ Gem::Specification.new do |s|
51
51
 
52
52
  if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
53
53
  s.add_development_dependency(%q<rspec>, [">= 1.2.9"])
54
+ s.add_runtime_dependency(%q<ticketmaster>, [">= 0.1.0"])
54
55
  s.add_runtime_dependency(%q<activesupport>, [">= 2.3.2"])
55
56
  s.add_runtime_dependency(%q<activeresource>, [">= 2.3.2"])
56
57
  s.add_runtime_dependency(%q<addressable>, [">= 2.1.2"])
57
58
  else
58
59
  s.add_dependency(%q<rspec>, [">= 1.2.9"])
60
+ s.add_dependency(%q<ticketmaster>, [">= 0.1.0"])
59
61
  s.add_dependency(%q<activesupport>, [">= 2.3.2"])
60
62
  s.add_dependency(%q<activeresource>, [">= 2.3.2"])
61
63
  s.add_dependency(%q<addressable>, [">= 2.1.2"])
62
64
  end
63
65
  else
64
66
  s.add_dependency(%q<rspec>, [">= 1.2.9"])
67
+ s.add_dependency(%q<ticketmaster>, [">= 0.1.0"])
65
68
  s.add_dependency(%q<activesupport>, [">= 2.3.2"])
66
69
  s.add_dependency(%q<activeresource>, [">= 2.3.2"])
67
70
  s.add_dependency(%q<addressable>, [">= 2.1.2"])
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ticketmaster-lighthouse
3
3
  version: !ruby/object:Gem::Version
4
- hash: 27
4
+ hash: 25
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 1
9
- - 0
10
- version: 0.1.0
9
+ - 1
10
+ version: 0.1.1
11
11
  platform: ruby
12
12
  authors:
13
13
  - Hong
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2010-06-22 00:00:00 -07:00
18
+ date: 2010-06-25 00:00:00 -07:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
@@ -35,9 +35,25 @@ dependencies:
35
35
  type: :development
36
36
  version_requirements: *id001
37
37
  - !ruby/object:Gem::Dependency
38
- name: activesupport
38
+ name: ticketmaster
39
39
  prerelease: false
40
40
  requirement: &id002 !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ">="
44
+ - !ruby/object:Gem::Version
45
+ hash: 27
46
+ segments:
47
+ - 0
48
+ - 1
49
+ - 0
50
+ version: 0.1.0
51
+ type: :runtime
52
+ version_requirements: *id002
53
+ - !ruby/object:Gem::Dependency
54
+ name: activesupport
55
+ prerelease: false
56
+ requirement: &id003 !ruby/object:Gem::Requirement
41
57
  none: false
42
58
  requirements:
43
59
  - - ">="
@@ -49,11 +65,11 @@ dependencies:
49
65
  - 2
50
66
  version: 2.3.2
51
67
  type: :runtime
52
- version_requirements: *id002
68
+ version_requirements: *id003
53
69
  - !ruby/object:Gem::Dependency
54
70
  name: activeresource
55
71
  prerelease: false
56
- requirement: &id003 !ruby/object:Gem::Requirement
72
+ requirement: &id004 !ruby/object:Gem::Requirement
57
73
  none: false
58
74
  requirements:
59
75
  - - ">="
@@ -65,11 +81,11 @@ dependencies:
65
81
  - 2
66
82
  version: 2.3.2
67
83
  type: :runtime
68
- version_requirements: *id003
84
+ version_requirements: *id004
69
85
  - !ruby/object:Gem::Dependency
70
86
  name: addressable
71
87
  prerelease: false
72
- requirement: &id004 !ruby/object:Gem::Requirement
88
+ requirement: &id005 !ruby/object:Gem::Requirement
73
89
  none: false
74
90
  requirements:
75
91
  - - ">="
@@ -81,7 +97,7 @@ dependencies:
81
97
  - 2
82
98
  version: 2.1.2
83
99
  type: :runtime
84
- version_requirements: *id004
100
+ version_requirements: *id005
85
101
  description: Allows ticketmaster to interact with Lighthouse's issue tracking system.
86
102
  email: hong.quach@abigfisch.com
87
103
  executables: []