ticketmaster-github 0.2.1 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.2.1
1
+ 0.3.0
@@ -4,6 +4,10 @@ module TicketMaster::Provider
4
4
  include TicketMaster::Provider::Base
5
5
  PROJECT_API = Octopi::Repository
6
6
  ISSUE_API = Octopi::Issue
7
+
8
+ class << self
9
+ attr_accessor :login
10
+ end
7
11
 
8
12
  # This is for cases when you want to instantiate using TicketMaster::Provider::Github.new(auth)
9
13
  def self.new(auth = {})
@@ -15,17 +19,18 @@ module TicketMaster::Provider
15
19
  @authentication ||= TicketMaster::Authenticator.new(auth)
16
20
  auth = @authentication
17
21
  if auth.token.nil? or (auth.login.nil? and auth.username.nil?)
18
- raise "Please provide token and login"
22
+ TicketMaster::Provider::Github.login = auth.login || auth.username
23
+ return
19
24
  else
20
25
  Octopi::Api.api = Octopi::AuthApi.instance
21
- Octopi::Api.api.token = auth.token
26
+ Octopi::Api.api.token = auth.token unless auth.token.blank?
22
27
  Octopi::Api.api.login = auth.login || auth.username
23
28
  end
24
29
  end
25
30
 
26
31
  def projects(*options)
27
32
  if options.empty?
28
- PROJECT_API.find(:user => Octopi::Api.api.login).collect{|repo| Project.new repo}
33
+ PROJECT_API.find(:user => TicketMaster::Provider::Github.login).collect{|repo| Project.new repo}
29
34
  elsif options.first.is_a?(Array)
30
35
  options.collect{|name| Project.find(name)}.first
31
36
  end
@@ -52,7 +52,7 @@ module TicketMaster::Provider
52
52
 
53
53
  def self.find_by_id(id)
54
54
  warn "Github API only finds by name"
55
- self.new self::API.find({:user => Octopi::Api.api.login, :repo => id})
55
+ self.new self::API.find({:user => TicketMaster::Provider::Github.login, :repo => id})
56
56
  end
57
57
 
58
58
  # copy from this.copy(that) copies that into this
@@ -72,22 +72,13 @@ module TicketMaster::Provider
72
72
  api.find(*options)
73
73
  end
74
74
  end
75
+
76
+ def ticket(*options)
77
+ TicketMaster::Provider::Github::Ticket.find(self.id, *options)
78
+ end
75
79
 
76
80
  def tickets(*options)
77
- first = options.shift
78
-
79
- if first.nil? || (first == :all and options.nil?)
80
- easy_finder(TicketMaster::Provider::Github::Ticket, name, :all)
81
- elsif first.is_a? Fixnum
82
- easy_finder(TicketMaster::Provider::Github::Ticket, name, first)
83
- elsif first
84
- unless options.blank?
85
- options = options.first
86
- else
87
- options = {}
88
- end
89
- easy_finder(TicketMaster::Provider::Github::Ticket, name, first, options)
90
- end
81
+ TicketMaster::Provider::Github::Ticket.find(self.id, *options)
91
82
  end
92
83
 
93
84
  def ticket!(*options)
@@ -51,7 +51,11 @@ module TicketMaster::Provider
51
51
  attributes[:state] = 'open'
52
52
  issues += self::API.find_all(build_attributes(project_id, attributes))
53
53
  attributes[:state] = 'closed'
54
- issues += self::API.find_all(build_attributes(project_id, attributes))
54
+ begin
55
+ issues += self::API.find_all(build_attributes(project_id, attributes))
56
+ rescue APICache::TimeoutError
57
+ warn "Unable to fetch closed issues due to timeout"
58
+ end
55
59
  else
56
60
  issues = self::API.find_all(build_attributes(project_id, attributes))
57
61
  end
@@ -59,7 +63,7 @@ module TicketMaster::Provider
59
63
  end
60
64
 
61
65
  def self.build_attributes(repo, options)
62
- hash = {:repo => repo, :user => Octopi::Api.api.login}
66
+ hash = {:repo => repo, :user => TicketMaster::Provider::Github.login}
63
67
  hash.merge!(options)
64
68
  end
65
69
 
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{ticketmaster-github}
8
- s.version = "0.2.1"
8
+ s.version = "0.3.0"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["HybridGroup"]
12
- s.date = %q{2010-12-08}
12
+ s.date = %q{2010-12-23}
13
13
  s.description = %q{This provides an interface with github through the ticketmaster gem.}
14
14
  s.email = %q{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-github
3
3
  version: !ruby/object:Gem::Version
4
- hash: 21
4
+ hash: 19
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
- - 2
9
- - 1
10
- version: 0.2.1
8
+ - 3
9
+ - 0
10
+ version: 0.3.0
11
11
  platform: ruby
12
12
  authors:
13
13
  - HybridGroup
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2010-12-08 00:00:00 -08:00
18
+ date: 2010-12-23 00:00:00 -08:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency