class MockChargebee::Webhook
Attributes
content_attributes[R]
event_attributes[R]
event_type[R]
Public Class Methods
new(event_type, event_attributes = {}, content_attributes = {})
click to toggle source
# File lib/mock_chargebee/webhook.rb, line 3 def initialize(event_type, event_attributes = {}, content_attributes = {}) @event_type = event_type @event_attributes = event_attributes.stringify_keys @content_attributes = content_attributes.stringify_keys end
Public Instance Methods
call()
click to toggle source
# File lib/mock_chargebee/webhook.rb, line 9 def call Validations::Webhooks::EventAttributes.validate_allowed(event_attributes) event_attributes.merge!("content" => content_attributes) response = fixture.deep_merge(event_attributes) response.to_json end
Private Instance Methods
fixture()
click to toggle source
# File lib/mock_chargebee/webhook.rb, line 22 def fixture @fixture ||= JSON.parse(File.read("#{File.dirname(__FILE__)}/fixtures/webhooks/#{event_type}.json")) end