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



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

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



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

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



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

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



47
48
49
50
51
52
53
54
55
56
57
# File 'lib/flickr/urls.rb', line 47

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



59
60
61
62
63
64
65
66
67
68
# File 'lib/flickr/urls.rb', line 59

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