Class: ScoutMetrics::Engagement

Inherits:
Object
  • Object
show all
Defined in:
lib/scoutmetrics/engagement.rb

Class Method Summary collapse

Class Method Details

.create(name, date_recorded = nil) ⇒ Json

Add/Update an “EngagementInstance” on Scout Metrics This tells Scout Metrics that a user performed an “Engagement” on a given date For example: Someone “Liked us on Facebook” on Dec 12th (We do not track who performed the action)

Parameters:

  • name (String)

    Describes the engagement

  • date_recorded (Date) (defaults to: nil)

    Day the engagement happened, defaults to now

Returns:

  • (Json)

    Returns a msg for the transaction and the status of the request

  • msg explanation of outcome



26
27
28
29
30
31
# File 'lib/scoutmetrics/engagement.rb', line 26

def self.create(name, date_recorded=nil)
  date_recorded ||= Time.new
  params = { engagement: { name: name },
             engagement_instance: { date_recorded: date_recorded } }
  ScoutMetrics::Request.new(:post, '/engagements/add_instance', params)
end

.create_category(name) ⇒ Json

Adds an “Engagement” to Scout Metrics For example “Liked us on Facebook”

Parameters:

  • engagement_params (Hash)

    Name of the engagement

Returns:

  • (Json)

    Returns a msg for the transaction and the status of the request

  • msg explanation of outcome



12
13
14
# File 'lib/scoutmetrics/engagement.rb', line 12

def self.create_category(name)
  ScoutMetrics::Request.new(:post, '/engagements', { engagement: { name: name } })
end