com. kelvinluck. flashr. core. FlashrApiResponse

Internal class which deals with parsing the XML returned from flickr.com.

This functionality was originally contained within Flashr.as but had to be moved out when the Flashr class broke Flash’s 32K of bytecode per class limit.  You shouldn’t need to directly call or use anything in this class - if you do it will break all the queuing etc which is dealt with in Flashr.

See Also

Flashr, http://www.flickr.com/services/api/

Licence

This code and documentation is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 2.0.  http://creativecommons.org/licenses/by-nc-sa/2.0/

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS “AS IS” AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

Version

0.5.0

Author

Kelvin Luck < kelvin at kelvinluck dot com >

Project Website

http://flashr.kelvinluck.com/

Subversion Id

$Id: FlashrApiResponse.as 84 2007-03-11 21:18:17Z kluck $

Summary
com. kelvinluck. flashr. core. FlashrApiResponseInternal class which deals with parsing the XML returned from flickr.com.
FlashrApiResponsePrivate constructor (singleton)
onAPIResponseCalled internally on recepit of a response from a request to the Flashr.REST_ENDPOINT.
_parsePhotoXmlPrivate internal function used to avoid duplicate code to parse “the standard photo list xml”
_parsePhotosetXmlPrivate internal function used to avoid duplicate code when parsing the standard photoset XML
_parseContextXmlPrivate internal function used to avoid duplicate code when parsing the standard context XML
getInstanceReturns the one and only instance of this class.
toString

FlashrApiResponse

private function FlashrApiResponse()

Private constructor (singleton)

onAPIResponse

private function onAPIResponse(success: Boolean):Void

Called internally on recepit of a response from a request to the Flashr.REST_ENDPOINT.  Interperets the received XML and broadcasts an onAPIResponse event to any registered listeners.  If the XML was the result of a known method call then the broadcast event will include sensible information, otherwise it will just be the XML for parsing outside this class (e.g. if a new method has been added to the Flickr.com API and not programmed into this class).

Parameters

successWhether the call to the API was successfull (e.g. the server specfied in Flashr.REST_ENDPOINT was connected to) or not.

_parsePhotoXml

private function _parsePhotoXml(px: XMLNode,
owner: Person):ResultsSet

Private internal function used to avoid duplicate code to parse “the standard photo list xml”

Params

pxThe “standard photo list xml” from flickr.
ownerA Person if we know who created all these Photos (as is the case for a response from flickr.photosets.getPhotos)

Returns

A ResultsSet.

_parsePhotosetXml

private function _parsePhotosetXml(photosetXml: XMLNode,
owner: Person):Photoset

Private internal function used to avoid duplicate code when parsing the standard photoset XML

Parameters

photosetXmlAn XML node describing a photoset.
ownerThe owner of this Photoset - leave as undefined if they exist as an attribute in the XML...

Returns

The created Photoset.

_parseContextXml

private function _parseContextXml(contextXML: XMLNode):Object

Private internal function used to avoid duplicate code when parsing the standard context XML

Parameters

contextXMLThe contextXML to parse

Returns

An object containing count:Number, prevphoto:Photo and nextphoto:Photo

getInstance

public static function getInstance():FlashrApiResponse

Returns the one and only instance of this class.

toString

public function toString():String
private function FlashrApiResponse()
Private constructor (singleton)
private function onAPIResponse(success: Boolean):Void
Called internally on recepit of a response from a request to the Flashr.REST_ENDPOINT.
static var REST_ENDPOINT: String
The place for all API calls to connect to.
private function _parsePhotoXml(px: XMLNode,
owner: Person):ResultsSet
Private internal function used to avoid duplicate code to parse “the standard photo list xml”
private function _parsePhotosetXml(photosetXml: XMLNode,
owner: Person):Photoset
Private internal function used to avoid duplicate code when parsing the standard photoset XML
private function _parseContextXml(contextXML: XMLNode):Object
Private internal function used to avoid duplicate code when parsing the standard context XML
public static function getInstance():FlashrApiResponse
Returns the one and only instance of this class.
public function toString():String
Flashr is an ActionScript 2 wrapper for the Flickr API.
Class to describe a person from Flickr.
Class to describe a photo from Flickr.
Handles the search responses from flickr.com packaging them up with relevant information about the query.
Describes a Photoset on flickr.com