Class: Lago::Api::Resources::Event
- Inherits:
-
Base
- Object
- Base
- Lago::Api::Resources::Event
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
#destroy, #get, #get_all, #initialize, #update
Instance Method Details
#api_resource ⇒ Object
7
8
9
|
# File 'lib/lago/api/resources/event.rb', line 7
def api_resource
'events'
end
|
#batch_create(params) ⇒ Object
20
21
22
23
24
25
|
# File 'lib/lago/api/resources/event.rb', line 20
def batch_create(params)
uri = URI("#{client.base_api_url}#{api_resource}/batch")
payload = whitelist_batch_params(params)
connection.post(payload, uri)
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_name ⇒ Object
11
12
13
|
# File 'lib/lago/api/resources/event.rb', line 11
def root_name
'event'
end
|
#whitelist_batch_params(params) ⇒ Object
40
41
42
43
44
45
46
47
48
49
50
51
|
# File 'lib/lago/api/resources/event.rb', line 40
def whitelist_batch_params(params)
{
root_name => {
transaction_id: params[:transaction_id],
customer_id: params[:customer_id],
code: params[:code],
timestamp: params[:timestamp],
subscription_ids: params[:subscription_ids],
properties: params[:properties]
}.compact
}
end
|
#whitelist_params(params) ⇒ Object
27
28
29
30
31
32
33
34
35
36
37
38
|
# File 'lib/lago/api/resources/event.rb', line 27
def whitelist_params(params)
{
root_name => {
transaction_id: params[:transaction_id],
customer_id: params[:customer_id],
code: params[:code],
timestamp: params[:timestamp],
subscription_id: params[:subscription_id],
properties: params[:properties]
}.compact
}
end
|