virility 0.0.5 → 0.0.6

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -18,11 +18,19 @@ Or install it yourself as:
18
18
 
19
19
  ## Usage
20
20
 
21
+ The Excitation object will collect the data from all of the available strategies.
22
+
21
23
  stats = Virility::Excitation.new("http://rubygems.org")
22
24
  stats.poll # returns a hash with the collected output of all data sources
23
25
  stats.counts # returns a hash of just the virility counts => {:delicious=>943, :facebook=>72, :pinterest=>0, :plusone=>137, :stumbleupon=>1488, :twitter=>2319}
24
26
  stats.total # returns the sum of all virility counts
25
27
 
28
+ One common implementation would be to collect the total count of all social shares for a given URL
29
+
30
+ Virility::Excitation.new("http://rubygems.org").total # => 4959
31
+
32
+ ## Individual Strategies
33
+
26
34
  Currently there is support for the following social resources:
27
35
  * Facebook
28
36
  * Twitter
@@ -31,7 +39,35 @@ Currently there is support for the following social resources:
31
39
  * Google Plus One
32
40
  * Stumble Upon
33
41
 
34
- More detailed information coming soon.
42
+ Each social resources is implemented as a strategy and contains at least two methods: poll and count.
43
+
44
+ _poll_ does the work of querying the API to get the data
45
+ _count_ pulls out the individual number of shares for that social
46
+
47
+ Let's say you only need to get the number of tweets for a URL, you could use the Virility::Twitter class by itself:
48
+
49
+ tweets = Virility::Twitter.new("http://rubygems.org")
50
+ tweets.poll # returns a hash with the collected output from Twitter => {"url"=>"http://rubygems.org/", "count"=>2319}
51
+ tweets.count # returns the number of tweets for that URL => 2319
52
+
53
+ ## Facebook Usage
54
+
55
+ The Facebook strategy leverages the FQL query against the link_stat table. Because of this, the following data fields are available:
56
+ * like_count
57
+ * click_count
58
+ * share_count
59
+ * comment_count
60
+ * commentsbox_count
61
+ * total_count (used as the default count for all Facebook activity)
62
+ * comments_fbid
63
+
64
+ fb = Virility::Facebook.new("http://rubygems.org")
65
+ fb.poll # returns a hash with the collected output from Facebook
66
+ fb.count # returns the total_count for that URL => 72
67
+
68
+ ## Important Notes
69
+
70
+ URL's are very specific in the context of a social media. For example, http://rubygems.org will return different results than http://rubygems.org/ with a trailing slash. Also, http vs https will give you different numbers. This actually has a lot to do with why we created this gem. When testing be sure to investigate all of the URL variations in order to get the most complete picture of your data.
35
71
 
36
72
  ## Contributing
37
73
 
@@ -41,7 +77,7 @@ More detailed information coming soon.
41
77
  4. Push to the branch (`git push origin my-new-feature`)
42
78
  5. Create new Pull Request
43
79
 
44
- == Copyright
80
+ ## Copyright
45
81
 
46
82
  Copyright (c) 2012 Jay Sanders. See LICENSE.txt for
47
83
  further details.
@@ -10,5 +10,9 @@ module Virility
10
10
  def poll
11
11
  raise "Abstract Method poll called on #{self.class} - Please define this method"
12
12
  end
13
+
14
+ def count
15
+ raise "Abstract Method count called on #{self.class} - Please define this method"
16
+ end
13
17
  end
14
18
  end
@@ -1,3 +1,3 @@
1
1
  module Virility
2
- VERSION = "0.0.5"
2
+ VERSION = "0.0.6"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: virility
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.5
4
+ version: 0.0.6
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -87,7 +87,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
87
87
  version: '0'
88
88
  segments:
89
89
  - 0
90
- hash: 4477623610621642756
90
+ hash: -1645874918326288132
91
91
  required_rubygems_version: !ruby/object:Gem::Requirement
92
92
  none: false
93
93
  requirements:
@@ -96,7 +96,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
96
96
  version: '0'
97
97
  segments:
98
98
  - 0
99
- hash: 4477623610621642756
99
+ hash: -1645874918326288132
100
100
  requirements: []
101
101
  rubyforge_project:
102
102
  rubygems_version: 1.8.24