remark_analytics 1.0.10 → 1.0.11

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: a93f81bd4de03fb157ed4caf958bd7e7e9c834e3e8d6b6c7377eb23ffa307bbf
4
- data.tar.gz: 96ebad6900b389e3a19e7d9f7eb28cc360109866b23028977e1010252e52bc7a
3
+ metadata.gz: '058b54841fb2844dbb60f1625d2bd10fe7a550c8f05f72c309ba1a1fcf05b121'
4
+ data.tar.gz: 657290674e13f42ee59a1c3a592ad0b8827624dbdbe722effcb8b501f45fec76
5
5
  SHA512:
6
- metadata.gz: 34c579a374d352ff88ac3605c3a5066764afad3bc66b0eae52bb7932f774f72e430bdbed699a7f95cc9152c6b0e33aeee8a720dc269dc8b7ad833d0c64536351
7
- data.tar.gz: 1fc4674e38ddc7243b75eff509b0b2eefc9b0c1d034b08a9914e9a9f64e745abba96ba4c19e839dc9b799ef6ba77def1efb6f182bc9388fe047152d89a7c8c8c
6
+ metadata.gz: 74e3a8a05adfdb301290ff1995ad76ffcbc44a1c65afc5f792f3ad02a0396eb3a11e7d599a4a1d79b7d8d67cecafbbdc9882376085c660594ee96f374b943176
7
+ data.tar.gz: a1d57cb885a7144c842f1c1b2a7c893ad5d5991893310c1753cd2ff394db1bb6c1f586a0ea2447138805de95d27df2208a4707a84ec7b8776b9a2de8b76de701
@@ -15,12 +15,18 @@ module RemarkAnalytics
15
15
  result[:resource_type] = event_parameters[:resource_type].presence
16
16
  result[:resource_id] = event_parameters[:resource_id].presence
17
17
  result[:data] = event_parameters[:data].presence || {}
18
- result[:application_version] = event_parameters[:application_version].presence ||
19
- RemarkAnalytics::VERSION
18
+ result[:application_version] =
19
+ event_parameters[:application_version].presence || RemarkAnalytics::VERSION
20
20
  result[:occured_at] = event_parameters[:occured_at].presence || Time.zone.now
21
21
  result[:tenant_name] = event_parameters[:tenant_name].presence ||
22
- Rails.application.secrets.try(:REMARK_ANALYTICS_TENANT_NAME) ||
23
- Object.const_defined?("VP_SETTINGS") ? VP_SETTINGS[:tenant] : nil
22
+ Rails.application.secrets.try(:REMARK_ANALYTICS_TENANT_NAME)
23
+
24
+ if result[:tenant_name].blank? && Object.const_defined?('VP_SETTINGS')
25
+ result[:tenant_name] = VP_SETTINGS[:tenant]
26
+ end
27
+ if result[:tenant_name].blank? && class_exists?('Admin::Setting')
28
+ result[:tenant_name] = Admin::Setting.all[:tenant]
29
+ end
24
30
 
25
31
  # validate params at the other side (analytics api endoint)
26
32
  result
@@ -38,5 +44,12 @@ module RemarkAnalytics
38
44
 
39
45
  RemarkAnalytics::Jobs::PostEventJob.perform_later(event_params)
40
46
  end
47
+
48
+ def class_exists?(class_name)
49
+ klass = Module.const_get(class_name)
50
+ klass.is_a?(Class)
51
+ rescue NameError
52
+ false
53
+ end
41
54
  end
42
55
  end
@@ -1,3 +1,3 @@
1
1
  module RemarkAnalytics
2
- VERSION = '1.0.10'.freeze
2
+ VERSION = '1.0.11'.freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: remark_analytics
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.10
4
+ version: 1.0.11
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nick Rockx
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-09-30 00:00:00.000000000 Z
11
+ date: 2023-04-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday
@@ -65,7 +65,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
65
65
  - !ruby/object:Gem::Version
66
66
  version: '0'
67
67
  requirements: []
68
- rubygems_version: 3.2.33
68
+ rubygems_version: 3.3.16
69
69
  signing_key:
70
70
  specification_version: 4
71
71
  summary: Gem to fire events to ReMark Analytics API from a client application