social_shares 0.2.6 → 0.2.7

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: ac452383ad77f378be0ab45a1ead8cafe764f972
4
- data.tar.gz: 388b9c0acf70dbff458e46e152bfb1d6ab704b10
3
+ metadata.gz: f9eab70ae26105c23d80e83cd6a724440fe9a47d
4
+ data.tar.gz: 96f8dcb9dbcbc5c4ce1705df0fdc3eb1b9a4f77d
5
5
  SHA512:
6
- metadata.gz: 2a384748962c9475047680cd905173e9e1878bb09d466097c2d53fcfe25b083a1cbe4c74eaff74f38bbfbacfe8baed57b878c8f2e2da127dcfd598035e3087a6
7
- data.tar.gz: 68d85137a99cc78b5a3c1c85a6c00d20d4f70d16cd69a0e61a0987e63f722fa6068b3359df04307224c92ddf2577feae825f82fd69d6673f7c8e5dd7f7e85c03
6
+ metadata.gz: 235d154c6b9fc6718e718451fea185d49d5d49fb4a4f04c8bac506936055eceb3c7179a18286054982b779144434bfeff4e05a7a5a705e31e4be2a8134e9f99a
7
+ data.tar.gz: 7cedea104f5bfe46e8be93c7a81a5060befeacb225b276aa416e67a512a44e90a22fe026ace435170714bc249c4774b1610af668b170d5db12dcd1d8de1ab685
data/README.md CHANGED
@@ -12,7 +12,7 @@ Supported networks
12
12
  International:
13
13
  * [facebook](http://www.facebook.com/)
14
14
  * [google plus](https://plus.google.com)
15
- * [twitter](https://twitter.com/)
15
+ * ~~[twitter](https://twitter.com/)~~ Looking for another way, because [API have been closed officially](https://blog.twitter.com/2015/hard-decisions-for-a-sustainable-platform)
16
16
  * [reddit](http://www.reddit.com/)
17
17
  * [linkedin](https://www.linkedin.com/)
18
18
  * [pinterest](http://www.pinterest.com/)
@@ -74,6 +74,16 @@ Fetch all shares by one method (#all, #all!):
74
74
  => RestClient::RequestTimeout: Request Timeout
75
75
  ```
76
76
 
77
+ Fetch shares by excluding networks(#omit, #omit!):
78
+ ```ruby
79
+ :000 > SocialShares.omit url, %w(facebook)
80
+ => { :google=>28289, :linkedin=>nil, ... }
81
+
82
+ # same here
83
+ :000 > SocialShares.omit! url, %w(facebook)
84
+ => RestClient::RequestTimeout: Request Timeout
85
+ ```
86
+
77
87
  Fetch shares of selected networks(#selected, #selected!):
78
88
  ```ruby
79
89
  :000 > SocialShares.selected url, %w(facebook google linkedin)
@@ -135,6 +145,12 @@ SUPPORTED_NETWORKS = [:foo, :vkontakte, :facebook]
135
145
  ```
136
146
  * Update README: add link to list, possible answer in #all method, etc.
137
147
 
138
- Authors
148
+ Author
139
149
  ----
140
150
  * [Timur Kozmenko](https://twitter.com/Timrael) - timraell@gmail.com
151
+
152
+ Contributors
153
+ ----
154
+ * [Hamed Ramezanian](https://github.com/iCEAGE)
155
+ * [Ciocanel Razvan](https://github.com/Chocksy)
156
+ * [Mehdi FARSI](https://github.com/mehdi-farsi)
data/lib/social_shares.rb CHANGED
@@ -50,6 +50,14 @@ module SocialShares
50
50
  end
51
51
  end
52
52
 
53
+ def omit(url, excluded_networks = [])
54
+ selected_base(url, supported_networks.map(&:to_s) - excluded_networks.map(&:to_s), false)
55
+ end
56
+
57
+ def omit!(url, excluded_networks = [])
58
+ selected_base(url, supported_networks.map(&:to_s) - excluded_networks.map(&:to_s), true)
59
+ end
60
+
53
61
  def selected(url, selected_networks)
54
62
  selected_base(url, selected_networks, false)
55
63
  end
@@ -93,7 +101,7 @@ module SocialShares
93
101
  private
94
102
 
95
103
  def filtered_networks(selected_networks)
96
- selected_networks.map(&:to_sym) & SUPPORTED_NETWORKS
104
+ selected_networks.map(&:to_s) & SUPPORTED_NETWORKS.map(&:to_s)
97
105
  end
98
106
 
99
107
  def thread_pool(lambdas)
@@ -15,6 +15,12 @@ module SocialShares
15
15
  nil
16
16
  end
17
17
 
18
+ def shares!
19
+ raise NotImplementedError
20
+ end
21
+
22
+ protected
23
+
18
24
  def get(url, params)
19
25
  RestClient::Resource.new(url, timeout: TIMEOUT, open_timeout: OPEN_TIMEOUT).get(params)
20
26
  end
@@ -22,9 +28,5 @@ module SocialShares
22
28
  def post(url, params, headers = {})
23
29
  RestClient::Resource.new(url, timeout: TIMEOUT, open_timeout: OPEN_TIMEOUT).post(params, headers)
24
30
  end
25
-
26
- def shares!
27
- raise NotImplementedError
28
- end
29
31
  end
30
32
  end
@@ -1,3 +1,3 @@
1
1
  module SocialShares
2
- VERSION = '0.2.6'
2
+ VERSION = '0.2.7'
3
3
  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.6
4
+ version: 0.2.7
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-09-30 00:00:00.000000000 Z
11
+ date: 2015-12-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rest-client