ga4-rails 0.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/CHANGELOG.md ADDED
@@ -0,0 +1,8 @@
1
+ ## [Unreleased]
2
+
3
+ ## [0.1.0] - 2022-12-27
4
+
5
+ - Initial release
6
+
7
+ ## [0.1.1] - 2022-12-29
8
+ - Implement basic wrapper for Google Analytics Admin API
data/Gemfile ADDED
@@ -0,0 +1,8 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in ga4-rails.gemspec
4
+ gemspec
5
+
6
+ gem 'rake', '~> 13.0'
7
+
8
+ gem 'rspec', '~> 3.0'
data/Gemfile.lock ADDED
@@ -0,0 +1,108 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ ga4-rails (0.1.1)
5
+ google-apis-analyticsadmin_v1alpha
6
+ google-apis-analyticsdata_v1beta
7
+
8
+ GEM
9
+ remote: https://rubygems.org/
10
+ specs:
11
+ addressable (2.8.1)
12
+ public_suffix (>= 2.0.2, < 6.0)
13
+ ast (2.4.2)
14
+ declarative (0.0.20)
15
+ diff-lcs (1.5.0)
16
+ faraday (2.7.2)
17
+ faraday-net_http (>= 2.0, < 3.1)
18
+ ruby2_keywords (>= 0.0.4)
19
+ faraday-net_http (3.0.2)
20
+ google-apis-analyticsadmin_v1alpha (0.44.0)
21
+ google-apis-core (>= 0.9.1, < 2.a)
22
+ google-apis-analyticsdata_v1beta (0.21.0)
23
+ google-apis-core (>= 0.9.1, < 2.a)
24
+ google-apis-core (0.9.2)
25
+ addressable (~> 2.5, >= 2.5.1)
26
+ googleauth (>= 0.16.2, < 2.a)
27
+ httpclient (>= 2.8.1, < 3.a)
28
+ mini_mime (~> 1.0)
29
+ representable (~> 3.0)
30
+ retriable (>= 2.0, < 4.a)
31
+ rexml
32
+ webrick
33
+ googleauth (1.3.0)
34
+ faraday (>= 0.17.3, < 3.a)
35
+ jwt (>= 1.4, < 3.0)
36
+ memoist (~> 0.16)
37
+ multi_json (~> 1.11)
38
+ os (>= 0.9, < 2.0)
39
+ signet (>= 0.16, < 2.a)
40
+ httpclient (2.8.3)
41
+ json (2.6.3)
42
+ jwt (2.6.0)
43
+ memoist (0.16.2)
44
+ mini_mime (1.1.2)
45
+ multi_json (1.15.0)
46
+ os (1.1.4)
47
+ parallel (1.22.1)
48
+ parser (3.1.3.0)
49
+ ast (~> 2.4.1)
50
+ public_suffix (5.0.1)
51
+ rainbow (3.1.1)
52
+ rake (13.0.6)
53
+ regexp_parser (2.6.1)
54
+ representable (3.2.0)
55
+ declarative (< 0.1.0)
56
+ trailblazer-option (>= 0.1.1, < 0.2.0)
57
+ uber (< 0.2.0)
58
+ retriable (3.1.2)
59
+ rexml (3.2.5)
60
+ rspec (3.12.0)
61
+ rspec-core (~> 3.12.0)
62
+ rspec-expectations (~> 3.12.0)
63
+ rspec-mocks (~> 3.12.0)
64
+ rspec-core (3.12.0)
65
+ rspec-support (~> 3.12.0)
66
+ rspec-expectations (3.12.1)
67
+ diff-lcs (>= 1.2.0, < 2.0)
68
+ rspec-support (~> 3.12.0)
69
+ rspec-mocks (3.12.1)
70
+ diff-lcs (>= 1.2.0, < 2.0)
71
+ rspec-support (~> 3.12.0)
72
+ rspec-support (3.12.0)
73
+ rubocop (1.41.1)
74
+ json (~> 2.3)
75
+ parallel (~> 1.10)
76
+ parser (>= 3.1.2.1)
77
+ rainbow (>= 2.2.2, < 4.0)
78
+ regexp_parser (>= 1.8, < 3.0)
79
+ rexml (>= 3.2.5, < 4.0)
80
+ rubocop-ast (>= 1.23.0, < 2.0)
81
+ ruby-progressbar (~> 1.7)
82
+ unicode-display_width (>= 1.4.0, < 3.0)
83
+ rubocop-ast (1.24.1)
84
+ parser (>= 3.1.1.0)
85
+ ruby-progressbar (1.11.0)
86
+ ruby2_keywords (0.0.5)
87
+ signet (0.17.0)
88
+ addressable (~> 2.8)
89
+ faraday (>= 0.17.5, < 3.a)
90
+ jwt (>= 1.5, < 3.0)
91
+ multi_json (~> 1.10)
92
+ trailblazer-option (0.1.2)
93
+ uber (0.1.0)
94
+ unicode-display_width (2.3.0)
95
+ webrick (1.7.0)
96
+
97
+ PLATFORMS
98
+ arm64-darwin-21
99
+ ruby
100
+
101
+ DEPENDENCIES
102
+ ga4-rails!
103
+ rake (~> 13.0)
104
+ rspec (~> 3.0)
105
+ rubocop
106
+
107
+ BUNDLED WITH
108
+ 2.3.13
data/README.md ADDED
@@ -0,0 +1,28 @@
1
+ # Ga4::Rails
2
+
3
+ This is a gem to simplify integration of Rails and Google Analytics 4.
4
+
5
+
6
+ ## Installation
7
+
8
+ Install the gem and add to the application's Gemfile by executing:
9
+
10
+ $ bundle add ga4-rails
11
+
12
+ If bundler is not being used to manage dependencies, install the gem by executing:
13
+
14
+ $ gem install ga4-rails
15
+
16
+ ## Usage
17
+
18
+ TODO: Write usage instructions here
19
+
20
+ ## Development
21
+
22
+ After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
23
+
24
+ To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and the created tag, and push the `.gem` file to [rubygems.org](https://rubygems.org).
25
+
26
+ ## Contributing
27
+
28
+ Bug reports and pull requests are welcome on GitHub at https://github.com/Dark-Sun/ga4-rails.
data/Rakefile ADDED
@@ -0,0 +1,8 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'bundler/gem_tasks'
4
+ require 'rspec/core/rake_task'
5
+
6
+ RSpec::Core::RakeTask.new(:spec)
7
+
8
+ task default: :spec
@@ -0,0 +1,30 @@
1
+ require 'google/apis/analyticsadmin_v1alpha'
2
+
3
+ # A class for interacting with the Google Analytics Admin API.
4
+ #
5
+ # @attr_reader [OAuth2::AccessToken] access_token -
6
+ # the access token obtained from the Google OAuth2 flow
7
+ #
8
+ # @example
9
+ # analytics_admin = Ga4Rails::AnalyticsAdmin.new(access_token: access_token)
10
+ # analytics_admin.service.list_account_summaries
11
+
12
+ module Ga4Rails
13
+ class AnalyticsAdmin
14
+ Analyticsadmin = Google::Apis::AnalyticsadminV1alpha
15
+
16
+ attr_accessor :access_token
17
+
18
+ def initialize(access_token:)
19
+ @access_token = access_token
20
+ end
21
+
22
+ def service
23
+ return @service if @service
24
+
25
+ @service = Analyticsadmin::GoogleAnalyticsAdminService.new
26
+ @service.authorization = access_token
27
+ @service
28
+ end
29
+ end
30
+ end
@@ -0,0 +1,37 @@
1
+ require_relative 'analytics_admin'
2
+
3
+ # A client for interacting with the Google Analytics API.
4
+ #
5
+ # @attr_reader [OAuth2::AccessToken] access_token -
6
+ # the access token obtained from the Google OAuth2 flow
7
+ #
8
+ # @example
9
+ # client = Ga4Rails::Client.new(access_token: access_token)
10
+ # client.admin.list_account_summaries
11
+ class Ga4Rails::Client
12
+ attr_reader :access_token
13
+
14
+ # Initializes a new client.
15
+ #
16
+ # @param access_token [OAuth2::AccessToken] -
17
+ # the access token obtained from the Google OAuth2 flow
18
+ def initialize(access_token:)
19
+ @access_token = access_token
20
+ end
21
+
22
+ # Returns an instance of the AnalyticsAdmin class.
23
+ #
24
+ # @return [Ga4Rails::AnalyticsAdmin] -
25
+ # an instance of the AnalyticsAdmin class
26
+ def admin
27
+ analytics_admin_service
28
+ end
29
+
30
+ private
31
+
32
+ def analytics_admin_service
33
+ @analytics_admin_service ||= Ga4Rails::AnalyticsAdmin.new(
34
+ access_token: access_token
35
+ ).service
36
+ end
37
+ end
@@ -0,0 +1,3 @@
1
+ module Ga4Rails
2
+ VERSION = '0.1.2'.freeze
3
+ end
data/sig/ga4/rails.rbs ADDED
@@ -0,0 +1,6 @@
1
+ module Ga4
2
+ module Rails
3
+ VERSION: String
4
+ # See the writing guide of rbs: https://github.com/ruby/rbs#guides
5
+ end
6
+ end
metadata ADDED
@@ -0,0 +1,100 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: ga4-rails
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.2
5
+ platform: ruby
6
+ authors:
7
+ - Andriy Lukashchuk
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2022-12-30 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: google-apis-analyticsadmin_v1alpha
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: google-apis-analyticsdata_v1beta
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rubocop
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ description:
56
+ email:
57
+ - andriy.lks@gmail.com
58
+ executables: []
59
+ extensions: []
60
+ extra_rdoc_files: []
61
+ files:
62
+ - ".DS_Store"
63
+ - ".rspec"
64
+ - ".rubocop.yml"
65
+ - CHANGELOG.md
66
+ - Gemfile
67
+ - Gemfile.lock
68
+ - README.md
69
+ - Rakefile
70
+ - lib/ga4-rails/analytics_admin.rb
71
+ - lib/ga4-rails/client.rb
72
+ - lib/ga4-rails/version.rb
73
+ - sig/ga4/rails.rbs
74
+ homepage: http://github.com/Dark-Sun/ga4-rails
75
+ licenses: []
76
+ metadata:
77
+ allowed_push_host: https://rubygems.org/
78
+ homepage_uri: http://github.com/Dark-Sun/ga4-rails
79
+ source_code_uri: http://github.com/Dark-Sun/ga4-rails
80
+ changelog_uri: http://github.com/Dark-Sun/ga4-rails/changelog
81
+ post_install_message:
82
+ rdoc_options: []
83
+ require_paths:
84
+ - lib
85
+ required_ruby_version: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - ">="
88
+ - !ruby/object:Gem::Version
89
+ version: 2.6.0
90
+ required_rubygems_version: !ruby/object:Gem::Requirement
91
+ requirements:
92
+ - - ">="
93
+ - !ruby/object:Gem::Version
94
+ version: '0'
95
+ requirements: []
96
+ rubygems_version: 3.1.6
97
+ signing_key:
98
+ specification_version: 4
99
+ summary: Efortlessly integrate Google Analytics 4 with your Rails app
100
+ test_files: []