ticketmaster-lighthouse 0.7.10 → 0.8.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/VERSION CHANGED
@@ -1 +1 @@
1
- 0.7.10
1
+ 0.8.0
@@ -22,88 +22,74 @@ module TicketMaster::Provider
22
22
  # * requestor => creator_name (read-only)
23
23
  # * project_id => prefix_options[:project_id]
24
24
  # * priority
25
- # * title
25
+ # * title
26
26
  # * created_at
27
27
  # * updated_at
28
-
28
+
29
29
  class Ticket < TicketMaster::Provider::Base::Ticket
30
30
  @@allowed_states = ['new', 'open', 'resolved', 'hold', 'invalid']
31
31
  attr_accessor :prefix_options
32
32
  API = ::Lighthouse::Ticket
33
-
34
- # Lighthouse limits us to a 100 ticket limit per page...
35
- # Since the paging sucks...we probably want to store this rather than do a call each time
36
- def self.search(project_id, options = {}, limit = 1000)
37
- page = 1
38
- tickets = ::Lighthouse::Ticket.find(:all, :params => {:project_id => project_id, :limit => 100, :page => page})
39
- result = []
40
- while tickets.length > 0 and page <= 3 #limit to page 3 since lighthouse is so slow...
41
- result += tickets.collect { |ticket| self.new ticket }
42
- page += 1
43
- tickets = ::Lighthouse::Ticket.find(:all, :params => {:project_id => project_id, :limit => 100, :page => page})
44
- end
45
- search_by_attribute(result, options, limit)
46
- end
47
-
33
+
48
34
  # This is to get the ticket id
49
35
  # We can't set ids, so there's no 'id=' method.
50
36
  def id
51
37
  @system_data[:client].number
52
38
  end
53
-
39
+
54
40
  # This is to get the status, mapped to state
55
41
  def status
56
42
  state
57
43
  end
58
-
44
+
59
45
  # This is to set the status, mapped to state
60
46
  def status=(stat)
61
47
  stat = state unless @@allowed_states.include?(stat)
62
48
  self.state = stat
63
49
  end
64
-
50
+
65
51
  # Get the resolution, mapped to latest_body
66
52
  def resolution
67
53
  self.latest_body
68
54
  end
69
-
55
+
70
56
  # Set the resolution...also sets state to resolved
71
57
  def resolution=(res)
72
58
  state = 'resolved'
73
59
  self.body = res
74
60
  end
75
-
61
+
76
62
  # Get the description, mapped to original_body
77
63
  def description
78
64
  self.original_body
79
65
  end
80
-
66
+
81
67
  # Set the description, mapped to body, which actually does a comment
82
68
  def description=(desc)
83
69
  self.body = desc
84
70
  end
85
-
71
+
86
72
  # Get the assigned person's name
87
73
  def assignee
88
74
  self.assigned_user_name
89
75
  end
90
-
76
+
91
77
  # Get the requestor's name
92
78
  def requestor
93
79
  self.creator_name
94
80
  end
95
-
81
+
96
82
  # Get the project id
97
83
  def project_id
98
84
  prefix_options[:project_id]
99
85
  end
100
-
86
+
101
87
  # Set the body
102
88
  def body=(bod)
103
89
  @system_data[:client].body = nil
104
90
  super(bod)
105
91
  end
106
-
92
+
107
93
  # Tags, a little helper for the ticket tagging
108
94
  def tags
109
95
  return @tags if @tags
@@ -112,7 +98,7 @@ module TicketMaster::Provider
112
98
  tagz.delete('')
113
99
  @tags = tagz
114
100
  end
115
-
101
+
116
102
  # Gotta unset the body attribute...otherwise every save ends up using that body
117
103
  def save
118
104
  # self.tag = @tags.reduce([]) do |mem, t|
@@ -125,7 +111,7 @@ module TicketMaster::Provider
125
111
  @system_data[:client].body = nil
126
112
  result
127
113
  end
128
-
114
+
129
115
  # The closer
130
116
  def close(resolution = 'resolved')
131
117
  resolution = 'resolved' unless @@allowed_states.include?(resolution)
@@ -133,6 +119,35 @@ module TicketMaster::Provider
133
119
  ticket.state = resolution
134
120
  ticket.save
135
121
  end
122
+
123
+ class << self
124
+
125
+ def create(options)
126
+ super translate options,
127
+ :description => :body,
128
+ :status => :state,
129
+ :assignee => :assigned_user_id
130
+ end
131
+
132
+ # Lighthouse limits us to a 100 ticket limit per page...
133
+ # Since the paging sucks...we probably want to store this rather than do a call each time
134
+ def search(project_id, options = {}, limit = 1000)
135
+ page = 1
136
+ tickets = ::Lighthouse::Ticket.find(:all, :params => {:project_id => project_id, :limit => 100, :page => page})
137
+ result = []
138
+ while tickets.length > 0 and page <= 3 #limit to page 3 since lighthouse is so slow...
139
+ result += tickets.collect { |ticket| self.new ticket }
140
+ page += 1
141
+ tickets = ::Lighthouse::Ticket.find(:all, :params => {:project_id => project_id, :limit => 100, :page => page})
142
+ end
143
+ search_by_attribute(result, options, limit)
144
+ end
145
+
146
+ private
147
+ def translate(hash, mapping)
148
+ Hash[hash.map { |k, v| [mapping[k] ||= k, v]}]
149
+ end
150
+ end
136
151
  end
137
152
  end
138
153
  end
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = "ticketmaster-lighthouse"
8
- s.version = "0.7.10"
8
+ s.version = "0.8.0"
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 = "2012-04-05"
12
+ s.date = "2012-04-11"
13
13
  s.description = "Allows ticketmaster to interact with Lighthouse's issue tracking system."
14
14
  s.email = "hong.quach@abigfisch.com"
15
15
  s.extra_rdoc_files = [
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: 23
4
+ hash: 63
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
- - 7
9
- - 10
10
- version: 0.7.10
8
+ - 8
9
+ - 0
10
+ version: 0.8.0
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: 2012-04-05 00:00:00 Z
18
+ date: 2012-04-11 00:00:00 Z
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
21
21
  name: ticketmaster