Class: Writefully::HooksController

Inherits:
ApplicationController show all
Defined in:
app/controllers/writefully/hooks_controller.rb

Defined Under Namespace

Classes: InvalidSignature

Constant Summary collapse

HMAC_DIGEST =
OpenSSL::Digest::Digest.new('sha1')

Instance Method Summary collapse

Methods inherited from ApplicationController

#authenticate_wf_authorship!, #set_flash, #wf_authorship_signed_in?

Instance Method Details

#createObject



11
12
13
14
# File 'app/controllers/writefully/hooks_controller.rb', line 11

def create
  self.__send__ request.headers["X-Github-Event"].to_sym
  head :ok
end

#memberObject



24
25
26
27
28
29
# File 'app/controllers/writefully/hooks_controller.rb', line 24

def member
  authorship = Authorship.find_by_uid(body.member.id)
  unless authorship
    Authorship.create_from_data(body.member)
  end
end

#pingObject



16
17
# File 'app/controllers/writefully/hooks_controller.rb', line 16

def ping
end

#pushObject



19
20
21
22
# File 'app/controllers/writefully/hooks_controller.rb', line 19

def push
  Writefully.add_job :handyman, { task: :synchronize, 
                                  site_slug: body.repository.name } if branch_match?
end