Class: Ga4Rails::AnalyticsData

Inherits:
Object
  • Object
show all
Defined in:
lib/ga4-rails/api/analytics_data.rb

Constant Summary collapse

AnalyticsData =
Google::Apis::AnalyticsdataV1beta

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(access_token:) ⇒ AnalyticsData

Returns a new instance of AnalyticsData.



38
39
40
# File 'lib/ga4-rails/api/analytics_data.rb', line 38

def initialize(access_token:)
  @access_token = access_token
end

Instance Attribute Details

#access_tokenObject

Returns the value of attribute access_token.



36
37
38
# File 'lib/ga4-rails/api/analytics_data.rb', line 36

def access_token
  @access_token
end

Instance Method Details

#serviceObject



42
43
44
45
46
47
48
# File 'lib/ga4-rails/api/analytics_data.rb', line 42

def service
  return @service if @service

  @service = AnalyticsData::AnalyticsDataService.new
  @service.authorization = access_token
  @service
end