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



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

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

#memberObject



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

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

#pingObject



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

def ping
end

#pushObject



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

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