ticketmaster-github 0.4.5 → 0.4.6
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/lib/provider/github.rb +3 -1
- data/lib/provider/project.rb +7 -3
- data/spec/project_spec.rb +2 -2
- data/spec/ticketmaster-github_spec.rb +7 -1
- data/ticketmaster-github.gemspec +1 -1
- metadata +3 -3
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.4.
|
1
|
+
0.4.6
|
data/lib/provider/github.rb
CHANGED
@@ -4,7 +4,7 @@ module TicketMaster::Provider
|
|
4
4
|
include TicketMaster::Provider::Base
|
5
5
|
|
6
6
|
class << self
|
7
|
-
attr_accessor :login, :api
|
7
|
+
attr_accessor :login, :api, :user_token
|
8
8
|
end
|
9
9
|
|
10
10
|
# This is for cases when you want to instantiate using TicketMaster::Provider::Github.new(auth)
|
@@ -20,9 +20,11 @@ module TicketMaster::Provider
|
|
20
20
|
raise TicketMaster::Exception.new('Please provide at least a username')
|
21
21
|
elsif auth.token.blank?
|
22
22
|
TicketMaster::Provider::Github.login = auth.login || auth.username
|
23
|
+
TicketMaster::Provider::Github.user_token = nil
|
23
24
|
TicketMaster::Provider::Github.api = Octokit.client(:login => auth.login)
|
24
25
|
else
|
25
26
|
TicketMaster::Provider::Github.login = auth.login || auth.username
|
27
|
+
TicketMaster::Provider::Github.user_token = auth.token
|
26
28
|
TicketMaster::Provider::Github.api = Octokit.client(:login => auth.login, :token => auth.token)
|
27
29
|
end
|
28
30
|
end
|
data/lib/provider/project.rb
CHANGED
@@ -68,9 +68,13 @@ module TicketMaster::Provider
|
|
68
68
|
repos = []
|
69
69
|
user_repos = TicketMaster::Provider::Github.api.repositories(TicketMaster::Provider::Github.login).collect { |repository|
|
70
70
|
self.new repository }
|
71
|
-
|
72
|
-
|
73
|
-
|
71
|
+
repos = repos + user_repos
|
72
|
+
unless TicketMaster::Provider::Github.user_token.nil?
|
73
|
+
org_repos = TicketMaster::Provider::Github.api.organization_repositories.collect { |repository|
|
74
|
+
self.new repository }
|
75
|
+
repos = repos + org_repos
|
76
|
+
end
|
77
|
+
repos
|
74
78
|
end
|
75
79
|
|
76
80
|
def tickets(*options)
|
data/spec/project_spec.rb
CHANGED
@@ -3,12 +3,12 @@ require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
|
|
3
3
|
describe "Ticketmaster::Provider::Github::Project" do
|
4
4
|
|
5
5
|
before(:all) do
|
6
|
-
@repo_name = "
|
6
|
+
@repo_name = "flying_robot"
|
7
7
|
@klass = TicketMaster::Provider::Github::Project
|
8
8
|
end
|
9
9
|
|
10
10
|
before(:each) do
|
11
|
-
@github = TicketMaster.new(:github, {:login => '
|
11
|
+
@github = TicketMaster.new(:github, {:login => 'deadprogrammer' })
|
12
12
|
end
|
13
13
|
|
14
14
|
it "should be able to load all projects" do
|
@@ -3,9 +3,15 @@ require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
|
|
3
3
|
describe "Ticketmaster::Provider::Github" do
|
4
4
|
|
5
5
|
it "Should be able to instantiate a new instance" do
|
6
|
-
@github =
|
6
|
+
@github = TicketMaster.new(:Github, {:login => 'juanespinosa', :token => 'asdfghk'})
|
7
7
|
@github.should be_an_instance_of(TicketMaster)
|
8
8
|
@github.should be_a_kind_of(TicketMaster::Provider::Github)
|
9
9
|
end
|
10
10
|
|
11
|
+
it "Should show attempted authenticated if a token is presemt" do
|
12
|
+
@github = TicketMaster.new(:Github, {:login => 'juanespinosa', :token => 'asdfghk'})
|
13
|
+
@github.authorize
|
14
|
+
TicketMaster::Provider::Github.api.authenticated?.should be_true
|
15
|
+
end
|
16
|
+
|
11
17
|
end
|
data/ticketmaster-github.gemspec
CHANGED
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:
|
4
|
+
hash: 3
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 4
|
9
|
-
-
|
10
|
-
version: 0.4.
|
9
|
+
- 6
|
10
|
+
version: 0.4.6
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- HybridGroup
|