reagent / fleakr

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

This URL has Read+Write access

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