StatsCollect 0.1.1.20101220 → 0.2.0.20110830

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,5 +1,5 @@
1
1
  #--
2
- # Copyright (c) 2009-2010 Muriel Salvan (murielsalvan@users.sourceforge.net)
2
+ # Copyright (c) 2010 - 2011 Muriel Salvan (murielsalvan@users.sourceforge.net)
3
3
  # Licensed under the terms specified in LICENSE file. No warranty is provided.
4
4
  #++
5
5
 
@@ -17,7 +17,7 @@ module StatsCollect
17
17
  attr_reader :UnrecoverableOrders
18
18
 
19
19
  # List of statistics to add
20
- # list< Time, Object, Category, Value >
20
+ # list< CheckExistenceBeforeAdd?, Time, Location, Object, Category, Value >
21
21
  attr_reader :StatsToAdd
22
22
 
23
23
  # Constructor
@@ -25,8 +25,10 @@ module StatsCollect
25
25
  # Parameters:
26
26
  # * *iLstObjects* (<em>list<String></em>): List of objects to filter (can be empty for all)
27
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
28
+ # * *iBackend* (_Object_): The backend
29
+ # * *iLocation* (_String_): Name of the default location
30
+ def initialize(iLstObjects, iLstCategories, iBackend, iLocation)
31
+ @LstObjects, @LstCategories, @Backend, @Location = iLstObjects, iLstCategories, iBackend, iLocation
30
32
  @RecoverableOrders = []
31
33
  @UnrecoverableOrders = []
32
34
  @StatsToAdd = []
@@ -74,15 +76,30 @@ module StatsCollect
74
76
  # * *iObject* (_String_): The object
75
77
  # * *iCategory* (_String_): The category
76
78
  # * *iValue* (_Object_): The value
77
- def addStat(iObject, iCategory, iValue)
79
+ # * *iOptions* (<em>map<Symbol,Object></em>): Additional options [optional = {}]:
80
+ # ** *:Timestamp* (_DateTime_): Time stamp of this stat [optional = DateTime.now]
81
+ # ** *:Location* (_String_): Location of this stat [optional = <PluginName>]
82
+ def addStat(iObject, iCategory, iValue, iOptions = {})
83
+ lTimestamp = (iOptions[:Timestamp] || DateTime.now)
84
+ lLocation = (iOptions[:Location] || @Location)
78
85
  @StatsToAdd << [
79
- DateTime.now,
86
+ (iOptions[:Timestamp] != nil),
87
+ lTimestamp,
88
+ lLocation,
80
89
  iObject,
81
90
  iCategory,
82
91
  iValue
83
92
  ]
84
93
  end
85
94
 
95
+ # Add a stats list
96
+ #
97
+ # Parameters:
98
+ # * *iLstStats* (<em>list<[...]></em>): List of stats. See :StatsToAdd property for internal fields to set.
99
+ def addStatsList(iLstStats)
100
+ @StatsToAdd.concat(iLstStats)
101
+ end
102
+
86
103
  # Add a new recoverable order
87
104
  #
88
105
  # Parameters:
@@ -101,6 +118,30 @@ module StatsCollect
101
118
  @UnrecoverableOrders << [ iLstObjects, iLstCategories ]
102
119
  end
103
120
 
121
+ # Get the list of categories
122
+ #
123
+ # Return:
124
+ # * <em>map<String,[Integer,Integer]></em>: The list of categories and their associated ID and value type
125
+ def getCategories
126
+ return @Backend.getKnownCategories
127
+ end
128
+
129
+ # Get the list of objects
130
+ #
131
+ # Return:
132
+ # * <em>map<String,Integer></em>: The list of objects and their associated ID
133
+ def getObjects
134
+ return @Backend.getKnownObjects
135
+ end
136
+
137
+ # Get the list of locations
138
+ #
139
+ # Return:
140
+ # * <em>map<String,Integer></em>: The list of locations and their associated ID
141
+ def getLocations
142
+ return @Backend.getKnownLocations
143
+ end
144
+
104
145
  end
105
146
 
106
147
  end
metadata CHANGED
@@ -1,13 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: StatsCollect
3
3
  version: !ruby/object:Gem::Version
4
- prerelease: false
4
+ hash: 40221571
5
+ prerelease:
5
6
  segments:
6
7
  - 0
7
- - 1
8
- - 1
9
- - 20101220
10
- version: 0.1.1.20101220
8
+ - 2
9
+ - 0
10
+ - 20110830
11
+ version: 0.2.0.20110830
11
12
  platform: ruby
12
13
  authors:
13
14
  - Muriel Salvan
@@ -15,8 +16,7 @@ autorequire:
15
16
  bindir: bin
16
17
  cert_chain: []
17
18
 
18
- date: 2010-12-20 00:00:00 +01:00
19
- default_executable:
19
+ date: 2011-08-30 00:00:00 Z
20
20
  dependencies: []
21
21
 
22
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).
@@ -35,25 +35,29 @@ files:
35
35
  - lib/StatsCollect/Backends/MySQL.rb
36
36
  - lib/StatsCollect/Backends/Terminal.rb
37
37
  - lib/StatsCollect/Locations/AddThis.rb
38
+ - lib/StatsCollect/Locations/CSV.rb
38
39
  - lib/StatsCollect/Locations/Facebook.rb
39
40
  - lib/StatsCollect/Locations/FacebookArtist.rb
40
41
  - lib/StatsCollect/Locations/FacebookLike.rb
42
+ - lib/StatsCollect/Locations/GoogleGroup.rb
41
43
  - lib/StatsCollect/Locations/GoogleSearch.rb
42
44
  - lib/StatsCollect/Locations/MySpace.rb
45
+ - lib/StatsCollect/Locations/RB.rb
43
46
  - lib/StatsCollect/Locations/ReverbNation.rb
44
47
  - lib/StatsCollect/Locations/Tweets.rb
45
48
  - lib/StatsCollect/Locations/Twitter.rb
46
49
  - lib/StatsCollect/Locations/Youtube.rb
50
+ - lib/StatsCollect/Notifiers/Custom.rb
51
+ - lib/StatsCollect/Notifiers/LogFile.rb
47
52
  - lib/StatsCollect/Notifiers/None.rb
48
53
  - lib/StatsCollect/Notifiers/SendMail.rb
49
54
  - lib/StatsCollect/Stats.rb
55
+ - lib/StatsCollect/StatsOrdersProxy.rb
50
56
  - lib/StatsCollect/StatsProxy.rb
51
57
  - LICENSE
52
58
  - README
53
59
  - ReleaseInfo
54
60
  - StatsCollect.conf.rb.example
55
- - TODO
56
- has_rdoc: true
57
61
  homepage: http://statscollect.sourceforge.net/
58
62
  licenses: []
59
63
 
@@ -67,6 +71,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
67
71
  requirements:
68
72
  - - ">="
69
73
  - !ruby/object:Gem::Version
74
+ hash: 3
70
75
  segments:
71
76
  - 0
72
77
  version: "0"
@@ -75,13 +80,14 @@ required_rubygems_version: !ruby/object:Gem::Requirement
75
80
  requirements:
76
81
  - - ">="
77
82
  - !ruby/object:Gem::Version
83
+ hash: 3
78
84
  segments:
79
85
  - 0
80
86
  version: "0"
81
87
  requirements: []
82
88
 
83
89
  rubyforge_project: statscollect
84
- rubygems_version: 1.3.7
90
+ rubygems_version: 1.8.9
85
91
  signing_key:
86
92
  specification_version: 3
87
93
  summary: Command line tool gathering statistics from external sources.
data/TODO DELETED
@@ -1,2 +0,0 @@
1
- * MySpace: Get the user ID by parsing the Profile URL and remove :MySpaceName configuration option.
2
- * Get all the orders at once, and merge them to call Locations just once per execution.