Class: Mailgun::Events

Inherits:
Object
  • Object
show all
Defined in:
lib/mailgun/events/events.rb

Overview

A Mailgun::Events object makes it really simple to consume

Mailgun's events from the Events endpoint.

This is not yet comprehensive.

Examples

See the Github documentation for full examples.

Instance Method Summary collapse

Constructor Details

#initialize(client, domain) ⇒ Events

Public: event initializer

client - an instance of Mailgun::Client domain - the domain to build queries



19
20
21
22
23
24
# File 'lib/mailgun/events/events.rb', line 19

def initialize(client, domain)
  @client = client
  @domain = domain
  @paging_next = nil
  @paging_previous = nil
end

Instance Method Details

#get(params = nil) ⇒ Object

Public: Issues a simple get against the client.

params - a Hash of query options and/or filters.

Returns a Mailgun::Response object.



31
32
33
# File 'lib/mailgun/events/events.rb', line 31

def get(params = nil)
  get_events(params)
end

#nextObject

Public: Using built in paging, obtains the next set of data. If an events request hasn’t been sent previously, this will send one

without parameters

Returns a Mailgun::Response object.



40
41
42
# File 'lib/mailgun/events/events.rb', line 40

def next
  get_events(nil, @paging_next)
end

#previousObject

Public: Using built in paging, obtains the previous set of data. If an events request hasn’t been sent previously, this will send one

without parameters

Returns Mailgun::Response object.



49
50
51
# File 'lib/mailgun/events/events.rb', line 49

def previous
  get_events(nil, @paging_previous)
end