This repository is private.
All pages are served over SSL and all pushing and pulling is done over SSH.
No one may fork, clone, or view it unless they are added as a member.
Every repository with this icon (
) is private.
Every repository with this icon (
This repository is public.
Anyone may fork, clone, or view it.
Every repository with this icon (
) is public.
Every repository with this icon (
Ismael Celis (author)
Thu May 15 08:40:51 -0700 2008
commit 534627012ae60c3cbbd04d8bce696764b770e780
tree c43d82a016b934bce78b07f2c9aee8d5679e9939
parent 1c13528fa7faf92186ad48a2d5eaec3f7d8db572
tree c43d82a016b934bce78b07f2c9aee8d5679e9939
parent 1c13528fa7faf92186ad48a2d5eaec3f7d8db572
mini_flickr / README.txt
| 00551ff5 » | ismasan | 2008-05-14 | 1 | = mini_flickr | |
| 2 | |||||
| 089564a5 » | ismasan | 2008-05-14 | 3 | * http://github.com/ismasan/mini_flickr/tree/master | |
| 00551ff5 » | ismasan | 2008-05-14 | 4 | ||
| 5 | == DESCRIPTION: | ||||
| 6 | |||||
| 089564a5 » | ismasan | 2008-05-14 | 7 | Simple gem to fetch your Flickr photos through Flickr's REST API | |
| 8 | |||||
| 9 | Get your Flickr API_KEY at http://www.flickr.com/services/api/keys/ | ||||
| 10 | |||||
| 11 | Get your Flickr user id at http://idgettr.com/ | ||||
| 00551ff5 » | ismasan | 2008-05-14 | 12 | ||
| 13 | == FEATURES/PROBLEMS: | ||||
| 14 | |||||
| f47d2fc9 » | ismasan | 2008-05-14 | 15 | * For now it just fetches the latest 30 photos | |
| 16 | |||||
| 17 | * This is not meant to upload photos to Flickr | ||||
| 00551ff5 » | ismasan | 2008-05-14 | 18 | ||
| 19 | == SYNOPSIS: | ||||
| 20 | |||||
| 1c13528f » | ismasan | 2008-05-15 | 21 | === Class level configuration | |
| 22 | |||||
| 089564a5 » | ismasan | 2008-05-14 | 23 | class MyFlickr | |
| 24 | include MiniFlickr::Base | ||||
| 25 | connect_to_flickr :api_key => 'your-api-key', :user_id => 'your-user-id' | ||||
| 26 | end | ||||
| 27 | |||||
| 28 | flickr = MyFlickr.new | ||||
| 29 | |||||
| 30 | <% flickr.photos.each do |photo| %> | ||||
| 31 | <a href="<%= photo.medium_url %>"> | ||||
| 32 | <img src="<%= photo.small %>" /> | ||||
| 33 | </a> | ||||
| 34 | <% end %> | ||||
| 35 | |||||
| 1c13528f » | ismasan | 2008-05-15 | 36 | === Instance level configuration | |
| 37 | |||||
| 38 | There's also a utility class that takes api_key and user_id as parameters. | ||||
| 39 | This means you can configure Flickr accounts per-instance (for example your site has many users, each with their own Flickr photos). | ||||
| 40 | |||||
| 41 | flickr = MiniFlickr::Simple.new('some-key', 'some-user-id') | ||||
| 42 | |||||
| 43 | flickr.photos # => collection of MiniFlickr::Photo objects with sizes and url's (see above) | ||||
| 44 | |||||
| 45 | You can also use this as a value object for ActiveRecord, for example. | ||||
| 46 | |||||
| 47 | class Flickr < MiniFlickr::Simple; end | ||||
| 48 | |||||
| 49 | class User < ActiveRecord::Base | ||||
| 50 | composed_of :flickr, :mappings => %w(api_key flickr_user_id) | ||||
| 51 | end | ||||
| 52 | |||||
| 53 | user = User.create(:name => 'Ismael', :api_key => 'some-api-key', :flickr_user_id => 'some-flickr-userid') | ||||
| 54 | |||||
| 55 | user.flickr.photos # collection of flickr photos | ||||
| 56 | |||||
| 6924f792 » | ismasan | 2008-05-15 | 57 | == TESTING: | |
| 58 | |||||
| 59 | This gem uses Rspec for testing. Run the existing specs with rake spec. | ||||
| 60 | |||||
| 61 | You'll need to add your own API key in order for the test suite to work. | ||||
| 62 | |||||
| 63 | Do so by storing it in a file called/api_key.txt | ||||
| 64 | |||||
| 65 | If you contribute, please write specs and make sure they pass. | ||||
| 66 | |||||
| 089564a5 » | ismasan | 2008-05-14 | 67 | === Each photo has: | |
| 68 | |||||
| 69 | ==== Source image urls for sizes | ||||
| 70 | |||||
| 71 | photo.square | ||||
| 72 | |||||
| 73 | photo.thumbnail | ||||
| 74 | |||||
| 75 | photo.small | ||||
| 76 | |||||
| 77 | photo.medium | ||||
| 78 | |||||
| 79 | photo.original | ||||
| 80 | |||||
| 81 | ==== Page urls for sizes | ||||
| 82 | |||||
| 83 | photo.square_url | ||||
| 84 | |||||
| 85 | photo.thumbnail_url | ||||
| 86 | |||||
| 87 | photo.small_url | ||||
| 88 | |||||
| 89 | photo.medium_url | ||||
| 90 | |||||
| 91 | photo.original_url | ||||
| 00551ff5 » | ismasan | 2008-05-14 | 92 | ||
| 93 | == REQUIREMENTS: | ||||
| 94 | |||||
| 089564a5 » | ismasan | 2008-05-14 | 95 | * Hpricot (sudo gem install hpricot) | |
| 00551ff5 » | ismasan | 2008-05-14 | 96 | ||
| 97 | == INSTALL: | ||||
| 98 | |||||
| 089564a5 » | ismasan | 2008-05-14 | 99 | * git clone git://github.com/ismasan/mini_flickr.git | |
| 100 | |||||
| 101 | * cd mini_flickr | ||||
| 102 | |||||
| 103 | * rake install_gem | ||||
| 00551ff5 » | ismasan | 2008-05-14 | 104 | ||
| 105 | == LICENSE: | ||||
| 106 | |||||
| 107 | (The MIT License) | ||||
| 108 | |||||
| f47d2fc9 » | ismasan | 2008-05-14 | 109 | Copyright (c) 2008 Ismael Celis | |
| 00551ff5 » | ismasan | 2008-05-14 | 110 | ||
| 111 | Permission is hereby granted, free of charge, to any person obtaining | ||||
| 112 | a copy of this software and associated documentation files (the | ||||
| 113 | 'Software'), to deal in the Software without restriction, including | ||||
| 114 | without limitation the rights to use, copy, modify, merge, publish, | ||||
| 115 | distribute, sublicense, and/or sell copies of the Software, and to | ||||
| 116 | permit persons to whom the Software is furnished to do so, subject to | ||||
| 117 | the following conditions: | ||||
| 118 | |||||
| 119 | The above copyright notice and this permission notice shall be | ||||
| 120 | included in all copies or substantial portions of the Software. | ||||
| 121 | |||||
| 122 | THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, | ||||
| 123 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF | ||||
| 124 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. | ||||
| 125 | IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY | ||||
| 126 | CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, | ||||
| 127 | TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE | ||||
| 128 | SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | ||||







