Class: Travis::Surveillance::Surveyor
- Inherits:
-
Object
- Object
- Travis::Surveillance::Surveyor
- Defined in:
- lib/travis/surveillance/surveyor.rb
Instance Attribute Summary collapse
-
#project ⇒ Object
Returns the value of attribute project.
-
#socket ⇒ Object
Returns the value of attribute socket.
Instance Method Summary collapse
-
#initialize(project, pusher_token = "23ed642e81512118260e") ⇒ Surveyor
constructor
A new instance of Surveyor.
- #survey(&block) ⇒ Object
Constructor Details
#initialize(project, pusher_token = "23ed642e81512118260e") ⇒ Surveyor
Returns a new instance of Surveyor.
13 14 15 16 |
# File 'lib/travis/surveillance/surveyor.rb', line 13 def initialize(project, pusher_token = "23ed642e81512118260e") @project = project @socket = PusherClient::Socket.new(pusher_token) end |
Instance Attribute Details
#project ⇒ Object
Returns the value of attribute project.
11 12 13 |
# File 'lib/travis/surveillance/surveyor.rb', line 11 def project @project end |
#socket ⇒ Object
Returns the value of attribute socket.
11 12 13 |
# File 'lib/travis/surveillance/surveyor.rb', line 11 def socket @socket end |
Instance Method Details
#survey(&block) ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/travis/surveillance/surveyor.rb', line 18 def survey(&block) @socket.subscribe('common') @socket['common'].bind('build:started') do |payload| payload_to_new_build(payload) yield if block_given? end @socket['common'].bind('build:finished') do |payload| payload_to_finished_build(payload) yield if block_given? end @socket['common'].bind('job:started') do |payload| payload_to_job_started(payload) yield if block_given? end @socket['common'].bind('job:finished') do |payload| payload_to_job_finished(payload) yield if block_given? end @socket.connect unless Travis::Surveillance.mocking? end |