Class: Localytics::Event
- Inherits:
-
Object
- Object
- Localytics::Event
- Defined in:
- lib/localytics/event.rb
Class Attribute Summary collapse
-
.app_id ⇒ Object
Returns the value of attribute app_id.
Class Method Summary collapse
Class Attribute Details
.app_id ⇒ Object
Returns the value of attribute app_id.
5 6 7 |
# File 'lib/localytics/event.rb', line 5 def app_id @app_id end |
Class Method Details
.send(app_id, customer_id, event_name, event_attributes = nil, ltv_change = nil, api_key = nil, api_secret = nil) ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/localytics/event.rb', line 12 def self.send(app_id, customer_id, event_name, event_attributes=nil, ltv_change=nil, api_key=nil, api_secret=nil) raise Error.new('No APP id provided') unless app_id ||= self.app_id raise Error.new('No customer_id provided') if customer_id.nil? raise Error.new('No event_name provided') if event_name.nil? || event_name.empty? params = { schema_url: "https://localytics-files.s3.amazonaws.com/schemas/eventsApi/v1.json", app_uuid: app_id, customer_id: customer_id.to_s, event_name: event_name, event_time: (Time.now.to_f * 1000).to_i, uuid: SecureRandom.uuid } params[:attributes] = event_attributes if event_attributes && !event_attributes.empty? params[:ltv_change] = ltv_change if ltv_change Localytics.request api_base, :post, url, api_key, api_secret, params end |