Class: MultiNotifier::Middlewares::Travis

Inherits:
MultiNotifier::Middleware show all
Defined in:
lib/multi_notifier/middlewares/travis.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from MultiNotifier::Middleware

#notify!

Instance Attribute Details

#access_tokenObject

Returns the value of attribute access_token.



7
8
9
# File 'lib/multi_notifier/middlewares/travis.rb', line 7

def access_token
  @access_token
end

#repoObject

Returns the value of attribute repo.



7
8
9
# File 'lib/multi_notifier/middlewares/travis.rb', line 7

def repo
  @repo
end

#travis_proObject

Returns the value of attribute travis_pro.



7
8
9
# File 'lib/multi_notifier/middlewares/travis.rb', line 7

def travis_pro
  @travis_pro
end

Instance Method Details

#notifyObject



11
12
13
14
15
16
# File 'lib/multi_notifier/middlewares/travis.rb', line 11

def notify
  host = travis_pro? ? ::Travis::Client::PRO_URI : ::Travis::Client::ORG_URI
  client = travis_client(host, access_token)
  repo = client.repo(repo)
  repo.last_build.restart
end

#travis_pro?Boolean

Returns:

  • (Boolean)


18
19
20
# File 'lib/multi_notifier/middlewares/travis.rb', line 18

def travis_pro?
  !!travis_pro
end