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.1 examples/flickr.rb
api_client-0.5.0 examples/flickr.rb
api_client-0.4.3 examples/flickr.rb
api_client-0.4.2 examples/flickr.rb
api_client-0.4.1 examples/flickr.rb
api_client-0.3.3 examples/flickr.rb
api_client-0.4.0 examples/flickr.rb
api_client-0.3.2 examples/flickr.rb
api_client-0.3.1 examples/flickr.rb
api_client-0.3.0 examples/flickr.rb
api_client-0.2.0 examples/flickr.rb
api_client-0.1.9 examples/flickr.rb
api_client-0.1.8 examples/flickr.rb
api_client-0.1.7 examples/flickr.rb
api_client-0.1.6 examples/flickr.rb
api_client-0.1.5 examples/flickr.rb
api_client-0.1.4 examples/flickr.rb
api_client-0.1.3 examples/flickr.rb
api_client-0.1.2 examples/flickr.rb
api_client-0.1.1 examples/flickr.rb