Module: Smile
- Defined in:
- lib/smile/base.rb,
lib/smile.rb,
lib/smile/smug.rb,
lib/smile/json.rb,
lib/smile/common.rb,
lib/smile/session.rb,
lib/smile/version.rb,
lib/smile/exception.rb
Overview
smug.rb
smile
Created by Zac Kleinpeter on 2009-04-28.
Defined Under Namespace
Modules: Common, ParamConverter Classes: Album, Base, Exception, Json, Photo, Session, Smug
Constant Summary
- VERSION =
"0.4.4"
Instance Method Summary (collapse)
-
- (Smile::SmugMug.new) auth(email, password)
Login to SmugMug using a specific user account.
-
- (Smile::SmugMug.new) auth_anonymously
Login to SmugMug using an anonymously account This will allow you to execute many functions, but no user specific functions.
-
- (Object) search(data, options = {})
Search SmugMug for pics.
-
- (RestClientResponse) search_raw(data, options = {})
Raw feed from the SmugMug data feeds.
-
- (Array<Smile::Photo>) search_rss(data, options = {})
Search SmugMug for pics.
Instance Method Details
- (Smile::SmugMug.new) auth(email, password)
Login to SmugMug using a specific user account.
40 41 42 43 44 |
# File 'lib/smile.rb', line 40 def auth( email, password ) smug = Smile::Smug.new smug.auth( email, password ) smug end |
- (Smile::SmugMug.new) auth_anonymously
Login to SmugMug using an anonymously account This will allow you to execute many functions, but no user specific functions
28 29 30 31 32 |
# File 'lib/smile.rb', line 28 def auth_anonymously smug = Smile::Smug.new smug.auth_anonymously smug end |
- (Object) search(data, options = {})
Search SmugMug for pics. This search is slower than the others, but returns Smile::Photo objects
pulling more details from every photo.
83 84 85 86 87 88 89 |
# File 'lib/smile.rb', line 83 def search( data, ={} ) auth_anonymously search_rss(data,).items.map do |item| image_id, image_key = item.link.split('/').last.split('#').last.split('_') Smile::Photo.find( :image_id => image_id, :image_key => image_key ) end end |
- (RestClientResponse) search_raw(data, options = {})
Raw feed from the SmugMug data feeds
138 139 140 141 |
# File 'lib/smile.rb', line 138 def search_raw( data, ={} ) .merge!( :type => 'keyword', :data => data ) base_feed( ) end |
- (Array<Smile::Photo>) search_rss(data, options = {})
Search SmugMug for pics. This search is slower than the others, but returns Smile::Photo objects
112 113 114 115 |
# File 'lib/smile.rb', line 112 def search_rss( data, ={} ) raw = search_raw( data, ) RSS::Parser.parse( raw, false ) || OpenStruct.new( :items => [] ) end |