Class: Flickr::Urls

Inherits:
Base show all
Defined in:
lib/flickr/urls.rb

Overview

Wrapping class that holds methods in the flickr.urls namespace

Defined Under Namespace

Classes: UserLookupResult

Constant Summary

Constants inherited from Base

Base::AUTH_ENDPOINT, Base::REST_ENDPOINT, Base::UPLOAD_ENDPOINT

Instance Attribute Summary

Attributes inherited from Base

#api_key, #api_secret, #token, #token_cache

Instance Method Summary collapse

Methods inherited from Base

#auth, #contacts, #people, #photos, #photosets, #send_request, #sign_request, #test, #uploader, #urls

Constructor Details

#initialize(flickr) ⇒ Urls

Returns a new instance of Urls.



3
4
5
# File 'lib/flickr/urls.rb', line 3

def initialize(flickr)
  @flickr = flickr
end

Instance Method Details

#get_group(group_id) ⇒ Object



7
8
9
10
# File 'lib/flickr/urls.rb', line 7

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

#get_user_photos(user_id) ⇒ Object



12
13
14
15
# File 'lib/flickr/urls.rb', line 12

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

#get_user_profile(user_id) ⇒ Object



17
18
19
20
# File 'lib/flickr/urls.rb', line 17

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

#lookup_group(url) ⇒ Object

, options = {}



22
23
24
25
26
27
28
29
30
31
# File 'lib/flickr/urls.rb', line 22

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

#lookup_user(url) ⇒ Object



33
34
35
36
37
38
# File 'lib/flickr/urls.rb', line 33

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