social_shares 0.2.3 → 0.2.4

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d9baeeea274fa2e9905c34e4f239cade31945a42
4
- data.tar.gz: 4dddbf2daae42b7ec25bb11b0c97913ff698e893
3
+ metadata.gz: 7fb7315acc49822df580034d6b28e977ac736b51
4
+ data.tar.gz: c1611ab598f7cd3aa3a27a87d94270cdf4630d53
5
5
  SHA512:
6
- metadata.gz: 7146000b79bd06427187f8e4bd72d7ea18b5ecad52e2d7e7058e3841a273f7e9f3c2fb904b40c4aacb6f5f7c88db630bc87e6953a6dcfb9a3faf29cb837cefe5
7
- data.tar.gz: 057395a4f8b638a758d90681e0a44df0f376646b416ec263221bb1b15838a542d2b5122f706c806d20231c773d9a3b4772c6363fdf555d60e1bfdab378785a3e
6
+ metadata.gz: 53b32f2224f66b8906feabec2952855ad9a622a04f3e10c4c41539c24d9ef89ad81a74f389ddcbb3e00d49104081533ece9fe9e21b6f555d1fa0248bff700bc8
7
+ data.tar.gz: 2911b2b3e33ccb8ea8290fe5068281b4641680df135910593f631d7c1b8d42d23431318818696fe45865b308fba648e37557ce08cbe1306397be2cf07b56565f
data/README.md CHANGED
@@ -19,8 +19,9 @@ International:
19
19
 
20
20
  Russian:
21
21
  * [vkontakte](http://vkontakte.ru/)
22
- * [mail.ru](http://mail.ru/)
22
+ * [mail.ru(aka moi mir)](http://my.mail.ru/)
23
23
  * [odnoklassniki](http://www.odnoklassniki.ru/)
24
+ * [yandex](http://yandex.ru/) (currently on beta, most of time returns 0)
24
25
 
25
26
  Chinese:
26
27
  * [weibo](http://www.weibo.com)
@@ -64,7 +65,7 @@ Fetch all shares by one method (#all, #all!):
64
65
  ```ruby
65
66
  # in case of exception it will return nil
66
67
  :000 > SocialShares.all url
67
- => {:vkontakte=>nil, :facebook=>399027, :google=>28346, :twitter=>1836, :mail_ru=>37, :odnoklassniki=>1, :reddit=>2361, :linkedin=>33, :pinterest=>21011, :stumbleupon=>43035, :weibo=>12760, :buffer=>1662}
68
+ => {:vkontakte=>nil, :facebook=>399027, :google=>28346, :twitter=>1836, :mail_ru=>37, :odnoklassniki=>1, :reddit=>2361, :linkedin=>33, :pinterest=>21011, :stumbleupon=>43035, :weibo=>12760, :buffer=>1662, :yandex=>0}
68
69
 
69
70
  # and this will raise it
70
71
  :000 > SocialShares.all! url
@@ -1,18 +1,17 @@
1
1
  module SocialShares
2
2
  class MailRu < Base
3
- def shares!
4
- response['share_mm'].to_i
5
- end
6
-
7
- protected
3
+ URL = 'https://connect.mail.ru/share_count'
8
4
 
9
- def response
10
- response = RestClient.get(url)
11
- JSON.parse(response)
12
- end
13
-
14
- def url
15
- "http://appsmail.ru/share/count/#{checked_url}"
5
+ def shares!
6
+ response = RestClient.get(URL, {
7
+ params: {
8
+ func: 'foo',
9
+ callback: 1,
10
+ url_list: checked_url
11
+ }
12
+ })
13
+ matches = /shares":(\d+)/.match(response)
14
+ matches ? matches[-1].to_i : 0
16
15
  end
17
16
  end
18
17
  end
@@ -1,7 +1,16 @@
1
1
  module SocialShares
2
- class Odnoklassniki < MailRu
2
+ class Odnoklassniki < Base
3
+ URL = 'http://ok.ru/dk'
4
+
3
5
  def shares!
4
- response['share_ok'].to_i
6
+ response = RestClient.get(URL, {
7
+ params: {
8
+ 'st.cmd' => 'extLike',
9
+ uid: 'odklcnt0',
10
+ ref: checked_url
11
+ }
12
+ })
13
+ /'(\d+)'\)/.match(response)[-1].to_i
5
14
  end
6
15
  end
7
16
  end
@@ -1,3 +1,3 @@
1
1
  module SocialShares
2
- VERSION = '0.2.3'
2
+ VERSION = '0.2.4'
3
3
  end
@@ -0,0 +1,10 @@
1
+ module SocialShares
2
+ class Yandex < Base
3
+ URL = 'http://wow.ya.ru/ajax/share-counter.xml'
4
+
5
+ def shares!
6
+ response = RestClient.get(URL, {params: {url: checked_url}})
7
+ /(\d+)/.match(response)[-1].to_i
8
+ end
9
+ end
10
+ end
data/lib/social_shares.rb CHANGED
@@ -14,6 +14,7 @@ require 'social_shares/pinterest'
14
14
  require 'social_shares/stumbleupon'
15
15
  require 'social_shares/weibo'
16
16
  require 'social_shares/buffer'
17
+ require 'social_shares/yandex'
17
18
 
18
19
  module SocialShares
19
20
  class << self
@@ -30,6 +31,7 @@ module SocialShares
30
31
  :stumbleupon,
31
32
  :weibo,
32
33
  :buffer,
34
+ :yandex,
33
35
  ]
34
36
 
35
37
  def supported_networks
@@ -23,4 +23,5 @@ Gem::Specification.new do |spec|
23
23
 
24
24
  spec.add_development_dependency 'bundler', '~> 1.6'
25
25
  spec.add_development_dependency 'rake'
26
+ spec.add_development_dependency 'byebug'
26
27
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: social_shares
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.3
4
+ version: 0.2.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Timur Kozmenko
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-02-15 00:00:00.000000000 Z
11
+ date: 2015-05-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rest-client
@@ -66,6 +66,20 @@ dependencies:
66
66
  - - ">="
67
67
  - !ruby/object:Gem::Version
68
68
  version: '0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: byebug
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
69
83
  description: Check how many times url was shared in social networks, e.g. share counts.
70
84
  email:
71
85
  - timraell@gmail.com
@@ -93,6 +107,7 @@ files:
93
107
  - lib/social_shares/version.rb
94
108
  - lib/social_shares/vkontakte.rb
95
109
  - lib/social_shares/weibo.rb
110
+ - lib/social_shares/yandex.rb
96
111
  - social_shares.gemspec
97
112
  homepage: https://github.com/Timrael/social_shares
98
113
  licenses: