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



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

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



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

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



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

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



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

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



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

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