Class: Flickr::Urls

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

Instance Attribute Summary

Attributes inherited from APIBase

#flickr

Instance Method Summary collapse

Methods inherited from APIBase

#initialize

Constructor Details

This class inherits a constructor from Flickr::APIBase

Instance Method Details

#getGroup(group) ⇒ Object



4
5
6
7
8
9
# File 'lib/flickr/urls.rb', line 4

def getGroup(group)
	group = group.nsid if group.class == Flickr::Group
	res = @flickr.call_method('flickr.urls.getGroup',
		'group_id' => group)
	return res.elements['/group'].attributes['url']
end

#getUserPhotos(user) ⇒ Object



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

def getUserPhotos(user)
	user = user.nsid if user.respond_to?(:nsid)
	args = {}
	args['user_id'] = user if user
	res = @flickr.call_method('flickr.urls.getUserPhotos',args)
	return res.elements['/user'].attributes['url']
end

#getUserProfile(user) ⇒ Object



19
20
21
22
23
24
25
# File 'lib/flickr/urls.rb', line 19

def getUserProfile(user)
	user = user.nsid if user.respond_to?(:nsid)
	args = {}
	args['user_id'] = user if user
	res = @flickr.call_method('flickr.urls.getUserProfile',args)
	return res.elements['/user'].attributes['url']
end

#lookupGroup(url) ⇒ Object



27
28
29
30
31
32
33
34
35
36
37
# File 'lib/flickr/urls.rb', line 27

def lookupGroup(url)
	res = @flickr.call_method('flickr.urls.lookupGroup','url'=>url)
	els = res.elements
	nsid = els['/group'].attributes['id']

	g = @flickr.group_cache_lookup(nsid) ||
		Flickr::Group.new(@flickr,nsid,
				els['/group/groupname'].text)
	@flickr.group_cache_store(g)
	return g
end

#lookupUser(url) ⇒ Object



39
40
41
42
43
44
45
46
47
48
# File 'lib/flickr/urls.rb', line 39

def lookupUser(url)
	res = @flickr.call_method('flickr.urls.lookupUser','url'=>url)
	els = res.elements
	nsid = els['/user'].attributes['id']
	p = @flickr.person_cache_lookup(nsid) ||
		Flickr::Person.new(@flickr,nsid,
			els['/user/username'].text)
	@flickr.person_cache_store(p)
	return p
end