Class: Flickr::Group

Inherits:
Object
  • Object
show all
Includes:
Proxy
Defined in:
lib/simple-flickr/group.rb

Overview

Represents a Flickr Group

You can find the Flickr::Group by the NSID

Instance Attribute Summary

Attributes included from Proxy

#attributes

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Proxy

#id, included, #method_missing

Constructor Details

#initialize(xml, client) ⇒ Group

:nodoc:



9
10
11
12
13
14
15
16
# File 'lib/simple-flickr/group.rb', line 9

def initialize( xml, client ) # :nodoc: 
  super( xml, client )

  @attributes['id'] = xml['nsid'] || xml['id']
  @attributes['name'] ||= xml.search('name').text
  @attributes['description'] ||= xml.search('description').text
  @attributes['members'] = xml.search('members').text.to_i 
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Flickr::Proxy

Class Method Details

.find_by_id(nsid, client) ⇒ Object



18
19
20
21
22
23
# File 'lib/simple-flickr/group.rb', line 18

def self.find_by_id( nsid, client )
  return nil unless nsid.is_a? String
  xml = client.request( 'groups.getInfo', :group_id => nsid )

  new( xml.at('group'), client )
end

Instance Method Details

#photos(options = {}) ⇒ Object



25
26
27
# File 'lib/simple-flickr/group.rb', line 25

def photos( options = {} )
  Photo.api_query( 'photos.search', @client, :group_id => id )
end