Sha256: b08fff7e375e559c6c19ecb4f12a8568d3e901c60311b2b332428873513f1039

Contents?: true

Size: 1.15 KB

Versions: 31

Compression:

Stored size: 1.15 KB

Contents

# Wrapping class that holds methods in the flickr.urls namespace
class Flickr::Urls < Flickr::Base
  def initialize(flickr)
    @flickr = flickr
  end

  def get_group group_id
    rsp = @flickr.send_request('flickr.urls.getGroup', {:group_id => group_id})
    rsp.group[:url]
  end

  def get_user_photos user_id
    rsp = @flickr.send_request('flickr.urls.getUserPhotos', {:user_id => user_id})
    rsp.user[:url]
  end

  def get_user_profile user_id
    rsp = @flickr.send_request('flickr.urls.getUserProfile', {:user_id => user_id})
    rsp.user[:url]
  end

  def lookup_group url #, options = {}
    #options.symbolize_keys!
    #options.reverse_merge!({:include_groupname => false})
    rsp = @flickr.send_request('flickr.urls.lookupGroup', {:url => url})
    #if options[:include_groupname]
    #[rsp.group[:id], {:groupname => rsp.group.groupname}]
    #else
    rsp.group[:id]
    #end
  end

  def lookup_user url
    rsp = @flickr.send_request('flickr.urls.lookupUser', {:url => url})
    user_id = UserLookupResult.new(rsp.user[:id])
    user_id.username = rsp.user.username
    user_id
  end

  class UserLookupResult < String
    attr_accessor :username
  end
  
end

Version data entries

31 entries across 31 versions & 11 rubygems

Version Path
flickr_fu-0.3.4 lib/flickr/urls.rb
flickr_fu-0.3.3 lib/flickr/urls.rb
ayn-flickr_fu-0.3.5 lib/flickr/urls.rb
ayn-flickr_fu-0.3.6 lib/flickr/urls.rb
ayn-flickr_fu-0.3.7 lib/flickr/urls.rb
ayn-flickr_fu-0.3.9 lib/flickr/urls.rb
commonthread-flickr_fu-0.3.0 lib/flickr/urls.rb
maciej-flickr_fu-0.3.0 lib/flickr/urls.rb
rmm5t-flickr_fu-0.3.1 lib/flickr/urls.rb
rschenk-flickr_fu-0.3.2 lib/flickr/urls.rb
fotonauts-flickr_fu-0.3.8 lib/flickr/urls.rb
fotonauts-flickr_fu-0.3.7 lib/flickr/urls.rb
fotonauts-flickr_fu-0.3.6 lib/flickr/urls.rb
flickr_fu-0.3.2 lib/flickr/urls.rb
fotonauts-flickr_fu-0.3.4 lib/flickr/urls.rb
fotonauts-flickr_fu-0.3.3 lib/flickr/urls.rb
fotonauts-flickr_fu-0.3.2 lib/flickr/urls.rb
flickr_fu-0.3.1 lib/flickr/urls.rb
tomk32-flickr_fu-0.3.4.1 lib/flickr/urls.rb
userharmony-flickr_fu-0.3.6 lib/flickr/urls.rb