socialcount 0.0.0
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/lib/socialcount.rb +17 -0
- metadata +58 -0
data/lib/socialcount.rb
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
require 'net/http'
|
2
|
+
require 'uri'
|
3
|
+
require 'json'
|
4
|
+
|
5
|
+
class SocialCount
|
6
|
+
|
7
|
+
API_URL = "http://api.sharedcount.com/?url="
|
8
|
+
|
9
|
+
def query(url)
|
10
|
+
response = Net::HTTP.get_response(URI.parse(API_URL + url))
|
11
|
+
stats = JSON.parse(response.body)
|
12
|
+
|
13
|
+
raise WebServiceError, "A error occured. This is most likely because you entered a invalid URI." if stats.has_key? "Error"
|
14
|
+
|
15
|
+
Hash[stats.map { |k,v| [k.downcase,v]}]
|
16
|
+
end
|
17
|
+
end
|
metadata
ADDED
@@ -0,0 +1,58 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: socialcount
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.0
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Jake Austwick
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2011-11-13 00:00:00.000000000Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: json
|
16
|
+
requirement: &70322674444440 !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
18
|
+
requirements:
|
19
|
+
- - ! '>='
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: '0'
|
22
|
+
type: :runtime
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: *70322674444440
|
25
|
+
description: ! 'SocialCount is a gem to make it extemely easy for your to find out
|
26
|
+
social statistics about any URI. It returns tweets, diggs, google +1''s and much
|
27
|
+
more '
|
28
|
+
email: contact@mumbodesign.com
|
29
|
+
executables: []
|
30
|
+
extensions: []
|
31
|
+
extra_rdoc_files: []
|
32
|
+
files:
|
33
|
+
- lib/socialcount.rb
|
34
|
+
homepage: https://github.com/JakeAustwick/Social-Statistics-Counter-Ruby
|
35
|
+
licenses: []
|
36
|
+
post_install_message:
|
37
|
+
rdoc_options: []
|
38
|
+
require_paths:
|
39
|
+
- lib
|
40
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ! '>='
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: '0'
|
46
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
47
|
+
none: false
|
48
|
+
requirements:
|
49
|
+
- - ! '>='
|
50
|
+
- !ruby/object:Gem::Version
|
51
|
+
version: '0'
|
52
|
+
requirements: []
|
53
|
+
rubyforge_project:
|
54
|
+
rubygems_version: 1.8.10
|
55
|
+
signing_key:
|
56
|
+
specification_version: 3
|
57
|
+
summary: A gem to easily retrieve social statistics for any url
|
58
|
+
test_files: []
|