reagent / fleakr

A small, yet powerful, gem to interface with Flickr photostreams

This URL has Read+Write access

reagent (author)
Fri Dec 05 22:20:43 -0800 2008
commit  72d796e97f256a027e01b89e7f82f8cc6dfac70e
tree    2e5ab10415eb566fcc362fc84e7a49ea42308988
parent  0121127ac48a0609eaeef18a2311773dcf321f4e
fleakr / README.rdoc
72d796e9 » reagent 2008-12-05 Added RDoc to source files ... 1 = Fleakr
866e035c » reagent 2008-11-02 Initial commit 2
72d796e9 » reagent 2008-12-05 Added RDoc to source files ... 3 == Description
866e035c » reagent 2008-11-02 Initial commit 4
5 A teeny tiny gem to interface with Flickr photostreams
6
72d796e9 » reagent 2008-12-05 Added RDoc to source files ... 7 == Installation
866e035c » reagent 2008-11-02 Initial commit 8
eaeea626 » reagent 2008-11-29 Updated example; removed TO... 9 sudo gem install reagent-fleakr --source=http://gems.github.com
caa37c17 » reagent 2008-11-29 Updated README file to incl... 10
11 Or ...
12
13 $ git clone git://github.com/reagent/fleakr.git
14 $ cd fleakr
15 $ rake gem && sudo gem install pkg/fleakr-<version>.gem
866e035c » reagent 2008-11-02 Initial commit 16
72d796e9 » reagent 2008-12-05 Added RDoc to source files ... 17 == Usage
866e035c » reagent 2008-11-02 Initial commit 18
caa37c17 » reagent 2008-11-29 Updated README file to incl... 19 Before doing anything, require the library:
20
21 >> require 'rubygems'
22 >> require 'fleakr'
23
24 Then, set your API key (only need to do this once per session):
25
0121127a » reagent 2008-12-05 Update README to reflect AP... 26 >> Fleakr.api_key = '<your api key here>'
caa37c17 » reagent 2008-11-29 Updated README file to incl... 27
28 Find a user by username:
29
0121127a » reagent 2008-12-05 Update README to reflect AP... 30 >> user = Fleakr.user('the decapitator')
31 => #<Fleakr::Objects::User:0x692648 @username="the decapitator", @id="21775151@N06">
caa37c17 » reagent 2008-11-29 Updated README file to incl... 32
1c69d9ad » reagent 2008-12-02 Updated documentation to re... 33 Or by email:
34
0121127a » reagent 2008-12-05 Update README to reflect AP... 35 >> user = Fleakr.user('user@host.com')
36 => #<Fleakr::Objects::User:0x11f484c @username="bckspcr", @id="84481630@N00">
1c69d9ad » reagent 2008-12-02 Updated documentation to re... 37
38 Once you have a user, you can find his associated sets:
caa37c17 » reagent 2008-11-29 Updated README file to incl... 39
40 >> user.sets
0121127a » reagent 2008-12-05 Update README to reflect AP... 41 => [#<Fleakr::Objects::Set:0x671358 @title="The Decapitator", @description="">,
42 #<Fleakr::Objects::Set:0x66d898 @title="londonpaper hijack", ...
eaeea626 » reagent 2008-11-29 Updated example; removed TO... 43
1c69d9ad » reagent 2008-12-02 Updated documentation to re... 44 Or groups if you would like:
1614c050 » reagent 2008-11-30 Updated README to reflect g... 45
46 >> user.groups
0121127a » reagent 2008-12-05 Update README to reflect AP... 47 => [#<Fleakr::Objects::Group:0x11f2330 ...,
48 #<Fleakr::Objects::Group:0x11f2308 ...
1614c050 » reagent 2008-11-30 Updated README to reflect g... 49 >> user.groups.first.name
50 => "Rural Decay"
51 >> user.groups.first.id
52 => "14581414@N00"
53
1c69d9ad » reagent 2008-12-02 Updated documentation to re... 54 When accessing a set, you can also grab all the photos that are in that set:
11978883 » reagent 2008-11-29 Update examples in document... 55
56 >> user.sets.first
0121127a » reagent 2008-12-05 Update README to reflect AP... 57 => #<Fleakr::Objects::Set:0x1195bbc @title="The Decapitator", @id="72157603480986566", @description="">
11978883 » reagent 2008-11-29 Update examples in document... 58 >> user.sets.first.photos.first
0121127a » reagent 2008-12-05 Update README to reflect AP... 59 => #<Fleakr::Objects::Photo:0x1140108 ... >
11978883 » reagent 2008-11-29 Update examples in document... 60 >> user.sets.first.photos.first.title
61 => "Untitled1"
1c69d9ad » reagent 2008-12-02 Updated documentation to re... 62
63 If a photo interests you, save it down to a directory of your choosing:
64
65 >> user.sets.first.photos.first.small.save_to('/tmp')
66 => #<File:/tmp/2117922283_715587b2cb_m.jpg (closed)>
67
68 If you can't decide on a photo and would rather just save the whole set, specify the target directory
69 and the size of the images you're interested in:
70
71 >> user.sets.first.save_to('/tmp', :square)
0121127a » reagent 2008-12-05 Update README to reflect AP... 72 => [#<Fleakr::Objects::Photo:0x1187a1c @secret="715587b2cb" ...
1c69d9ad » reagent 2008-12-02 Updated documentation to re... 73 >> Dir["/tmp/#{user.sets.first.title}/*.jpg"].map
74 => ["/tmp/The Decapitator/2117919621_8b2d601bff_s.jpg",
75 "/tmp/The Decapitator/2117921045_5fb15eff90_s.jpg",
76 "/tmp/The Decapitator/2117922283_715587b2cb_s.jpg", ...
11978883 » reagent 2008-11-29 Update examples in document... 77
ac1e3263 » reagent 2008-12-02 Updated docs to reflect sea... 78 If you would prefer to just search photos, you can do that with search text:
237efab4 » reagent 2008-12-01 Added documentation for sea... 79
0121127a » reagent 2008-12-05 Update README to reflect AP... 80 >> search = Fleakr::Objects::Search.new('ponies!!')
ac1e3263 » reagent 2008-12-02 Updated docs to reflect sea... 81 >> search.results
0121127a » reagent 2008-12-05 Update README to reflect AP... 82 => [#<Fleakr::Objects::Photo:0x11f4e64 @title="hiroshima atomic garden", @id="3078234390">,
83 #<Fleakr::Objects::Photo:0x11f4928 @title="PONYLOV", @id="3077360853">, ...
ac1e3263 » reagent 2008-12-02 Updated docs to reflect sea... 84 >> search.results.first.title
85 => "hiroshima atomic garden"
86
87 You can also search based on tags:
88
0121127a » reagent 2008-12-05 Update README to reflect AP... 89 >> search = Fleakr::Objects::Search.new(nil, :tags => 'macro')
9c782f33 » reagent 2008-12-01 Fixed README formatting 90 >> search.results.first.title
91 => "Demure"
92 >> search.results.first.id
93 => "3076049945"
237efab4 » reagent 2008-12-01 Added documentation for sea... 94
72d796e9 » reagent 2008-12-05 Added RDoc to source files ... 95 == TODO
866e035c » reagent 2008-11-02 Initial commit 96
caa37c17 » reagent 2008-11-29 Updated README file to incl... 97 * Implement remaining bits of person, photoset, and photo-releated APIs
0121127a » reagent 2008-12-05 Update README to reflect AP... 98 * Provide a better searching interface
99 * Lazily load attributes for objects that need to be accessed via secondary API call
caa37c17 » reagent 2008-11-29 Updated README file to incl... 100
72d796e9 » reagent 2008-12-05 Added RDoc to source files ... 101 == License
866e035c » reagent 2008-11-02 Initial commit 102
103 Copyright (c) 2008 Patrick Reagan (reaganpr@gmail.com)
104
105 Permission is hereby granted, free of charge, to any person
106 obtaining a copy of this software and associated documentation
107 files (the "Software"), to deal in the Software without
108 restriction, including without limitation the rights to use,
109 copy, modify, merge, publish, distribute, sublicense, and/or sell
110 copies of the Software, and to permit persons to whom the
111 Software is furnished to do so, subject to the following
112 conditions:
113
114 The above copyright notice and this permission notice shall be
115 included in all copies or substantial portions of the Software.
116
117 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
118 EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
119 OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
120 NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
121 HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
122 WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
123 FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
124 OTHER DEALINGS IN THE SOFTWARE.