Sha256: 85e4657d7730cd656935b03cff2720744de4a49457a33c6c19c5d1fccd3f52cb
Contents?: true
Size: 1.08 KB
Versions: 21
Compression:
Stored size: 1.08 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 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
21 entries across 21 versions & 1 rubygems