Module: StripeMock::RequestHandlers::Events

Included in:
Instance
Defined in:
lib/stripe_mock/request_handlers/events.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(klass) ⇒ Object



5
6
7
8
# File 'lib/stripe_mock/request_handlers/events.rb', line 5

def Events.included(klass)
  klass.add_handler 'get /v1/events/(.*)', :retrieve_event
  klass.add_handler 'get /v1/events',      :list_events
end

Instance Method Details

#list_events(route, method_url, params, headers) ⇒ Object



15
16
17
18
# File 'lib/stripe_mock/request_handlers/events.rb', line 15

def list_events(route, method_url, params, headers)
  values = filter_by_created(events.values, params: params)
  Data.mock_list_object(values, params)
end

#retrieve_event(route, method_url, params, headers) ⇒ Object



10
11
12
13
# File 'lib/stripe_mock/request_handlers/events.rb', line 10

def retrieve_event(route, method_url, params, headers)
  route =~ method_url
  assert_existence :event, $1, events[$1]
end