rapidmango-events 0.0.1 → 0.0.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/VERSION +1 -1
- data/app/models/RPM/event.rb +9 -12
- data/doc/EVENT_CLIENT_README.rdoc +27 -0
- metadata +3 -2
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.0.
|
1
|
+
0.0.2
|
data/app/models/RPM/event.rb
CHANGED
@@ -1,6 +1,9 @@
|
|
1
1
|
module RPM
|
2
|
-
class Event
|
2
|
+
class Event < ActiveResource::Base
|
3
|
+
#self.site = Rails.env.cucumber? ? "/" : "http://localhost:3000/"
|
4
|
+
self.site = "http://localhost:3000/" # must have a local instance running..
|
3
5
|
|
6
|
+
# Store logged data in-memory and flush to the server manually using "commit" below
|
4
7
|
@@unsent_data = []
|
5
8
|
|
6
9
|
# Creates the event log but doesn't yet commit to the database. Example:
|
@@ -10,7 +13,7 @@ module RPM
|
|
10
13
|
# RPM::Event.log("signup", 199)
|
11
14
|
#
|
12
15
|
def self.log(key, value = nil, created_date = Date.today, created_hour = Time.now.hour)
|
13
|
-
@@unsent_data <<
|
16
|
+
@@unsent_data << {:key => key, :value => value, :created_date => created_date.to_s, :created_hour => created_hour}
|
14
17
|
# this could potentially contain logic to bump counts in order to send less data over the wire?
|
15
18
|
true
|
16
19
|
end
|
@@ -20,17 +23,11 @@ module RPM
|
|
20
23
|
# RPM::Event.commit => true
|
21
24
|
#
|
22
25
|
def self.commit
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
true
|
27
|
-
end
|
28
|
-
|
29
|
-
# Returns a simple array data structure of results
|
30
|
-
def self.query(*params)
|
31
|
-
::Event.all.collect(&:to_hash)
|
26
|
+
client_stub = self.new(:data => @@unsent_data)
|
27
|
+
@@unsent_data.clear if client_stub.save
|
28
|
+
[client_stub.status, client_stub.created_event_count]
|
32
29
|
end
|
33
30
|
|
34
31
|
end
|
35
32
|
|
36
|
-
end
|
33
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
=Rapid Mango Events
|
2
|
+
|
3
|
+
Events are intended as an easy way to store and report on any type of data.
|
4
|
+
|
5
|
+
==Quick Start
|
6
|
+
|
7
|
+
In your config/environment.rb:
|
8
|
+
|
9
|
+
config.gem "rpm-event_analytics"
|
10
|
+
|
11
|
+
In your config/rpm_events.yml (generated when you run 'rpm_events init'):
|
12
|
+
|
13
|
+
events_server: events.com
|
14
|
+
user: someone@yourcompany.com
|
15
|
+
key: <your_key>
|
16
|
+
|
17
|
+
In your ruby code:
|
18
|
+
|
19
|
+
RPM::Event.log("signup")
|
20
|
+
RPM::Event.commit
|
21
|
+
|
22
|
+
(refer to )
|
23
|
+
|
24
|
+
module RPM
|
25
|
+
class Event < ActiveResource::Base
|
26
|
+
#self.site = Rails.env.cucumber? ? "/" : "http://localhost:3000/"
|
27
|
+
self.site = "http://localhost:3000/" # must have a local instance running..
|
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 0
|
7
7
|
- 0
|
8
|
-
-
|
9
|
-
version: 0.0.
|
8
|
+
- 2
|
9
|
+
version: 0.0.2
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Rapid Mango
|
@@ -28,6 +28,7 @@ extra_rdoc_files: []
|
|
28
28
|
|
29
29
|
files:
|
30
30
|
- VERSION
|
31
|
+
- doc/EVENT_CLIENT_README.rdoc
|
31
32
|
- app/models/RPM/event.rb
|
32
33
|
has_rdoc: true
|
33
34
|
homepage: http://www.rapidmango.com.au
|