social_shares 0.2.6 → 0.2.7
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 +4 -4
 - data/README.md +18 -2
 - data/lib/social_shares.rb +9 -1
 - data/lib/social_shares/base.rb +6 -4
 - data/lib/social_shares/version.rb +1 -1
 - metadata +2 -2
 
    
        checksums.yaml
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            ---
         
     | 
| 
       2 
2 
     | 
    
         
             
            SHA1:
         
     | 
| 
       3 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       4 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 3 
     | 
    
         
            +
              metadata.gz: f9eab70ae26105c23d80e83cd6a724440fe9a47d
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: 96f8dcb9dbcbc5c4ce1705df0fdc3eb1b9a4f77d
         
     | 
| 
       5 
5 
     | 
    
         
             
            SHA512:
         
     | 
| 
       6 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       7 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 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 
     | 
    
         
            -
             
     | 
| 
      
 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(&: 
     | 
| 
      
 104 
     | 
    
         
            +
                  selected_networks.map(&:to_s) & SUPPORTED_NETWORKS.map(&:to_s)
         
     | 
| 
       97 
105 
     | 
    
         
             
                end
         
     | 
| 
       98 
106 
     | 
    
         | 
| 
       99 
107 
     | 
    
         
             
                def thread_pool(lambdas)
         
     | 
    
        data/lib/social_shares/base.rb
    CHANGED
    
    | 
         @@ -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
         
     | 
    
        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. 
     | 
| 
      
 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- 
     | 
| 
      
 11 
     | 
    
         
            +
            date: 2015-12-04 00:00:00.000000000 Z
         
     | 
| 
       12 
12 
     | 
    
         
             
            dependencies:
         
     | 
| 
       13 
13 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       14 
14 
     | 
    
         
             
              name: rest-client
         
     |