Class: Lithic::Resources::Events

Inherits:
Object
  • Object
show all
Defined in:
lib/lithic/resources/events.rb,
lib/lithic/resources/events/subscriptions.rb,
lib/lithic/resources/events/event_subscriptions.rb

Defined Under Namespace

Classes: EventSubscriptions, Subscriptions

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(client:) ⇒ Events

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of Events.



110
111
112
113
114
# File 'lib/lithic/resources/events.rb', line 110

def initialize(client:)
  @client = client
  @subscriptions = Lithic::Resources::Events::Subscriptions.new(client: client)
  @event_subscriptions = Lithic::Resources::Events::EventSubscriptions.new(client: client)
end

Instance Attribute Details

#event_subscriptionsLithic::Resources::Events::EventSubscriptions (readonly)



10
11
12
# File 'lib/lithic/resources/events.rb', line 10

def event_subscriptions
  @event_subscriptions
end

#subscriptionsLithic::Resources::Events::Subscriptions (readonly)



7
8
9
# File 'lib/lithic/resources/events.rb', line 7

def subscriptions
  @subscriptions
end

Instance Method Details

#list(begin_: nil, end_: nil, ending_before: nil, event_types: nil, page_size: nil, starting_after: nil, with_content: nil, request_options: {}) ⇒ Lithic::Internal::CursorPage<Lithic::Models::Event>

Some parameter documentations has been truncated, see Models::EventListParams for more details.

List all events.



57
58
59
60
61
62
63
64
65
66
67
# File 'lib/lithic/resources/events.rb', line 57

def list(params = {})
  parsed, options = Lithic::EventListParams.dump_request(params)
  @client.request(
    method: :get,
    path: "v1/events",
    query: parsed.transform_keys(begin_: "begin", end_: "end"),
    page: Lithic::Internal::CursorPage,
    model: Lithic::Event,
    options: options
  )
end

#list_attempts(event_token, begin_: nil, end_: nil, ending_before: nil, page_size: nil, starting_after: nil, status: nil, request_options: {}) ⇒ Lithic::Internal::CursorPage<Lithic::Models::MessageAttempt>

Some parameter documentations has been truncated, see Models::EventListAttemptsParams for more details.

List all the message attempts for a given event.



95
96
97
98
99
100
101
102
103
104
105
# File 'lib/lithic/resources/events.rb', line 95

def list_attempts(event_token, params = {})
  parsed, options = Lithic::EventListAttemptsParams.dump_request(params)
  @client.request(
    method: :get,
    path: ["v1/events/%1$s/attempts", event_token],
    query: parsed.transform_keys(begin_: "begin", end_: "end"),
    page: Lithic::Internal::CursorPage,
    model: Lithic::MessageAttempt,
    options: options
  )
end

#retrieve(event_token, request_options: {}) ⇒ Lithic::Models::Event

Get an event.



22
23
24
25
26
27
28
29
# File 'lib/lithic/resources/events.rb', line 22

def retrieve(event_token, params = {})
  @client.request(
    method: :get,
    path: ["v1/events/%1$s", event_token],
    model: Lithic::Event,
    options: params[:request_options]
  )
end