Sha256: e2fe046ffd5333616600705e71fb2fe0850159b6635f0f537f1d18664b2e38b7
Contents?: true
Size: 1.11 KB
Versions: 28
Compression:
Stored size: 1.11 KB
Contents
require_dependency "wbase/application_controller" module Wbase class StripeWebhooksController < ApplicationController skip_before_filter :verify_authenticity_token def create @event = StripeWebhook.new(event_params) if @event.save @event.process! render json: @event else render json: @event.errors.full_messages, status: :unprocessable_entity end end private def event_params adaptor = WebhookAdaptor.new(params) adaptor.to_h end end class WebhookAdaptor attr_reader :params def initialize(params) @params = params end def external_id params['id'] end def created Time.at(params['created']) end def to_h { external_id: external_id, object: params['object'], api_version: params['api_version'], created: created, data: params['data'], livemode: params['livemode'], pending_webhooks: params['pending_webhooks'], external_type: params['type'], external_request: params['request'] } end end end
Version data entries
28 entries across 28 versions & 1 rubygems