Class: AnalyticsPSW::Analytics

Inherits:
Object
  • Object
show all
Includes:
Customers, DimensionProperties, Dimensions, EventTypes, Events, RecentEvents, Reports, Services, Utilities
Defined in:
lib/analytics-psw.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Customers

#list_customers

Methods included from Reports

#create_report, #delete_report, #list_reports, #multi_query_analytics, #query_analytics, #report_criteria, #run_report

Methods included from Services

#show_service_metadata, #show_service_resources

Methods included from EventTypes

#create_event_type, #list_event_types, #show_event_type

Methods included from Events

#record_event

Methods included from Dimensions

#create_dimension, #list_dimensions, #show_dimension_metadata, #show_dimension_resources

Methods included from DimensionProperties

#create_dimension_properties, #create_or_update_dimension_properties, #list_dimension_properties, #show_dimension_properties, #update_dimension_properties

Methods included from RecentEvents

#recent_events

Constructor Details

#initialize(opts = {}) ⇒ Analytics

Returns a new instance of Analytics.



40
41
42
43
44
45
46
47
48
49
# File 'lib/analytics-psw.rb', line 40

def initialize(opts = {})
  set_vars_from_opts(opts)
  @conn = faraday_connection
  update_token if @client_id && @client_secret
  @service_location = "#{@server_url}/services/#{@service_name}"
  resp = http_request(:get, @service_location)
  raise 'The service name provided does not appear to be valid' unless resp['status'] == 200
  find_or_create_event_types
  find_or_create_dimensions(@dimensions) if @dimensions
end

Instance Attribute Details

#dimensionsObject

Returns the value of attribute dimensions.



33
34
35
# File 'lib/analytics-psw.rb', line 33

def dimensions
  @dimensions
end

#event_typesObject

Returns the value of attribute event_types.



33
34
35
# File 'lib/analytics-psw.rb', line 33

def event_types
  @event_types
end

#service_locationObject

Returns the value of attribute service_location.



33
34
35
# File 'lib/analytics-psw.rb', line 33

def service_location
  @service_location
end

Class Method Details

.get(opts = {}) ⇒ Object



35
36
37
38
# File 'lib/analytics-psw.rb', line 35

def self.get(opts = {})
  klass = opts['mock'] ? MockAnalytics : Analytics
  klass.new(opts)
end