seo_params 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
@@ -88,7 +88,13 @@ To fetch only likes
88
88
 
89
89
  ``` ruby
90
90
  SeoParams.likes("github.com")
91
- # => "5,2 т."
91
+ # => "83"
92
+ ```
93
+ Or fetch all Facebook's parameters:
94
+
95
+ ``` ruby
96
+ SeoParams::Facebook.new("github.com").all
97
+ # => {"click_count"=>47, "comment_count"=>157, "like_count"=>83, "share_count"=>348, "total_count"=>588}
92
98
  ```
93
99
 
94
100
  DMOZ:
@@ -192,6 +198,16 @@ Checking the position of keywords in Yandex need only for RuNET, so further desc
192
198
  [2]: http://xml.yandex.ru/settings.xml
193
199
  [3]: http://api.yandex.ru/xml/doc/dg/reference/regions.xml
194
200
 
201
+ ## Changelog
202
+
203
+ ### v.0.0.6
204
+
205
+ * rewritten method of determining the number of Likes
206
+ * added method for fetching all the parameters provided by Facebook
207
+
208
+ ### v.0.0.5
209
+
210
+ * added method for fetching Google +1 counts
195
211
 
196
212
  ## Contributing
197
213
 
@@ -10,11 +10,23 @@ module SeoParams
10
10
  @url = url
11
11
  end
12
12
 
13
+ def all
14
+ api_url = "https://graph.facebook.com/fql?q=select%20click_count,%20comment_count,%20like_count,%20share_count,%20total_count%20from%20link_stat%20where%20url=%22#{@url}%22"
15
+ # response = ActiveSupport::JSON.decode(open(api_url))
16
+ response = JSON.parse(open(api_url).read)
17
+ h = Hash.new
18
+ h["click_count"] = response["data"][0]["click_count"]
19
+ h["comment_count"] = response["data"][0]["comment_count"]
20
+ h["like_count"] = response["data"][0]["like_count"]
21
+ h["share_count"] = response["data"][0]["share_count"]
22
+ h["total_count"] = response["data"][0]["total_count"]
23
+ h
24
+ end
25
+
13
26
  def likes
14
- api_url = "http://www.facebook.com/plugins/like.php?layout=button_count&href=#{@url}"
15
- response = Nokogiri::HTML(open(api_url))
16
- total_likes = response.css("span.pluginCountTextDisconnected")
17
- total_likes.text()
27
+ api_url = "https://graph.facebook.com/fql?q=select%20click_count,%20comment_count,%20like_count,%20share_count,%20total_count%20from%20link_stat%20where%20url=%22#{@url}%22"
28
+ response =JSON.parse(open(api_url).read)
29
+ response["data"][0]["like_count"]
18
30
  end
19
31
 
20
32
  end
@@ -1,3 +1,3 @@
1
1
  module SeoParams
2
- VERSION = "0.0.5"
2
+ VERSION = "0.0.6"
3
3
  end
metadata CHANGED
@@ -2,14 +2,14 @@
2
2
  name: seo_params
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.0.5
5
+ version: 0.0.6
6
6
  platform: ruby
7
7
  authors:
8
8
  - Alexander Podkidyshev aka none
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-12-03 00:00:00.000000000 Z
12
+ date: 2012-12-10 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  type: :runtime