Class: ModernTreasury::EventController
- Inherits:
-
BaseController
- Object
- BaseController
- ModernTreasury::EventController
- Defined in:
- lib/modern_treasury/controllers/event_controller.rb
Overview
EventController
Constant Summary
Constants inherited from BaseController
Instance Attribute Summary
Attributes inherited from BaseController
Instance Method Summary collapse
-
#get_event(id) ⇒ Event
TODO: type endpoint description here.
-
#list_events(per_page: nil, event_time_start: nil, event_time_end: nil, resource: nil, entity_id: nil, event_name: nil, after_cursor: nil) ⇒ Array[Event]
TODO: type endpoint description here here bound for when the event occurred bound for when the event occurred here here here.
Methods inherited from BaseController
#initialize, #new_parameter, #new_request_builder, #new_response_handler, user_agent
Constructor Details
This class inherits a constructor from ModernTreasury::BaseController
Instance Method Details
#get_event(id) ⇒ Event
TODO: type endpoint description here
54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 |
# File 'lib/modern_treasury/controllers/event_controller.rb', line 54 def get_event(id) @api_call .request(new_request_builder(HttpMethodEnum::GET, '/api/events/{id}', Server::DEFAULT) .template_param(new_parameter(id, key: 'id') .should_encode(true)) .header_param(new_parameter('application/json', key: 'accept')) .auth(Single.new('basic_auth'))) .response(new_response_handler .deserializer(APIHelper.method(:custom_type_deserializer)) .deserialize_into(Event.method(:from_hash)) .local_error('404', 'not found', ErrorMessageException)) .execute end |
#list_events(per_page: nil, event_time_start: nil, event_time_end: nil, resource: nil, entity_id: nil, event_name: nil, after_cursor: nil) ⇒ Array[Event]
TODO: type endpoint description here here bound for when the event occurred bound for when the event occurred here here here
24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 |
# File 'lib/modern_treasury/controllers/event_controller.rb', line 24 def list_events(per_page: nil, event_time_start: nil, event_time_end: nil, resource: nil, entity_id: nil, event_name: nil, after_cursor: nil) @api_call .request(new_request_builder(HttpMethodEnum::GET, '/api/events', Server::DEFAULT) .query_param(new_parameter(per_page, key: 'per_page')) .query_param(new_parameter(event_time_start, key: 'event_time_start')) .query_param(new_parameter(event_time_end, key: 'event_time_end')) .query_param(new_parameter(resource, key: 'resource')) .query_param(new_parameter(entity_id, key: 'entity_id')) .query_param(new_parameter(event_name, key: 'event_name')) .query_param(new_parameter(after_cursor, key: 'after_cursor')) .header_param(new_parameter('application/json', key: 'accept')) .auth(Single.new('basic_auth'))) .response(new_response_handler .deserializer(APIHelper.method(:custom_type_deserializer)) .deserialize_into(Event.method(:from_hash)) .is_response_array(true)) .execute end |