evva 0.4.0 → 0.4.1

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: f74dbff0766dc7623ca1ac518e7636172440511a4470398d594fefef8364fba9
4
- data.tar.gz: 4793e14af612e48d0e7cf85aa313d5c6c4f92c5eb440be7a853503f39fd093e6
3
+ metadata.gz: f4038f23c86f1051786de3a9a9407a9b9656fc6b449d2e1f62be66f0081fa054
4
+ data.tar.gz: 6fc90e80a8a4ac97d935df0fa90cc410d582270845f8a7083081f85bf5069b93
5
5
  SHA512:
6
- metadata.gz: ebbee6abfa8abd7e6717f20246a1271a7d7b35e4b9a42414293ff436cff842e82ac45beb7638dc642cdb00c1408f7c81cb4b8dcfdd7d4ee6dafa04f121388b5a
7
- data.tar.gz: 18c42c24f8f2b7d923c9a99b5ec58a43d258340b2523fdb4bf8f136bb0d4d9a075f3497b4c0c8a8176c4e01b07db56f116066b1139389104497db86e6ed9e30b
6
+ metadata.gz: 87a050829faed5ec1792fcca19e064adb17009ddcdf0b19366cab4aedc251816363665d5577cbe8e5c0e9206e30b8eaafb06546b5fdc72adc3243db90cde9d1e
7
+ data.tar.gz: ca0d51be95a1f5f0dd4e3e6a224dfb5aa734258be9a1b5e8b1d45386d87174d473268ceec6973147b47aa9ef726d9d8c246a7941365f753d606d9d24769c66da
data/changelog.md CHANGED
@@ -1,5 +1,8 @@
1
1
  # Change Log
2
2
 
3
+ ## [0.4.1] - 2021-12-23
4
+ - Changes swift implementation so that destinations belong to EventType/PropertyType instead of Event/Property
5
+
3
6
  ## [0.4.0] - 2021-12-21
4
7
  - Adds type to people properties
5
8
  - Adds a list of destinations to events and people properties
@@ -9,15 +9,25 @@ struct EventData {
9
9
  self.destinations = destinations
10
10
  }
11
11
 
12
- init(name: EventName, properties: [String: Any]?, destinations: [Destination]) {
13
- self.init(name: name.rawValue, properties: properties, destinations: destinations)
12
+ init(type: EventType, properties: [String: Any]?) {
13
+ self.init(name: type.name, properties: properties, destinations: type.destinations)
14
14
  }
15
15
  }
16
16
 
17
- enum EventName: String {
17
+ enum EventType: String {
18
18
  <%- events.each do |e| -%>
19
19
  case <%= e[:case_name] %> = "<%= e[:event_name] %>"
20
20
  <%- end -%>
21
+
22
+ var name: String { return rawValue }
23
+
24
+ var destinations: [Destination] {
25
+ switch self {
26
+ <%- events.each do |e| -%>
27
+ case .<%= e[:case_name] %>: return [<%= e[:destinations].map { |d| ".#{d}" }.join(", ") %>]
28
+ <%- end -%>
29
+ }
30
+ }
21
31
  }
22
32
 
23
33
  enum Event {
@@ -37,22 +47,13 @@ enum Event {
37
47
  <%- else -%>
38
48
  case let .<%= e[:case_name] %>(<%= e[:properties].map { |p| p[:name] }.join(", ") %>):
39
49
  <%- end -%>
40
- return EventData(name: .<%= e[:case_name] %>,
50
+ return EventData(type: .<%= e[:case_name] %>,
41
51
  <%- if e[:properties].count == 0 -%>
42
- properties: nil,
52
+ properties: nil)
43
53
  <%- else -%>
44
54
  properties: [
45
55
  <%- e[:properties].each do |p| -%>
46
56
  "<%= p[:name] %>": <%= p[:value] %> as Any,
47
- <%- end -%>
48
- ],
49
- <%- end -%>
50
- <%- if e[:destinations].count == 0 -%>
51
- destinations: [])
52
- <%- else -%>
53
- destinations: [
54
- <%- e[:destinations].each do |d| -%>
55
- .<%= d %>,
56
57
  <%- end -%>
57
58
  ])
58
59
  <%- end -%>
@@ -9,15 +9,25 @@ struct PropertyData {
9
9
  self.destinations = destinations
10
10
  }
11
11
 
12
- init(name: PropertyName, value: Any, destinations: [Destination]) {
13
- self.init(name: name.rawValue, value: value, destinations: destinations)
12
+ init(type: PropertyType, value: Any) {
13
+ self.init(name: type.name, value: value, destinations: type.destinations)
14
14
  }
15
15
  }
16
16
 
17
- enum PropertyName: String {
17
+ enum PropertyType: String {
18
18
  <%- properties.each do |p| -%>
19
19
  case <%= p[:case_name] %> = "<%= p[:property_name ] %>"
20
20
  <%- end -%>
21
+
22
+ var name: String { return rawValue }
23
+
24
+ var destinations: [Destination] {
25
+ switch self {
26
+ <%- properties.each_with_index do |p, index| -%>
27
+ case .<%= p[:case_name] %>: return [<%= p[:destinations].map { |d| ".#{d}" }.join(", ") %>]
28
+ <%- end -%>
29
+ }
30
+ }
21
31
  }
22
32
 
23
33
  enum Property {
@@ -29,17 +39,8 @@ enum Property {
29
39
  switch self {
30
40
  <%- properties.each_with_index do |p, index| -%>
31
41
  case let .<%= p[:case_name] %>(value):
32
- return PropertyData(name: .<%= p[:case_name] %>,
33
- value: value<% if p[:is_special_property] %>.rawValue<% end %>,
34
- <%- if p[:destinations].count == 0 -%>
35
- destinations: [])
36
- <%- else -%>
37
- destinations: [
38
- <%- p[:destinations].each do |d| -%>
39
- .<%= d %>,
40
- <%- end -%>
41
- ])
42
- <%- end -%>
42
+ return PropertyData(type: .<%= p[:case_name] %>,
43
+ value: value<% if p[:is_special_property] %>.rawValue<% end %>)
43
44
  <%- unless index == properties.count - 1 -%>
44
45
 
45
46
  <%- end -%>
data/lib/evva/version.rb CHANGED
@@ -1,4 +1,4 @@
1
1
  module Evva
2
- VERSION = '0.4.0'.freeze
3
- VERSION_UPDATED_AT = '2021-12-21'.freeze
2
+ VERSION = '0.4.1'.freeze
3
+ VERSION_UPDATED_AT = '2021-12-23'.freeze
4
4
  end
@@ -30,17 +30,29 @@ extension Analytics {
30
30
  self.destinations = destinations
31
31
  }
32
32
 
33
- init(name: EventName, properties: [String: Any]?, destinations: [Destination]) {
34
- self.init(name: name.rawValue, properties: properties, destinations: destinations)
33
+ init(type: EventType, properties: [String: Any]?) {
34
+ self.init(name: type.name, properties: properties, destinations: type.destinations)
35
35
  }
36
36
  }
37
37
 
38
- enum EventName: String {
38
+ enum EventType: String {
39
39
  case cpPageView = "cp_page_view"
40
40
  case cpPageViewA = "cp_page_view_a"
41
41
  case cpPageViewB = "cp_page_view_b"
42
42
  case cpPageViewC = "cp_page_view_c"
43
43
  case cpPageViewD = "cp_page_view_d"
44
+
45
+ var name: String { return rawValue }
46
+
47
+ var destinations: [Destination] {
48
+ switch self {
49
+ case .cpPageView: return [.firebase]
50
+ case .cpPageViewA: return [.firebase, .customDestination]
51
+ case .cpPageViewB: return []
52
+ case .cpPageViewC: return []
53
+ case .cpPageViewD: return []
54
+ }
55
+ }
44
56
  }
45
57
 
46
58
  enum Event {
@@ -53,48 +65,38 @@ extension Analytics {
53
65
  var data: EventData {
54
66
  switch self {
55
67
  case .cpPageView:
56
- return EventData(name: .cpPageView,
57
- properties: nil,
58
- destinations: [
59
- .firebase,
60
- ])
68
+ return EventData(type: .cpPageView,
69
+ properties: nil)
61
70
 
62
71
  case let .cpPageViewA(course_id, course_name):
63
- return EventData(name: .cpPageViewA,
72
+ return EventData(type: .cpPageViewA,
64
73
  properties: [
65
74
  "course_id": course_id as Any,
66
75
  "course_name": course_name as Any,
67
- ],
68
- destinations: [
69
- .firebase,
70
- .customDestination,
71
76
  ])
72
77
 
73
78
  case let .cpPageViewB(course_id, course_name, from_screen):
74
- return EventData(name: .cpPageViewB,
79
+ return EventData(type: .cpPageViewB,
75
80
  properties: [
76
81
  "course_id": course_id as Any,
77
82
  "course_name": course_name as Any,
78
83
  "from_screen": from_screen.rawValue as Any,
79
- ],
80
- destinations: [])
84
+ ])
81
85
 
82
86
  case let .cpPageViewC(course_id, course_name, from_screen):
83
- return EventData(name: .cpPageViewC,
87
+ return EventData(type: .cpPageViewC,
84
88
  properties: [
85
89
  "course_id": course_id as Any,
86
90
  "course_name": course_name as Any,
87
91
  "from_screen": from_screen?.rawValue as Any,
88
- ],
89
- destinations: [])
92
+ ])
90
93
 
91
94
  case let .cpPageViewD(course_id, course_name):
92
- return EventData(name: .cpPageViewD,
95
+ return EventData(type: .cpPageViewD,
93
96
  properties: [
94
97
  "course_id": course_id as Any,
95
98
  "course_name": course_name as Any,
96
- ],
97
- destinations: [])
99
+ ])
98
100
  }
99
101
  }
100
102
  }
@@ -163,15 +165,25 @@ extension Analytics {
163
165
  self.destinations = destinations
164
166
  }
165
167
 
166
- init(name: PropertyName, value: Any, destinations: [Destination]) {
167
- self.init(name: name.rawValue, value: value, destinations: destinations)
168
+ init(type: PropertyType, value: Any) {
169
+ self.init(name: type.name, value: value, destinations: type.destinations)
168
170
  }
169
171
  }
170
172
 
171
- enum PropertyName: String {
173
+ enum PropertyType: String {
172
174
  case roundsWithWear = "rounds_with_wear"
173
175
  case wearPlatform = "wear_platform"
174
176
  case numberOfTimesItHappened = "number_of_times_it_happened"
177
+
178
+ var name: String { return rawValue }
179
+
180
+ var destinations: [Destination] {
181
+ switch self {
182
+ case .roundsWithWear: return [.firebase]
183
+ case .wearPlatform: return [.firebase, .customDestination]
184
+ case .numberOfTimesItHappened: return []
185
+ }
186
+ }
175
187
  }
176
188
 
177
189
  enum Property {
@@ -182,24 +194,16 @@ extension Analytics {
182
194
  var data: PropertyData {
183
195
  switch self {
184
196
  case let .roundsWithWear(value):
185
- return PropertyData(name: .roundsWithWear,
186
- value: value,
187
- destinations: [
188
- .firebase,
189
- ])
197
+ return PropertyData(type: .roundsWithWear,
198
+ value: value)
190
199
 
191
200
  case let .wearPlatform(value):
192
- return PropertyData(name: .wearPlatform,
193
- value: value.rawValue,
194
- destinations: [
195
- .firebase,
196
- .customDestination,
197
- ])
201
+ return PropertyData(type: .wearPlatform,
202
+ value: value.rawValue)
198
203
 
199
204
  case let .numberOfTimesItHappened(value):
200
- return PropertyData(name: .numberOfTimesItHappened,
201
- value: value,
202
- destinations: [])
205
+ return PropertyData(type: .numberOfTimesItHappened,
206
+ value: value)
203
207
  }
204
208
  }
205
209
  }
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.4.0
4
+ version: 0.4.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - RicardoTrindade
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-12-21 00:00:00.000000000 Z
11
+ date: 2021-12-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: safe_yaml