thecount 0.1 → 0.1.1

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/README.md CHANGED
@@ -4,7 +4,10 @@ Provides a simple interface for counting and reporting arbitrary things on the w
4
4
 
5
5
  ![Mascot](http://4.bp.blogspot.com/-TCPvrnG-KCs/TfMjpWepAKI/AAAAAAAAJWA/49r4o_q6JaA/s1600/TheCount.jpg)
6
6
 
7
-
7
+ Installation
8
+ -------------------
9
+ gem install thecount
10
+
8
11
  Sample Usage
9
12
  -------------------
10
13
  # Setup a counting request
@@ -17,9 +20,10 @@ Sample Usage
17
20
  )
18
21
 
19
22
  # Print out all the values
20
- data.each { |count|
21
- p "#{count.service_name} -> #{count.value}"
22
- }
23
+ p "#{data[TheCount::Twitter].service_name} -> #{data[TheCount::Twitter].value}"
24
+ p "#{data[TheCount::Facebook].service_name} -> #{data[TheCount::Facebook].value}"
25
+ p "#{data[TheCount::LinkedIn].service_name} -> #{data[TheCount::LinkedIn].value}"
26
+
23
27
  # (at the time of this example)
24
28
  # twitter -> 900
25
29
  # facebook -> 3000
@@ -27,12 +31,12 @@ Sample Usage
27
31
 
28
32
  Supported Services
29
33
  -------------------
30
- - Twitter Link Shares
31
- - Facebook Likes
32
- - Facebook Comment threads
33
- - LinkedIn Shares
34
- - Google Buzzes
35
- - Digg diggs
34
+ - TheCount::Twitter (Twitter Link Shares)
35
+ - TheCount::Facebook (Facebook Likes)
36
+ - TheCount::Facebook::Comments (Facebook Comment threads)
37
+ - TheCount::LinkedIn (LinkedIn Shares)
38
+ - TheCount::Google::Buzz (Google Buzzes)
39
+ - TheCount::Digg (Digg diggs)
36
40
 
37
41
  Tests
38
42
  -------------------
data/lib/thecount.rb CHANGED
@@ -15,10 +15,12 @@ module TheCount
15
15
  args = config[:args]
16
16
 
17
17
  strategies = [strategies] unless strategies.kind_of?(Array)
18
- strategies.collect { |s|
18
+ results = {}
19
+ strategies.each { |s|
19
20
  service = s.new
20
21
  service.count(args)
21
- service
22
+ results[s] = service
22
23
  }
24
+ results
23
25
  end
24
26
  end
@@ -5,13 +5,13 @@ require 'helper'
5
5
  describe TheCount do
6
6
  describe "#count" do
7
7
  context "given a single strategy input" do
8
- it "should return an single array with an instance of the given stategy" do
8
+ it "should return an object with an key-value pair for the strategy type" do
9
9
  counts = TheCount::count do |config|
10
10
  config[:strategies] = TheCount::Twitter
11
11
  config[:args] = { :url => 'http://google.com' }
12
12
  end
13
-
14
- counts[0].kind_of?(TheCount::Twitter).should be true
13
+ counts.kind_of?(Object).should be true
14
+ counts[TheCount::Twitter].kind_of?(TheCount::Twitter).should be true
15
15
  end
16
16
  end
17
17
  context "given multiple strategies as input" do
@@ -21,10 +21,10 @@ describe TheCount do
21
21
  config[:args] = { :url => 'http://google.com' }
22
22
  end
23
23
 
24
- counts.kind_of?(Array).should be true
25
- counts.size.should be 2
26
- counts[0].kind_of?(TheCount::Facebook).should be true
27
- counts[1].kind_of?(TheCount::Twitter).should be true
24
+ counts.kind_of?(Object).should be true
25
+ counts.keys.size.should be 2
26
+ counts[TheCount::Facebook].kind_of?(TheCount::Facebook).should be true
27
+ counts[TheCount::Twitter].kind_of?(TheCount::Twitter).should be true
28
28
  end
29
29
  end
30
30
  end
data/thecount.gemspec CHANGED
@@ -1,7 +1,7 @@
1
1
  Gem::Specification.new do |gem|
2
2
  gem.name = 'thecount'
3
- gem.version = '0.1'
4
- gem.date = '2011-06-18'
3
+ gem.version = '0.1.1'
4
+ gem.date = '2011-06-19'
5
5
  gem.summary = "A simple generic counting service"
6
6
  gem.description = "Provides a simple interface for counting and reporting arbitrary things on the web"
7
7
  gem.author = "Ian Chan"
metadata CHANGED
@@ -5,7 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 1
8
- version: "0.1"
8
+ - 1
9
+ version: 0.1.1
9
10
  platform: ruby
10
11
  authors:
11
12
  - Ian Chan
@@ -13,7 +14,7 @@ autorequire:
13
14
  bindir: bin
14
15
  cert_chain: []
15
16
 
16
- date: 2011-06-18 00:00:00 -07:00
17
+ date: 2011-06-19 00:00:00 -07:00
17
18
  default_executable:
18
19
  dependencies: []
19
20