Sha256: d98192165f49a8bdd8dd5f38ea7aeed09d3888b6015690a73535674425a89e03

Contents?: true

Size: 701 Bytes

Versions: 41

Compression:

Stored size: 701 Bytes

Contents

require "rubygems"
require "bundler/setup"
require "./examples/config" if File.exists?('examples/config.rb')
require "api_client"

module Flickr

  class Base < ApiClient::Base
    always do
      endpoint "http://api.flickr.com"
      params   :api_key => FLICKR_API_KEY,
               :format => 'json',
               :nojsoncallback => 1
    end
  end

  class Collection < Base

    def self.interesting
      build params(:method => 'flickr.interestingness.getList').
            get("/services/rest")
    end

    def photos
      Photo.build self['photos']['photo']
    end

  end

  class Photo < Base
  end

end

Flickr::Collection.interesting.photos.each do |photo|
  puts photo.title
end

Version data entries

41 entries across 41 versions & 1 rubygems

Version Path
api_client-0.5.24 examples/flickr.rb
api_client-0.5.22 examples/flickr.rb
api_client-0.5.21 examples/flickr.rb
api_client-0.5.20 examples/flickr.rb
api_client-0.5.19 examples/flickr.rb
api_client-0.5.18 examples/flickr.rb
api_client-0.5.17 examples/flickr.rb
api_client-0.5.16 examples/flickr.rb
api_client-0.5.15 examples/flickr.rb
api_client-0.5.14 examples/flickr.rb
api_client-0.5.13 examples/flickr.rb
api_client-0.5.12 examples/flickr.rb
api_client-0.5.11 examples/flickr.rb
api_client-0.5.9 examples/flickr.rb
api_client-0.5.7 examples/flickr.rb
api_client-0.5.6 examples/flickr.rb
api_client-0.5.5 examples/flickr.rb
api_client-0.5.4 examples/flickr.rb
api_client-0.5.3 examples/flickr.rb
api_client-0.5.2 examples/flickr.rb