Class: SendLayer::Events
- Inherits:
-
Object
- Object
- SendLayer::Events
- Defined in:
- lib/sendlayer/events.rb
Constant Summary collapse
- VALID_EVENTS =
%w[accepted rejected delivered opened clicked unsubscribed complained failed].freeze
Instance Method Summary collapse
- #get(start_date: nil, end_date: nil, event: nil, message_id: nil, start_from: nil, retrieve_count: nil) ⇒ Object
-
#initialize(client) ⇒ Events
constructor
A new instance of Events.
Constructor Details
#initialize(client) ⇒ Events
Returns a new instance of Events.
5 6 7 |
# File 'lib/sendlayer/events.rb', line 5 def initialize(client) @client = client end |
Instance Method Details
#get(start_date: nil, end_date: nil, event: nil, message_id: nil, start_from: nil, retrieve_count: nil) ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/sendlayer/events.rb', line 9 def get(start_date: nil, end_date: nil, event: nil, message_id: nil, start_from: nil, retrieve_count: nil) validate_events_params(start_date, end_date, event, retrieve_count) params = {} params[:StartDate] = start_date.to_i if start_date params[:EndDate] = end_date.to_i if end_date params[:Event] = event if event params[:MessageID] = if params[:StartFrom] = start_from if start_from params[:RetrieveCount] = retrieve_count if retrieve_count @client.make_request('GET', 'events', nil, params) end |