Golem.de API

Golem  alpha

Golem.de API > Golem > Golem.Api.Article.Latest
Search:
 
Filters

Class Golem.Api.Article.Latest - extends Golem.Api

Get a list of the latest articles via Golem web interface

Constructor

Golem.Api.Article.Latest ( maxArticles )
Parameters:
maxArticles <Integer> the number of top articles

Properties

ERROR_LIMIT - {Integer}

Indicates, that the article limit is out of the valid range

maxArticles - protected {Integer}

Count of latest articles to fetch

TYPE - protected {String}

The type of access method for the web service

URL - protected {String}

The URL of the used web service

Methods

each

void each ( fnCallback , params )
Traverses through the article list.

After a succesful request you can traverse through the article list. You pass a callback function to the method, and the method is called for each article

The first argument to this callback function is an article object with the properties:

  • articleid - {Integer} - The article identifier
  • headline - {String(60)} - The article headline
  • abstracttext - {String} - The article abstract
  • url - {String} - The article URL
  • date - {Integer} - publishing date as unix timestamp
  • images - {Integer} - the number of associated images
  • leadimg - {Object} - The article headline image
    • url - {String} - the image URL
    • width - {Integer} - the image width
    • height - {Integer} - the image height
The second argument will be the data provided by params.

Parameters:
fnCallback <Function> - the callback function to call for each article
params <Mixed> - additional data passed to the callback function
Returns: void

fetch

void fetch ( obj )
Fetches the list of latest articles via web service

In case of a successful request, the obj.fnSuccess-callback function will be called. The first argument for the callback method is the result data of the request. The second argument will be the data provided by obj.params.

In case of a failed request, the obj.fnError callback function will be called. The first argument to the callback is the error code, the second ist the error message.

Parameters:
obj <Object> - Object literal specifing the callback methods
Returns: void

fetchEach

void fetchEach ( fnCallback , params )
Shortcut method for traversing the article data

Fetches the articles via fetch() first and then calls fnCallback for every article record like each() does.

There is no way to handle errors with this method!

Parameters:
fnCallback <Function> - Function to call for every article record
params <Mixed> - additional data to pass to the callback function
Returns: void


Copyright © 2010 Golem.de.