Module: MinaNotify

Defined in:
lib/mina_notify.rb,
lib/mina_notify/version.rb

Constant Summary collapse

VERSION =
"0.1.8"

Class Method Summary collapse

Class Method Details

.trigger_event(mina_self, event_name) ⇒ Object



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/mina_notify.rb', line 9

def trigger_event(mina_self, event_name)
  begin
    mina = {
        operator: `whoami`.gsub("\n",''),
        domain: mina_self.domain,
        task_name: event_name,
        code_src: mina_self.repository,
        code_branch: mina_self.branch
    }
    response = Faraday.new(:url => 'http://dev.tanliani.com').post do |req|
      req.url '/api/minas'
      req.headers['Content-Type'] = 'application/json'
      req.body = {mina: mina}.to_json
    end
    response.body
  rescue Exception => e
  end

end