Class: Flickr::Licenses

Inherits:
APIBase show all
Defined in:
lib/flickr/licenses.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

#getInfoObject



4
5
6
7
8
9
10
11
12
13
14
15
# File 'lib/flickr/licenses.rb', line 4

def getInfo
	return @flickr.license_cache_lookup if
		@flickr.license_cache_lookup
	list = {}
	res = @flickr.call_method('flickr.photos.licenses.getInfo')
	res.elements['/licenses'].each_element do |el|
		lic = Flickr::License.from_xml(el)
		list[lic.id] = lic
	end
	@flickr.license_cache_store(list)
	return list
end

#setLicense(photo, license) ⇒ Object



17
18
19
20
21
22
# File 'lib/flickr/licenses.rb', line 17

def setLicense(photo,license)
	photo = photo.id if photo.class == Flickr::Photo
	license = license.id if license.class == Flickr::License
	@flickr.call_method('flickr.photos.licenses.setLicense',
		'photo_id' => photo, 'license_id' => license)
end