Class: ModernTreasury::EventApi

Inherits:
BaseApi
  • Object
show all
Defined in:
lib/modern_treasury/apis/event_api.rb

Overview

EventApi

Constant Summary

Constants inherited from BaseApi

BaseApi::GLOBAL_ERRORS

Instance Attribute Summary

Attributes inherited from BaseApi

#config, #http_call_back

Instance Method Summary collapse

Methods inherited from BaseApi

#initialize, #new_parameter, #new_request_builder, #new_response_handler, user_agent, user_agent_parameters

Constructor Details

This class inherits a constructor from ModernTreasury::BaseApi

Instance Method Details

#get_event(id) ⇒ ApiResponse

TODO: type endpoint description here

Parameters:

  • id (String)

    Required parameter: event id

Returns:

  • (ApiResponse)

    Complete http response with raw body and status code.



55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
# File 'lib/modern_treasury/apis/event_api.rb', line 55

def get_event(id)
  @api_call
    .request(new_request_builder(HttpMethodEnum::GET,
                                 '/api/events/{id}',
                                 Server::DEFAULT)
               .template_param(new_parameter(id, key: 'id')
                                .is_required(true)
                                .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))
                .is_api_response(true)
                .local_error('404',
                             'not found',
                             ErrorMessageException))
    .execute
end

#list_events(after_cursor: nil, per_page: nil, event_time_start: nil, event_time_end: nil, resource: nil, entity_id: nil, event_name: nil) ⇒ ApiResponse

TODO: type endpoint description here here here bound for when the event occurred bound for when the event occurred here here

Parameters:

  • after_cursor (String) (defaults to: nil)

    Optional parameter: TODO: type description

  • per_page (Integer) (defaults to: nil)

    Optional parameter: TODO: type description

  • event_time_start (DateTime) (defaults to: nil)

    Optional parameter: An inclusive lower

  • event_time_end (DateTime) (defaults to: nil)

    Optional parameter: An inclusive upper

  • resource (String) (defaults to: nil)

    Optional parameter: TODO: type description here

  • entity_id (String) (defaults to: nil)

    Optional parameter: TODO: type description

  • event_name (String) (defaults to: nil)

    Optional parameter: TODO: type description

Returns:

  • (ApiResponse)

    Complete http response with raw body and status code.



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
50
# File 'lib/modern_treasury/apis/event_api.rb', line 24

def list_events(after_cursor: nil,
                per_page: nil,
                event_time_start: nil,
                event_time_end: nil,
                resource: nil,
                entity_id: nil,
                event_name: nil)
  @api_call
    .request(new_request_builder(HttpMethodEnum::GET,
                                 '/api/events',
                                 Server::DEFAULT)
               .query_param(new_parameter(after_cursor, key: 'after_cursor'))
               .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'))
               .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_api_response(true)
                .is_response_array(true))
    .execute
end