Class: Bastille::Hub

Inherits:
Object
  • Object
show all
Defined in:
lib/bastille/hub.rb

Instance Method Summary collapse

Constructor Details

#initialize(username, token) ⇒ Hub

Returns a new instance of Hub.



4
5
6
7
# File 'lib/bastille/hub.rb', line 4

def initialize(username, token)
  @login = username
  @oauth = token
end

Instance Method Details

#authenticate!Object



9
10
11
12
13
14
# File 'lib/bastille/hub.rb', line 9

def authenticate!
  client.ratelimit
  true
rescue Octokit::Unauthorized
  false
end

#member_of_space?(space) ⇒ Boolean

Returns:

  • (Boolean)


20
21
22
# File 'lib/bastille/hub.rb', line 20

def member_of_space?(space)
  spaces.include?(space)
end

#spacesObject



16
17
18
# File 'lib/bastille/hub.rb', line 16

def spaces
  [@login] + client.organizations.collect(&:login)
end