Class: Lago::Api::Resources::Event

Inherits:
Base
  • Object
show all
Defined in:
lib/lago/api/resources/event.rb

Instance Attribute Summary

Attributes inherited from Base

#client

Instance Method Summary collapse

Methods inherited from Base

#delete, #destroy, #get, #get_all, #initialize, #update

Constructor Details

This class inherits a constructor from Lago::Api::Resources::Base

Instance Method Details

#api_resourceObject



7
8
9
# File 'lib/lago/api/resources/event.rb', line 7

def api_resource
  'events'
end

#create(params) ⇒ Object



15
16
17
18
# File 'lib/lago/api/resources/event.rb', line 15

def create(params)
  payload = whitelist_params(params)
  connection.post(payload)
end

#root_nameObject



11
12
13
# File 'lib/lago/api/resources/event.rb', line 11

def root_name
  'event'
end

#whitelist_params(params) ⇒ Object



20
21
22
23
24
25
26
27
28
29
30
# File 'lib/lago/api/resources/event.rb', line 20

def whitelist_params(params)
  {
    root_name => {
      transaction_id: params[:transaction_id],
      customer_id: params[:customer_id],
      code: params[:code],
      timestamp: params[:timestamp],
      properties: params[:properties]
    }
  }
end