evva 0.2.0 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c9078e38ca6bba5b85a3349fb9e1c3f9c31b8de357080ffb1ab105e6bcbbdaa1
4
- data.tar.gz: 16b264637125fafdc14a991a9cb984e440b948bdc7d934776329b8aa8ef2d89f
3
+ metadata.gz: 32699d4abc90a02f944c069ac0cefc8e26fbf972d42342f86ad55652d198f0c2
4
+ data.tar.gz: d9e9c0e5a62a712636ebede3bf3b04a9f47c8bc36bac4f06ea4d27b48ff3703f
5
5
  SHA512:
6
- metadata.gz: 6efc1abd4ea8d72f7ac2edeccbf111deac25922fa0b1464d754d21e7bfef921efffddd228bb6d6913f3b64a4acfcd8763082f0b36b16e85e28b930d933df879c
7
- data.tar.gz: 77a4ad5df7074b646def8c880654b551fcde2e10523e3dec622d202fba48ac7bdda6d1a882abcd5c54bc2e6175b2bb68a52c30ab77d1c522f29362bc9a297db3
6
+ metadata.gz: cd70916584265dc7077907d324049b93000f5805bf43bb9dda152547e36181740ba8524980606400a8bd128c556dbf09ad641d4c634d513e714b2748639a4498
7
+ data.tar.gz: a9a95c538e9d88011507e5a12e64afb84b91fbee6a5b70e0d48f431a05496a0384347c2f6edc97ad3a3164f80677ff05e0b700d4a2c7ea08bce69d7e59ab8145
data/.rubocop_todo.yml CHANGED
@@ -57,8 +57,8 @@ Layout/EmptyLinesAroundBlockBody:
57
57
  Layout/EmptyLinesAroundClassBody:
58
58
  Exclude:
59
59
  - 'lib/evva/android_generator.rb'
60
- - 'lib/evva/mixpanel_enum.rb'
61
- - 'lib/evva/mixpanel_event.rb'
60
+ - 'lib/evva/analytics_enum.rb'
61
+ - 'lib/evva/analytics_event.rb'
62
62
 
63
63
  # Offense count: 1
64
64
  # Cop supports --auto-correct.
@@ -163,8 +163,8 @@ Layout/TrailingBlankLines:
163
163
  - 'lib/evva/enum_generator.rb'
164
164
  - 'lib/evva/event_generator.rb'
165
165
  - 'lib/evva/google_sheet.rb'
166
- - 'lib/evva/mixpanel_enum.rb'
167
- - 'lib/evva/mixpanel_event.rb'
166
+ - 'lib/evva/analytics_enum.rb'
167
+ - 'lib/evva/analytics_event.rb'
168
168
  - 'spec/lib/evva/enum_generator_spec.rb'
169
169
  - 'spec/lib/evva/event_generator_spec.rb'
170
170
  - 'spec/lib/evva/google_sheet_spec.rb'
@@ -226,8 +226,8 @@ Lint/UselessAssignment:
226
226
  # Offense count: 2
227
227
  Lint/Void:
228
228
  Exclude:
229
- - 'lib/evva/mixpanel_enum.rb'
230
- - 'lib/evva/mixpanel_event.rb'
229
+ - 'lib/evva/analytics_enum.rb'
230
+ - 'lib/evva/analytics_event.rb'
231
231
 
232
232
  # Offense count: 8
233
233
  Metrics/AbcSize:
@@ -309,8 +309,8 @@ Style/Documentation:
309
309
  - 'lib/evva/event_generator.rb'
310
310
  - 'lib/evva/google_sheet.rb'
311
311
  - 'lib/evva/logger.rb'
312
- - 'lib/evva/mixpanel_enum.rb'
313
- - 'lib/evva/mixpanel_event.rb'
312
+ - 'lib/evva/analytics_enum.rb'
313
+ - 'lib/evva/analytics_event.rb'
314
314
 
315
315
  # Offense count: 1
316
316
  # Cop supports --auto-correct.
@@ -407,8 +407,8 @@ Style/RaiseArgs:
407
407
  # Cop supports --auto-correct.
408
408
  Style/RedundantSelf:
409
409
  Exclude:
410
- - 'lib/evva/mixpanel_enum.rb'
411
- - 'lib/evva/mixpanel_event.rb'
410
+ - 'lib/evva/analytics_enum.rb'
411
+ - 'lib/evva/analytics_event.rb'
412
412
  - 'lib/evva/object_extension.rb'
413
413
 
414
414
  # Offense count: 1
data/Gemfile CHANGED
@@ -1,5 +1,4 @@
1
1
  source 'https://rubygems.org'
2
- ruby '2.7.3'
3
2
 
4
3
  gem 'colorize'
5
4
  gem 'safe_yaml'
data/Gemfile.lock CHANGED
@@ -1,8 +1,8 @@
1
1
  GEM
2
2
  remote: https://rubygems.org/
3
3
  specs:
4
- addressable (2.5.2)
5
- public_suffix (>= 2.0.2, < 4.0)
4
+ addressable (2.8.0)
5
+ public_suffix (>= 2.0.2, < 5.0)
6
6
  ast (2.3.0)
7
7
  colorize (0.8.1)
8
8
  crack (0.4.3)
@@ -15,7 +15,7 @@ GEM
15
15
  parser (2.4.0.0)
16
16
  ast (~> 2.2)
17
17
  powerpack (0.1.1)
18
- public_suffix (3.0.0)
18
+ public_suffix (4.0.6)
19
19
  rainbow (2.2.2)
20
20
  rake
21
21
  rake (12.3.3)
@@ -71,8 +71,5 @@ DEPENDENCIES
71
71
  simplecov-rcov
72
72
  webmock (~> 1.20)
73
73
 
74
- RUBY VERSION
75
- ruby 2.7.3p183
76
-
77
74
  BUNDLED WITH
78
75
  2.2.26
data/changelog.md CHANGED
@@ -1,6 +1,9 @@
1
1
  # Change Log
2
2
 
3
- ## [0.2.0] - 2021/08/30
3
+ ## [0.3.0] - 2021-12-16
4
+ - Revamp Android generator to generate events as classes instead of methods.
5
+
6
+ ## [0.2.0] - 2021-08-30
4
7
  - Google Spreadsheet option stopped working due to a change in the API. This version fixes that.
5
8
 
6
9
  Note: You'll need a new setup. View README.
@@ -32,6 +35,6 @@ Note: You'll need a new setup. View README.
32
35
  ## [0.1.1] - 2017-11-07
33
36
  - Fixes mismatch between file name and class name generated.
34
37
 
35
- ## [0.1.0] - 2017/10/26
38
+ ## [0.1.0] - 2017-10-26
36
39
  - Initial Release.
37
40
 
data/evva_config.yml CHANGED
@@ -8,7 +8,7 @@ data_source:
8
8
  enum_classes_url: https://path-to-csv
9
9
 
10
10
  out_path: analytics
11
- event_file_name: MixpanelAnalytics
12
- event_enum_file_name: MixpanelEvent
13
- people_file_name: MixpanelProperties
11
+ event_file_name: AnalyticsEvent
12
+ event_enum_file_name: AnalyticsEvents
13
+ people_file_name: AnalyticsProperties
14
14
  package_name: com.hole19golf.hole19.analytics
@@ -1,5 +1,5 @@
1
1
  module Evva
2
- class MixpanelEnum
2
+ class AnalyticsEnum
3
3
  attr_reader :enum_name, :values
4
4
  def initialize(enum_name, values)
5
5
  @enum_name = enum_name
@@ -1,5 +1,5 @@
1
1
  module Evva
2
- class MixpanelEvent
2
+ class AnalyticsEvent
3
3
  attr_reader :event_name, :properties
4
4
  def initialize(event_name, properties = {})
5
5
  @event_name = event_name
@@ -6,40 +6,31 @@ module Evva
6
6
  @package_name = package_name
7
7
  end
8
8
 
9
- IMPORT_EVENT = "import packagename.Event".freeze
10
- IMPORT_MASK = "import packagename.MixpanelAnalyticsMask".freeze
11
- IMPORT_JSON = "import org.json.JSONObject".freeze
12
-
13
9
  NATIVE_TYPES = %w[Long Int String Double Float Boolean].freeze
14
10
 
15
11
  def events(bundle, file_name)
16
- header_footer_wrapper([IMPORT_EVENT, IMPORT_MASK, IMPORT_JSON]) do
17
- """open class #{file_name}(private val mask: MixpanelAnalyticsMask) {
18
-
19
- #{bundle.map { |e| kotlin_function(e) }.join("\n\n")}
12
+ header_footer_wrapper do
13
+ """sealed class #{file_name}(event: AnalyticsEvents) {
14
+ \tval name = event.key
20
15
 
21
- \topen fun updateProperties(property: MixpanelProperties, value: Any) {
22
- \t\tmask.updateProperties(property.key, value)
23
- \t}
16
+ \topen val properties: Map<String, Any?>? = null
24
17
 
25
- \topen fun incrementCounter(property: MixpanelProperties) {
26
- \t\tmask.incrementCounter(property.key)
27
- \t}
18
+ #{bundle.map { |e| event_class(e, file_name) }.join("\n\n")}
28
19
  }"""
29
20
  end
30
21
  end
31
22
 
32
23
  def people_properties(people_bundle, file_name)
33
24
  header_footer_wrapper do
34
- body = "enum class MixpanelProperties(val key: String) {\n"
25
+ body = "enum class #{file_name}(val key: String) {\n"
35
26
  body << people_bundle.map { |prop| "\t#{prop.upcase}(\"#{prop}\")" }.join(",\n")
36
27
  body << ";\n}"
37
28
  end
38
29
  end
39
30
 
40
31
  def event_enum(bundle, file_name)
41
- header_footer_wrapper([IMPORT_EVENT]) do
42
- body = "enum class #{file_name}(override val key: String) : Event {\n"
32
+ header_footer_wrapper do
33
+ body = "enum class #{file_name}(val key: String) {\n"
43
34
  body << bundle.map(&:event_name).map { |prop| "\t#{prop.upcase}(\"#{prop}\")" }.join(",\n")
44
35
  body << ";\n}"
45
36
  end
@@ -75,45 +66,47 @@ package #{@package_name}
75
66
  Kotlin
76
67
  end
77
68
 
78
- def kotlin_function(event_data)
79
- function_name = 'track' + titleize(event_data.event_name)
80
- function_arguments = event_data.properties.map { |name, type| "#{name}: #{type}" }.join(', ')
81
- if !function_arguments.empty?
82
- props = json_props(event_data.properties)
83
- """\topen fun #{function_name}(#{function_arguments}) {
69
+ def event_class(event_data, superclass_name)
70
+ class_name = camelize(event_data.event_name)
71
+ class_arguments = event_data.properties.map { |name, type| "val #{camelize(name, false)}: #{type}" }.join(', ')
72
+ if !class_arguments.empty?
73
+ props = props_map(event_data.properties)
74
+
75
+ """\tdata class #{class_name}(
76
+ \t\t#{class_arguments}
77
+ \t) : #{superclass_name}(AnalyticsEvents.#{event_data.event_name.upcase}) {
84
78
  #{props}
85
- \t\tmask.trackEvent(MixpanelEvent.#{event_data.event_name.upcase}, properties)
86
79
  \t}"""
87
80
 
88
81
  else
89
- """\topen fun #{function_name}() {
90
- \t\tmask.trackEvent(MixpanelEvent.#{event_data.event_name.upcase})
91
- \t}"""
82
+ """\tobject #{class_name} : #{superclass_name}(AnalyticsEvents.#{event_data.event_name.upcase})"""
92
83
  end
93
84
  end
94
85
 
95
- def json_props(properties)
86
+ def props_map(properties)
96
87
  split_properties =
97
88
  properties
98
- .map do |name, type|
89
+ .map.with_index do |data, index|
90
+ name, type = data
91
+ prop = "\t\t\t\"#{name}\" to #{camelize(name, false)}"
92
+
99
93
  if special_property?(type)
100
94
  if optional_property?(type)
101
- "#{name}?.let { put(\"#{name}\", it.key) }"
102
- else
103
- "put(\"#{name}\", #{name}.key)"
104
- end
105
- else
106
- if optional_property?(type)
107
- "#{name}?.let { put(\"#{name}\", it) }"
108
- else
109
- "put(\"#{name}\", #{name})"
95
+ prop = "#{prop}?"
110
96
  end
97
+ prop = "#{prop}.key"
98
+ end
99
+
100
+ if index < properties.size - 1
101
+ # add list comma to every property except the last one
102
+ prop = "#{prop},"
111
103
  end
104
+
105
+ prop
112
106
  end
113
- .map { |line| "\t\t\t#{line}" }
114
107
  .join("\n")
115
108
 
116
- "\t\tval properties = JSONObject().apply {\n#{split_properties}\n\t\t}"
109
+ "\t\toverride val properties = mapOf(\n#{split_properties}\n\t\t)"
117
110
  end
118
111
 
119
112
  def special_property?(type)
@@ -124,8 +117,15 @@ Kotlin
124
117
  type.include?('?')
125
118
  end
126
119
 
127
- def titleize(str)
128
- str.split('_').collect(&:capitalize).join
120
+ # extracted from Rails' ActiveSupport
121
+ def camelize(string, uppercase_first_letter = true)
122
+ string = string.to_s
123
+ if uppercase_first_letter
124
+ string = string.sub(/^[a-z\d]*/) { |match| match.capitalize }
125
+ else
126
+ string = string.sub(/^(?:(?=\b|[A-Z_])|\w)/) { |match| match.downcase }
127
+ end
128
+ string.gsub(/(?:_|(\/))([a-z\d]*)/) { "#{$1}#{$2.capitalize}" }.gsub("/", "::")
129
129
  end
130
130
  end
131
131
  end
@@ -17,7 +17,7 @@ module Evva
17
17
  csv.each do |row|
18
18
  event_name = row['Event Name']
19
19
  properties = hash_parser(row['Event Properties'])
20
- event_list << Evva::MixpanelEvent.new(event_name, properties)
20
+ event_list << Evva::AnalyticsEvent.new(event_name, properties)
21
21
  end
22
22
  event_list
23
23
  end
@@ -42,7 +42,7 @@ module Evva
42
42
  csv.each do |row|
43
43
  enum_name = row['Enum Name']
44
44
  values = row['Possible Values'].split(',')
45
- enum_list << Evva::MixpanelEnum.new(enum_name, values)
45
+ enum_list << Evva::AnalyticsEnum.new(enum_name, values)
46
46
  end
47
47
  enum_list
48
48
  end
data/lib/evva/version.rb CHANGED
@@ -1,4 +1,4 @@
1
1
  module Evva
2
- VERSION = '0.2.0'.freeze
3
- VERSION_UPDATED_AT = '2021-08-30'.freeze
2
+ VERSION = '0.3.0'.freeze
3
+ VERSION_UPDATED_AT = '2021-12-16'.freeze
4
4
  end
data/lib/evva.rb CHANGED
@@ -5,8 +5,8 @@ require 'evva/logger'
5
5
  require 'evva/google_sheet'
6
6
  require 'evva/config'
7
7
  require 'evva/file_reader'
8
- require 'evva/mixpanel_event'
9
- require 'evva/mixpanel_enum'
8
+ require 'evva/analytics_event'
9
+ require 'evva/analytics_enum'
10
10
  require 'evva/object_extension'
11
11
  require 'evva/version'
12
12
  require 'evva/android_generator'
data/spec/evva_spec.rb CHANGED
@@ -7,7 +7,7 @@ describe Evva do
7
7
  before do
8
8
  allow_any_instance_of(Evva::FileReader).to receive(:open_file).and_return(file)
9
9
  allow_any_instance_of(Evva::GoogleSheet).to receive(:events).and_return(
10
- [Evva::MixpanelEvent.new('trackEvent',[])])
10
+ [Evva::AnalyticsEvent.new('trackEvent',[])])
11
11
 
12
12
  allow_any_instance_of(Evva::GoogleSheet).to receive(:people_properties).and_return([])
13
13
  allow_any_instance_of(Evva::GoogleSheet).to receive(:enum_classes).and_return([])
@@ -7,7 +7,7 @@ data_source:
7
7
  enum_classes_url: https://path-to-csv
8
8
 
9
9
  out_path: analytics
10
- event_file_name: MixpanelAnalytics
11
- event_enum_file_name: MixpanelEvent
12
- people_file_name: MixpanelProperties
10
+ event_file_name: AnalyticsEvent
11
+ event_enum_file_name: AnalyticsEvents
12
+ people_file_name: AnalyticsProperties
13
13
  package_name: com.package.name.analytics
@@ -2,74 +2,67 @@ describe Evva::AndroidGenerator do
2
2
  let(:generator) { described_class.new("com.hole19golf.hole19.analytics") }
3
3
 
4
4
  describe '#events' do
5
- subject { generator.events(events, "MixpanelAnalytics") }
5
+ subject { generator.events(events, "AnalyticsEvent") }
6
6
 
7
7
  let(:events) { [
8
- Evva::MixpanelEvent.new('cp_page_view'),
9
- Evva::MixpanelEvent.new('cp_page_view_a', { course_id: 'Long', course_name: 'String' }),
10
- Evva::MixpanelEvent.new('cp_page_view_b', { course_id: 'Long', course_name: 'String', from_screen: 'CourseProfileSource' }),
11
- Evva::MixpanelEvent.new('cp_page_view_c', { course_id: 'Long', course_name: 'String', from_screen: 'CourseProfileSource?' }),
12
- Evva::MixpanelEvent.new('cp_page_view_d', { course_id: 'Long?', course_name: 'String' })
8
+ Evva::AnalyticsEvent.new('cp_page_view'),
9
+ Evva::AnalyticsEvent.new('cp_page_view_a', { course_id: 'Long', course_name: 'String' }),
10
+ Evva::AnalyticsEvent.new('cp_page_view_b', { course_id: 'Long', course_name: 'String', from_screen: 'CourseProfileSource' }),
11
+ Evva::AnalyticsEvent.new('cp_page_view_c', { course_id: 'Long', course_name: 'String', from_screen: 'CourseProfileSource?' }),
12
+ Evva::AnalyticsEvent.new('cp_page_view_d', { course_id: 'Long?', course_name: 'String' })
13
13
  ] }
14
14
 
15
15
  let(:expected) {
16
16
  <<-Kotlin
17
17
  package com.hole19golf.hole19.analytics
18
18
 
19
- import com.hole19golf.hole19.analytics.Event
20
- import com.hole19golf.hole19.analytics.MixpanelAnalyticsMask
21
- import org.json.JSONObject
22
-
23
19
  /**
24
20
  * This file was automatically generated by evva: https://github.com/hole19/evva
25
21
  */
26
22
 
27
- open class MixpanelAnalytics(private val mask: MixpanelAnalyticsMask) {
28
-
29
- open fun trackCpPageView() {
30
- mask.trackEvent(MixpanelEvent.CP_PAGE_VIEW)
31
- }
23
+ sealed class AnalyticsEvent(event: AnalyticsEvents) {
24
+ val name = event.key
32
25
 
33
- open fun trackCpPageViewA(course_id: Long, course_name: String) {
34
- val properties = JSONObject().apply {
35
- put("course_id", course_id)
36
- put("course_name", course_name)
37
- }
38
- mask.trackEvent(MixpanelEvent.CP_PAGE_VIEW_A, properties)
39
- }
26
+ open val properties: Map<String, Any?>? = null
40
27
 
41
- open fun trackCpPageViewB(course_id: Long, course_name: String, from_screen: CourseProfileSource) {
42
- val properties = JSONObject().apply {
43
- put("course_id", course_id)
44
- put("course_name", course_name)
45
- put("from_screen", from_screen.key)
46
- }
47
- mask.trackEvent(MixpanelEvent.CP_PAGE_VIEW_B, properties)
48
- }
28
+ object CpPageView : AnalyticsEvent(AnalyticsEvents.CP_PAGE_VIEW)
49
29
 
50
- open fun trackCpPageViewC(course_id: Long, course_name: String, from_screen: CourseProfileSource?) {
51
- val properties = JSONObject().apply {
52
- put("course_id", course_id)
53
- put("course_name", course_name)
54
- from_screen?.let { put("from_screen", it.key) }
55
- }
56
- mask.trackEvent(MixpanelEvent.CP_PAGE_VIEW_C, properties)
30
+ data class CpPageViewA(
31
+ val courseId: Long, val courseName: String
32
+ ) : AnalyticsEvent(AnalyticsEvents.CP_PAGE_VIEW_A) {
33
+ override val properties = mapOf(
34
+ "course_id" to courseId,
35
+ "course_name" to courseName
36
+ )
57
37
  }
58
38
 
59
- open fun trackCpPageViewD(course_id: Long?, course_name: String) {
60
- val properties = JSONObject().apply {
61
- course_id?.let { put("course_id", it) }
62
- put("course_name", course_name)
63
- }
64
- mask.trackEvent(MixpanelEvent.CP_PAGE_VIEW_D, properties)
39
+ data class CpPageViewB(
40
+ val courseId: Long, val courseName: String, val fromScreen: CourseProfileSource
41
+ ) : AnalyticsEvent(AnalyticsEvents.CP_PAGE_VIEW_B) {
42
+ override val properties = mapOf(
43
+ "course_id" to courseId,
44
+ "course_name" to courseName,
45
+ "from_screen" to fromScreen.key
46
+ )
65
47
  }
66
48
 
67
- open fun updateProperties(property: MixpanelProperties, value: Any) {
68
- mask.updateProperties(property.key, value)
49
+ data class CpPageViewC(
50
+ val courseId: Long, val courseName: String, val fromScreen: CourseProfileSource?
51
+ ) : AnalyticsEvent(AnalyticsEvents.CP_PAGE_VIEW_C) {
52
+ override val properties = mapOf(
53
+ "course_id" to courseId,
54
+ "course_name" to courseName,
55
+ "from_screen" to fromScreen?.key
56
+ )
69
57
  }
70
58
 
71
- open fun incrementCounter(property: MixpanelProperties) {
72
- mask.incrementCounter(property.key)
59
+ data class CpPageViewD(
60
+ val courseId: Long?, val courseName: String
61
+ ) : AnalyticsEvent(AnalyticsEvents.CP_PAGE_VIEW_D) {
62
+ override val properties = mapOf(
63
+ "course_id" to courseId,
64
+ "course_name" to courseName
65
+ )
73
66
  }
74
67
  }
75
68
  Kotlin
@@ -81,8 +74,8 @@ Kotlin
81
74
  describe '#special_property_enums' do
82
75
  subject { generator.special_property_enums(enums) }
83
76
  let(:enums) { [
84
- Evva::MixpanelEnum.new('CourseProfileSource', ['course_discovery', 'synced_courses']),
85
- Evva::MixpanelEnum.new('PremiumFrom', ['Course Profile', 'Round Setup'])
77
+ Evva::AnalyticsEnum.new('CourseProfileSource', ['course_discovery', 'synced_courses']),
78
+ Evva::AnalyticsEnum.new('PremiumFrom', ['Course Profile', 'Round Setup'])
86
79
  ] }
87
80
  let(:expected) {
88
81
  <<-Kotlin
@@ -107,22 +100,20 @@ Kotlin
107
100
  end
108
101
 
109
102
  describe '#event_enum' do
110
- subject { generator.event_enum(event_bundle, 'MixpanelEvent') }
103
+ subject { generator.event_enum(event_bundle, 'AnalyticsEvents') }
111
104
  let(:event_bundle) { [
112
- Evva::MixpanelEvent.new('nav_feed_tap', {}),
113
- Evva::MixpanelEvent.new('nav_performance_tap', {})
105
+ Evva::AnalyticsEvent.new('nav_feed_tap', {}),
106
+ Evva::AnalyticsEvent.new('nav_performance_tap', {})
114
107
  ] }
115
108
  let(:expected) {
116
109
  <<-Kotlin
117
110
  package com.hole19golf.hole19.analytics
118
111
 
119
- import com.hole19golf.hole19.analytics.Event
120
-
121
112
  /**
122
113
  * This file was automatically generated by evva: https://github.com/hole19/evva
123
114
  */
124
115
 
125
- enum class MixpanelEvent(override val key: String) : Event {
116
+ enum class AnalyticsEvents(val key: String) {
126
117
  NAV_FEED_TAP("nav_feed_tap"),
127
118
  NAV_PERFORMANCE_TAP("nav_performance_tap");
128
119
  }
@@ -132,7 +123,7 @@ Kotlin
132
123
  end
133
124
 
134
125
  describe '#people_properties' do
135
- subject { generator.people_properties(people_bundle, 'MixpanelProperties') }
126
+ subject { generator.people_properties(people_bundle, 'AnalyticsProperties') }
136
127
  let(:people_bundle) { ['rounds_with_wear', 'friends_from_facebook'] }
137
128
  let(:expected) {
138
129
  <<-Kotlin
@@ -142,7 +133,7 @@ package com.hole19golf.hole19.analytics
142
133
  * This file was automatically generated by evva: https://github.com/hole19/evva
143
134
  */
144
135
 
145
- enum class MixpanelProperties(val key: String) {
136
+ enum class AnalyticsProperties(val key: String) {
146
137
  ROUNDS_WITH_WEAR("rounds_with_wear"),
147
138
  FRIENDS_FROM_FACEBOOK("friends_from_facebook");
148
139
  }
@@ -22,9 +22,9 @@ describe Evva::GoogleSheet do
22
22
  end
23
23
 
24
24
  it 'returns an array with the corresponding events' do
25
- expected = [Evva::MixpanelEvent.new('cp_page_view', { course_id: 'Long', course_name: 'String' }),
26
- Evva::MixpanelEvent.new('nav_feed_tap', {}),
27
- Evva::MixpanelEvent.new('cp_view_scorecard', { course_id: 'Long', course_name: 'String' })]
25
+ expected = [Evva::AnalyticsEvent.new('cp_page_view', { course_id: 'Long', course_name: 'String' }),
26
+ Evva::AnalyticsEvent.new('nav_feed_tap', {}),
27
+ Evva::AnalyticsEvent.new('cp_view_scorecard', { course_id: 'Long', course_name: 'String' })]
28
28
  expect(events).to eq(expected)
29
29
  end
30
30
 
@@ -69,8 +69,8 @@ describe Evva::GoogleSheet do
69
69
 
70
70
  it 'returns an array with the corresponding events' do
71
71
  expect(enum_classes).to eq [
72
- Evva::MixpanelEnum.new('PageViewSourceScreen', ['course_discovery','synced_courses','nearby','deal']),
73
- Evva::MixpanelEnum.new('PremiumClickBuy', ['notes','hi_res_maps','whatever'])
72
+ Evva::AnalyticsEnum.new('PageViewSourceScreen', ['course_discovery','synced_courses','nearby','deal']),
73
+ Evva::AnalyticsEnum.new('PremiumClickBuy', ['notes','hi_res_maps','whatever'])
74
74
  ]
75
75
  end
76
76
  end
@@ -5,11 +5,11 @@ describe Evva::SwiftGenerator do
5
5
  subject { generator.events(event_bundle, "") }
6
6
 
7
7
  let(:event_bundle) { [
8
- Evva::MixpanelEvent.new('cp_page_view'),
9
- Evva::MixpanelEvent.new('cp_page_view_a', { course_id: 'Long', course_name: 'String' }),
10
- Evva::MixpanelEvent.new('cp_page_view_b', { course_id: 'Long', course_name: 'String', from_screen: 'CourseProfileSource' }),
11
- Evva::MixpanelEvent.new('cp_page_view_c', { course_id: 'Long', course_name: 'String', from_screen: 'CourseProfileSource?' }),
12
- Evva::MixpanelEvent.new('cp_page_view_d', { course_id: 'Long?', course_name: 'String' })
8
+ Evva::AnalyticsEvent.new('cp_page_view'),
9
+ Evva::AnalyticsEvent.new('cp_page_view_a', { course_id: 'Long', course_name: 'String' }),
10
+ Evva::AnalyticsEvent.new('cp_page_view_b', { course_id: 'Long', course_name: 'String', from_screen: 'CourseProfileSource' }),
11
+ Evva::AnalyticsEvent.new('cp_page_view_c', { course_id: 'Long', course_name: 'String', from_screen: 'CourseProfileSource?' }),
12
+ Evva::AnalyticsEvent.new('cp_page_view_d', { course_id: 'Long?', course_name: 'String' })
13
13
  ] }
14
14
 
15
15
  let(:expected) {
@@ -71,8 +71,8 @@ Swift
71
71
  subject { generator.special_property_enums(enums) }
72
72
 
73
73
  let(:enums) { [
74
- Evva::MixpanelEnum.new('CourseProfileSource', ['course_discovery', 'synced_courses']),
75
- Evva::MixpanelEnum.new('PremiumFrom', ['Course Profile', 'Round Setup'])
74
+ Evva::AnalyticsEnum.new('CourseProfileSource', ['course_discovery', 'synced_courses']),
75
+ Evva::AnalyticsEnum.new('PremiumFrom', ['Course Profile', 'Round Setup'])
76
76
  ] }
77
77
 
78
78
  let(:expected) {
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: evva
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - RicardoTrindade
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-08-30 00:00:00.000000000 Z
11
+ date: 2021-12-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: safe_yaml
@@ -48,7 +48,6 @@ files:
48
48
  - ".gitignore"
49
49
  - ".rspec"
50
50
  - ".rubocop_todo.yml"
51
- - ".ruby-version"
52
51
  - ".travis.yml"
53
52
  - Gemfile
54
53
  - Gemfile.lock
@@ -59,13 +58,13 @@ files:
59
58
  - evva.gemspec
60
59
  - evva_config.yml
61
60
  - lib/evva.rb
61
+ - lib/evva/analytics_enum.rb
62
+ - lib/evva/analytics_event.rb
62
63
  - lib/evva/android_generator.rb
63
64
  - lib/evva/config.rb
64
65
  - lib/evva/file_reader.rb
65
66
  - lib/evva/google_sheet.rb
66
67
  - lib/evva/logger.rb
67
- - lib/evva/mixpanel_enum.rb
68
- - lib/evva/mixpanel_event.rb
69
68
  - lib/evva/object_extension.rb
70
69
  - lib/evva/swift_generator.rb
71
70
  - lib/evva/version.rb
data/.ruby-version DELETED
@@ -1 +0,0 @@
1
- 2.7.3