Module: TicketMaster::Provider::Github

Includes:
Base
Defined in:
lib/provider/github.rb,
lib/provider/project.rb,
lib/provider/comment.rb,
lib/provider/ticket.rb

Overview

This is the Github Provider for ticketmaster

Defined Under Namespace

Classes: Comment, Project, Ticket

Class Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Class Attribute Details

.apiObject

Returns the value of attribute api.



7
8
9
# File 'lib/provider/github.rb', line 7

def api
  @api
end

.loginObject

Returns the value of attribute login.



7
8
9
# File 'lib/provider/github.rb', line 7

def 
  @login
end

.user_tokenObject

Returns the value of attribute user_token.



7
8
9
# File 'lib/provider/github.rb', line 7

def user_token
  @user_token
end

.valid_userObject

Returns the value of attribute valid_user.



7
8
9
# File 'lib/provider/github.rb', line 7

def valid_user
  @valid_user
end

Class Method Details

.new(auth = {}) ⇒ Object

This is for cases when you want to instantiate using TicketMaster::Provider::Github.new(auth)



11
12
13
# File 'lib/provider/github.rb', line 11

def self.new(auth = {})
  TicketMaster.new(:github, auth)
end

Instance Method Details

#authorize(auth = {}) ⇒ Object

declare needed overloaded methods here



16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# File 'lib/provider/github.rb', line 16

def authorize(auth = {})
  @authentication ||= TicketMaster::Authenticator.new(auth)
  auth = @authentication
   = auth. || auth.username
  if auth..blank? and auth.username.blank?
    raise TicketMaster::Exception.new('Please provide at least a username')
  elsif auth.token
    TicketMaster::Provider::Github. = 
    TicketMaster::Provider::Github.user_token = auth.token
    TicketMaster::Provider::Github.api = Octokit::Client.new(:login => , :token => auth.token)
  elsif auth.password
    TicketMaster::Provider::Github. = 
    TicketMaster::Provider::Github.user_token = auth.token
    TicketMaster::Provider::Github.api = Octokit::Client.new(:login => , :password => auth.password)
  else 
    TicketMaster::Provider::Github. = 
    TicketMaster::Provider::Github.user_token = nil
    TicketMaster::Provider::Github.api = Octokit::Client.new(:login => )
  end
end

#project(*project) ⇒ Object



49
50
51
52
53
54
55
# File 'lib/provider/github.rb', line 49

def project(*project)
  unless project.empty?
    Project.find_by_id(project.first)
  else
    super
  end
end

#projects(*options) ⇒ Object



45
46
47
# File 'lib/provider/github.rb', line 45

def projects(*options)
  Project.find(options)
end

#valid?Boolean

Returns:

  • (Boolean)


37
38
39
40
41
42
43
# File 'lib/provider/github.rb', line 37

def valid?
  begin
    TicketMaster::Provider::Github.valid_user = TicketMaster::Provider::Github.api.user.total_private_repos >= 0
  rescue
    false
  end
end