StatsCollect 0.1.0.20101220

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,106 @@
1
+ #--
2
+ # Copyright (c) 2009-2010 Muriel Salvan (murielsalvan@users.sourceforge.net)
3
+ # Licensed under the terms specified in LICENSE file. No warranty is provided.
4
+ #++
5
+
6
+ module StatsCollect
7
+
8
+ # The stats proxy, used by plugins to populate stats
9
+ class StatsProxy
10
+
11
+ # List of recoverable orders as stated by the plugin (objects, categories)
12
+ # list< [ list<String>, list<String> ] >
13
+ attr_reader :RecoverableOrders
14
+
15
+ # List of unrecoverable orders as stated by the plugin (objects, categories)
16
+ # list< [ list<String>, list<String> ] >
17
+ attr_reader :UnrecoverableOrders
18
+
19
+ # List of statistics to add
20
+ # list< Time, Object, Category, Value >
21
+ attr_reader :StatsToAdd
22
+
23
+ # Constructor
24
+ #
25
+ # Parameters:
26
+ # * *iLstObjects* (<em>list<String></em>): List of objects to filter (can be empty for all)
27
+ # * *iLstCategories* (<em>list<String></em>): List of categories to filter (can be empty for all)
28
+ def initialize(iLstObjects, iLstCategories)
29
+ @LstObjects, @LstCategories = iLstObjects, iLstCategories
30
+ @RecoverableOrders = []
31
+ @UnrecoverableOrders = []
32
+ @StatsToAdd = []
33
+ end
34
+
35
+ # Check if a specific object is included in the filter
36
+ #
37
+ # Parameters:
38
+ # * *iObjectName* (_String_): The object to check
39
+ # Return:
40
+ # * _Boolean_: Is the object included in the filter ?
41
+ def isObjectIncluded?(iObjectName)
42
+ rIncluded = false
43
+
44
+ if (@LstObjects.empty?)
45
+ rIncluded = true
46
+ else
47
+ rIncluded = @LstObjects.include?(iObjectName)
48
+ end
49
+
50
+ return rIncluded
51
+ end
52
+
53
+ # Check if a specific category is included in the filter
54
+ #
55
+ # Parameters:
56
+ # * *iCategoryName* (_String_): The category to check
57
+ # Return:
58
+ # * _Boolean_: Is the category included in the filter ?
59
+ def isCategoryIncluded?(iCategoryName)
60
+ rIncluded = false
61
+
62
+ if (@LstCategories.empty?)
63
+ rIncluded = true
64
+ else
65
+ rIncluded = @LstCategories.include?(iCategoryName)
66
+ end
67
+
68
+ return rIncluded
69
+ end
70
+
71
+ # Add a new stat
72
+ #
73
+ # Parameters:
74
+ # * *iObject* (_String_): The object
75
+ # * *iCategory* (_String_): The category
76
+ # * *iValue* (_Object_): The value
77
+ def addStat(iObject, iCategory, iValue)
78
+ @StatsToAdd << [
79
+ DateTime.now,
80
+ iObject,
81
+ iCategory,
82
+ iValue
83
+ ]
84
+ end
85
+
86
+ # Add a new recoverable order
87
+ #
88
+ # Parameters:
89
+ # * *iLstObjects* (<em>list<String></em>): The failing objects
90
+ # * *iLstCategories* (<em>list<String></em>): The failing categories
91
+ def addRecoverableOrder(iLstObjects, iLstCategories)
92
+ @RecoverableOrders << [ iLstObjects, iLstCategories ]
93
+ end
94
+
95
+ # Add a new unrecoverable order
96
+ #
97
+ # Parameters:
98
+ # * *iLstObjects* (<em>list<String></em>): The failing objects
99
+ # * *iLstCategories* (<em>list<String></em>): The failing categories
100
+ def addUnrecoverableOrder(iLstObjects, iLstCategories)
101
+ @UnrecoverableOrders << [ iLstObjects, iLstCategories ]
102
+ end
103
+
104
+ end
105
+
106
+ end
metadata ADDED
@@ -0,0 +1,89 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: StatsCollect
3
+ version: !ruby/object:Gem::Version
4
+ prerelease: false
5
+ segments:
6
+ - 0
7
+ - 1
8
+ - 0
9
+ - 20101220
10
+ version: 0.1.0.20101220
11
+ platform: ruby
12
+ authors:
13
+ - Muriel Salvan
14
+ autorequire:
15
+ bindir: bin
16
+ cert_chain: []
17
+
18
+ date: 2010-12-20 00:00:00 +01:00
19
+ default_executable:
20
+ dependencies: []
21
+
22
+ description: StatsCollect is a little framework gathering statistics from external sources (social networks, web sites...), stored in pluggable backends. It can be very easily extended thanks to its plugins (currently include Facebook, Myspace, Youtube, Google).
23
+ email: murielsalvan@users.sourceforge.net
24
+ executables:
25
+ - StatsCollect.rb
26
+ extensions: []
27
+
28
+ extra_rdoc_files: []
29
+
30
+ files:
31
+ - AUTHORS
32
+ - bin/StatsCollect.rb
33
+ - ChangeLog
34
+ - Credits
35
+ - lib/StatsCollect/Backends/MySQL.rb
36
+ - lib/StatsCollect/Backends/Terminal.rb
37
+ - lib/StatsCollect/Locations/AddThis.rb
38
+ - lib/StatsCollect/Locations/Facebook.rb
39
+ - lib/StatsCollect/Locations/FacebookArtist.rb
40
+ - lib/StatsCollect/Locations/FacebookLike.rb
41
+ - lib/StatsCollect/Locations/GoogleSearch.rb
42
+ - lib/StatsCollect/Locations/MySpace.rb
43
+ - lib/StatsCollect/Locations/ReverbNation.rb
44
+ - lib/StatsCollect/Locations/Tweets.rb
45
+ - lib/StatsCollect/Locations/Twitter.rb
46
+ - lib/StatsCollect/Locations/Youtube.rb
47
+ - lib/StatsCollect/Notifiers/None.rb
48
+ - lib/StatsCollect/Notifiers/SendMail.rb
49
+ - lib/StatsCollect/Stats.rb
50
+ - lib/StatsCollect/StatsProxy.rb
51
+ - LICENSE
52
+ - README
53
+ - ReleaseInfo
54
+ - StatsCollect.conf.rb.example
55
+ - TODO
56
+ has_rdoc: true
57
+ homepage: http://statscollect.sourceforge.net/
58
+ licenses: []
59
+
60
+ post_install_message:
61
+ rdoc_options: []
62
+
63
+ require_paths:
64
+ - lib
65
+ required_ruby_version: !ruby/object:Gem::Requirement
66
+ none: false
67
+ requirements:
68
+ - - ">="
69
+ - !ruby/object:Gem::Version
70
+ segments:
71
+ - 0
72
+ version: "0"
73
+ required_rubygems_version: !ruby/object:Gem::Requirement
74
+ none: false
75
+ requirements:
76
+ - - ">="
77
+ - !ruby/object:Gem::Version
78
+ segments:
79
+ - 0
80
+ version: "0"
81
+ requirements: []
82
+
83
+ rubyforge_project: statscollect
84
+ rubygems_version: 1.3.7
85
+ signing_key:
86
+ specification_version: 3
87
+ summary: Command line tool gathering statistics from external sources.
88
+ test_files: []
89
+