Class: Lolcommits::DotCom

Inherits:
Plugin
  • Object
show all
Defined in:
lib/lolcommits/plugins/dot_com.rb

Instance Attribute Summary

Attributes inherited from Plugin

#default, #name, #options, #runner

Instance Method Summary collapse

Methods inherited from Plugin

#configuration, #execute, #is_enabled?, #plugdebug

Constructor Details

#initialize(runner) ⇒ DotCom

Returns a new instance of DotCom.



5
6
7
8
9
10
11
# File 'lib/lolcommits/plugins/dot_com.rb', line 5

def initialize(runner)
  super

  self.name    = 'dot_com'
  self.default = false
  self.options.concat(['api_key', 'api_secret', 'repo_id'])
end

Instance Method Details

#runObject



13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/lolcommits/plugins/dot_com.rb', line 13

def run
  t = Time.now.to_i.to_s
  resp = HTTMultiParty.post('http://www.lolcommits.com/git_commits.json', 
    :body => {
      :git_commit => {
        :sha              => self.runner.sha,
        :repo_external_id => configuration['repo_id'],
        :image            => File.open(self.runner.main_image),
        :raw              => File.open(self.runner.snapshot_loc)
      },

      :key   => configuration['api_key'],
      :t     => t,
      :token =>  Digest::SHA1.hexdigest(configuration['api_secret'] + t)
    }
  )
end