flickr-objects 0.4.1 → 0.5.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.
- checksums.yaml +4 -4
- data/README.md +19 -0
- data/lib/flickr/client.rb +1 -0
- data/lib/flickr/configuration.rb +8 -0
- data/lib/flickr/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: 804fe3b3024d5bfa5273c6b6ffbb65fd091e85e8
         | 
| 4 | 
            +
              data.tar.gz: 3f80d880bbb6f2cfacaa0e11e144eb962ffe3f18
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: 2c98b7affe1fe3deba5842e135d2640cdf9404c4f36035e0c26e23ef3626590e9725a6a1e2d01ad4228a2a8853e082efdb83f7fb1fa1a3e4245d6979b384fc59
         | 
| 7 | 
            +
              data.tar.gz: c25d0c5f1570a5299c54ba64e30230c3eb2c6f59b23081fe8bf1889aac6d86260ab4303813c58593cf4ed0b372b11c5f742aa44171cd15ed379734bce4760f70
         | 
    
        data/README.md
    CHANGED
    
    | @@ -175,6 +175,25 @@ Flickr gives you pagination on almost every request that returns a collection of | |
| 175 175 | 
             
            This gem supports both [WillPaginate](https://github.com/mislav/will_paginate) (`:will_paginate`)
         | 
| 176 176 | 
             
            and [Kaminari](https://github.com/amatsuda/kaminari) (`:kaminari`).
         | 
| 177 177 |  | 
| 178 | 
            +
            ## Caching
         | 
| 179 | 
            +
             | 
| 180 | 
            +
            To enable caching responses, just pass in a cache object (an object that responds
         | 
| 181 | 
            +
            to `#read`, `#write` and `#fetch`) in the configuration.
         | 
| 182 | 
            +
             | 
| 183 | 
            +
            ```ruby
         | 
| 184 | 
            +
            require "active_support/cache"
         | 
| 185 | 
            +
            require "active_support/core_ext/numeric/time"
         | 
| 186 | 
            +
             | 
| 187 | 
            +
            Flickr.configure do |config|
         | 
| 188 | 
            +
              config.cache = ActiveSupport::Cache::MemoryStore(expires_in: 1.week)
         | 
| 189 | 
            +
            end
         | 
| 190 | 
            +
            ```
         | 
| 191 | 
            +
             | 
| 192 | 
            +
            ```ruby
         | 
| 193 | 
            +
            Flickr.photos.recent # Makes an API call
         | 
| 194 | 
            +
            Flickr.photos.recent # Uses the cache
         | 
| 195 | 
            +
            ```
         | 
| 196 | 
            +
             | 
| 178 197 | 
             
            ## Few words
         | 
| 179 198 |  | 
| 180 199 | 
             
            Many of the API methods are not covered yet (because they are so many).
         | 
    
        data/lib/flickr/client.rb
    CHANGED
    
    | @@ -33,6 +33,7 @@ module Flickr | |
| 33 33 | 
             
                  @connection = Faraday.new(url, connection_options) do |builder|
         | 
| 34 34 | 
             
                    builder.use Flickr::Middleware::CatchTimeout
         | 
| 35 35 | 
             
                    yield builder if block_given?
         | 
| 36 | 
            +
                    builder.use FaradayMiddleware::Caching, Flickr.cache if Flickr.cache
         | 
| 36 37 |  | 
| 37 38 | 
             
                    builder.adapter :net_http
         | 
| 38 39 | 
             
                  end
         | 
    
        data/lib/flickr/configuration.rb
    CHANGED
    
    | @@ -91,6 +91,14 @@ module Flickr | |
| 91 91 | 
             
                #
         | 
| 92 92 | 
             
                attr_accessor :pagination
         | 
| 93 93 |  | 
| 94 | 
            +
                ##
         | 
| 95 | 
            +
                # Enables caching responses. An object that is passed must respond to
         | 
| 96 | 
            +
                # `#read`, `#write` and `#fetch`.
         | 
| 97 | 
            +
                #
         | 
| 98 | 
            +
                #     config.cache = ActiveSupport::Cache::MemoryStore.new(expires_in: 1.hour)
         | 
| 99 | 
            +
                #
         | 
| 100 | 
            +
                attr_accessor :cache
         | 
| 101 | 
            +
             | 
| 94 102 | 
             
              end
         | 
| 95 103 |  | 
| 96 104 | 
             
            end
         | 
    
        data/lib/flickr/version.rb
    CHANGED
    
    
    
        metadata
    CHANGED
    
    | @@ -1,14 +1,14 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification
         | 
| 2 2 | 
             
            name: flickr-objects
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version
         | 
| 4 | 
            -
              version: 0. | 
| 4 | 
            +
              version: 0.5.0
         | 
| 5 5 | 
             
            platform: ruby
         | 
| 6 6 | 
             
            authors:
         | 
| 7 7 | 
             
            - Janko Marohnić
         | 
| 8 8 | 
             
            autorequire: 
         | 
| 9 9 | 
             
            bindir: bin
         | 
| 10 10 | 
             
            cert_chain: []
         | 
| 11 | 
            -
            date: 2014- | 
| 11 | 
            +
            date: 2014-06-28 00:00:00.000000000 Z
         | 
| 12 12 | 
             
            dependencies:
         | 
| 13 13 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 14 14 | 
             
              name: faraday
         |