Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

flickrmocks

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

flickrmocks

  • 0.9.2
  • Rubygems
  • Socket score

Version published
Maintainers
1
Created
Source

= FlickrMocks

Wiki[http://wiki.github.com/takaltoo/flickrmocks] | RDocs[http://rdoc.info/projects/takaltoo/flickrmocks]

FlickrMocks simplifies access to the Flickr API by providing wrappers and helpers on top of the FlickRaw[https://github.com/hanklords/flickraw] gem.

== Installation In a standalone ruby project: gem install flickrmocks

# in your code
require 'flickrmocks'

In Rails 3, add this to your Gemfile.

gem "flickrmocks"

In Rails 2, add this to your environment.rb file.

config.gem "flickrmocks"

Alternatively, you can install it as a plugin.

rails plugin install git://github.com/takaltoo/flickrmocks.git

== Getting Started FlickrMocks API helpers expect the FlickRaw.api_key to be initialized before they are called: FlickRaw.api_key = your_flickr_api_key

In Rails you can automate the initialization by creating the initializer file config/initializers/flickraw_config.rb with the content:

FlickRaw.api_key = your_flickr_api_key[http://www.flickr.com/services/api/misc.api_keys.html]

Alternatively, your flickr api key can be placed into a separate YAML[http://railscasts.com/episodes/85-yaml-configuration-file] configuration file. In this scenario the contents of the config/initializers/flickrwa_config.rb would be something like:

FlickRaw.api_key = APP_CONFIG['flickr_api_key']

Your config/config.yml could look something similar to this (Note: you can use this file to place all your custom configurations):

development:
  flickr_api_key: xyz
test:
  flickr_api_key: xyz
production:
  flickr_api_key: xyz

== Using the search API FlickrMocks::Api.photo(options_hash), returns object of class FlickrMocks::Photo. The options accepted include: :photo_id => "id for photo" :secret => "secret for photo" FlickrMocks::Api.photo_details(options_hash), returns object of class FlickrMocks::PhotoDetails. The options accepted include: :photo_id => "id for photo" :secret => "secret for photo" FlickrMocks::Api.photos(options_hash), returns object of class FlickrMocks::PhotoSearch. The options accepted include: :search_terms => 'search terms' # comma separated list of search terms 'happy cow, pasture' :owner_id => 'id for owner of photo' # either :owner_id or :search_terms must be specified :tag_mode => 'all' # optional argument, can be either all or any :per_page => '50' # optional argument, can be any number greater than 0 :page => '1' # optional argument, can be any number greater than 0 :base_url => 'url' # optional argument FlickrMocks::Api.photo_sizes(options_hash), returns object of class FlickrMocks::PhotoSizes. The options accepted include: :photo_id => "id for photo" :secret => "secret for photo" # optional argument FlickrMocks::Api.interesting_photos(options_hash), returns object of class FlickrMocks::PhotoSearch. The options accepted include: :date => '2010-10-10' # date of format YYYY-MM-DD :per_page => 'number' # optional argument :page => 'number' # optional argument FlickrMocks::Api.commons_institutions(options_hash), returns object of class FlickrMocks::CommonsInstitutions. The options accepted include: :per_page => 'number' # optional argument :current_page => 'number' # optional argument

== Stubs for testing FlickrMocks provides Rspec 2.0 stubs for the search API routines. To stub all the routines simply call:

FlickrMocks::Stubs::Api.all

By calling FlickrMocks::Stubs::Api.all the following methods will be stubbed. FlickrMocks::Api.photo FlickrMocks::Api.photos FlickrMocks::Api.photo_details FlickrMocks::Api.photo_sizes FlickrMocks::Api.interesting_photos FlickrMocks::Api.commons_institutions

NOTE: the stubs return errors when not called with proper options. Moreover, some of the stubs return different objects depending on how they are called. For additional details please refer RDocs[http://rdoc.info/projects/takaltoo/flickrmocks].

== Additional Docs

== Questions or Problems?

If you have any issues with FlickrMocks which you cannot find the solution to in the documentation, please add an issue on GitHub[http://github.com/takaltoo/flickrmocks/issues] or fork the project and send a pull request.

To get the specs running you should call +bundle+ and then +rake+.

== Note on Patches/Pull Requests

  • Fork the project.
  • Make your feature addition or bug fix.
  • Add tests for it. This is important so I do not break it in a future version unintentionally.
  • Commit, do not mess with rakefile, version, or history. (if you want to have your own version, that is fine but bump version in a commit by itself I can ignore when I pull)
  • Send me a pull request.

== License

FlickrMocks is released under the MIT license.

== Copyright

Copyright (c) 2010 Takaltoo

FAQs

Package last updated on 15 Jan 2011

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc