Skip to content
This repository has been archived by the owner on Jan 29, 2022. It is now read-only.

Commit

Permalink
Finish up PuppetWebhook::Parsers inline docs
Browse files Browse the repository at this point in the history
  • Loading branch information
dhollinger committed Dec 31, 2018
1 parent fb7e45a commit eed189b
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
13 changes: 12 additions & 1 deletion lib/puppet_webhook/parsers.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,23 @@

module PuppetWebhook
# Class object for parsing payloads from version control system webhook
# services. This will parse content
# services. This will parse content from the Rack::Request body (JSON) or
# the Rack::Request params (Form data) into an OpenStruct object for use
# by the Sinatra application.
class Parsers
# Public: Initialize the Parsers object
#
# @param [Sinatra::Request] request Rack request object to be parsed
#
# @return [PuppetWebhook::Parsers]
def initialize(request)
@request = request
end

# Public: Pass request to appropriate sub-parser based on the Content-Type
# request header.
#
# @return [OpenStruct]
def params
case @request.env['CONTENT_TYPE']
when 'application/json'
Expand Down
2 changes: 1 addition & 1 deletion lib/puppet_webhook/parsers/www_form_url_encoded.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

module PuppetWebhook
class Parsers
# Sub-class of PuppetWebhook::Parsers::Payload for parsing payloads of
# Sub-class of PuppetWebhook::Parsers::Payload for parsing payloads of
# Content-Type: application/x-www-form-urlencoded
#
# @example
Expand Down

0 comments on commit eed189b

Please sign in to comment.