man Bric::SOAP::Story () - SOAP interface to Bricolage stories.

NAME

Bric::SOAP::Story - SOAP interface to Bricolage stories.

VERSION

$LastChangedRevision$

DATE

$LastChangedDate: 2005-07-10 21:05:35 -0700 (Sun, 10 Jul 2005) $

SYNOPSIS

  use SOAP::Lite;
  import SOAP::Data 'name';

  # setup soap object to login with
  my $soap = new SOAP::Lite
    uri      => 'http://bricolage.sourceforge.net/Bric/SOAP/Auth',
    readable => DEBUG;
  $soap->proxy('http://localhost/soap',
               cookie_jar => HTTP::Cookies->new(ignore_discard => 1));
  # login
  $soap->login(name(username => USER),
               name(password => PASSWORD));

  # set uri for Story module
  $soap->uri('http://bricolage.sourceforge.net/Bric/SOAP/Story');

  # get a list of story_ids for published stories w/ "foo" in their title
  my $story_ids = $soap->list_ids(name(title          => '%foo%'),
                                  name(publish_status => 1)     )->result;

  # export a story
  my $xml = $soap->export(name(story_id => $story_id)->result;

  # create a new story from an xml document
  my $story_ids = $soap->create(name(document => $xml_document)
                                ->type('base64'))->result;

  # update an existing story from an xml document
  my $story_ids = $soap->update(name(document => $xml_document)->type('base64'),
                                name(update_ids =>
                                     [ name(story_id => 1024) ]))->result;

DESCRIPTION

This module provides a SOAP interface to manipulating Bricolage stories.

INTERFACE

Public Class Methods

list_ids
This method queries the story database for matching stories and returns a list of ids. If no stories are found an empty list will be returned. This method can accept the following named parameters to specify the search. Some fields support matching and are marked with an (M). The value for these fields will be interpreted as an SQL match expression and will be matched case-insensitively. Other fields must specify an exact string to match. Match fields combine to narrow the search results (via ANDs in an SQL WHERE clause).
title (M)
The story's title.
description (M)
The story's description.
slug (M)
The story's slug.
category
A category containing the story, given as the complete category path from the root. Example: /news/linux.
keyword (M)
A keyword associated with the story.
simple (M)
a single OR search that hits title, description, primary_uri and keywords.
workflow
The name of the workflow containing the story. (ex. Story)
no_workflow
Set to 1 to return only stories that are out of workflow. This is true after stories are published and until they are recalled into workflow for editing.
primary_uri (M)
The primary uri of the story.
priority
The priority of the story.
publish_status
Stories that have been published have a publish_status of 1, otherwise 0. This value never changes after being turned on. For a more accurate read on a story's current status see no_workflow above.
element
The name of the top-level element for the story. Also known as the Story Type. This value corresponds to the element attribute on the story element in the asset schema.
site
The name of the site which the story is in.
publish_date_start
Lower bound on publishing date. Given in XML Schema dateTime format (CCYY-MM-DDThh:mm:ssTZ).
publish_date_end
Upper bound on publishing date. Given in XML Schema dateTime format (CCYY-MM-DDThh:mm:ssTZ).
first_publish_date_start
Lower bound on the first date a story was published. Given in XML Schema dateTime format (CCYY-MM-DDThh:mm:ssTZ).
first_publish_date_end
Upper bound on the first date a story was published. Given in XML Schema dateTime format (CCYY-MM-DDThh:mm:ssTZ).
cover_date_start
Lower bound on cover date. Given in XML Schema dateTime format (CCYY-MM-DDThh:mm:ssTZ).
cover_date_end
Upper bound on cover date. Given in XML Schema dateTime format (CCYY-MM-DDThh:mm:ssTZ).
expire_date_start
Lower bound on cover date. Given in XML Schema dateTime format (CCYY-MM-DDThh:mm:ssTZ).
expire_date_end
Upper bound on cover date. Given in XML Schema dateTime format (CCYY-MM-DDThh:mm:ssTZ).
element_key_name (M)
The key name of the top-level element for the story. This is more accurate than the CWelement parameter, since there can be multiple elements with the same name.
unexpired
Set to a true value to get a list of only unexpired stories.
subelement_key_name (M)
The key name for a container element that's a subelement of a story.
data_text (M)
Text stored in the fields of the story element or any of its subelements. Only fields that use the short storage type will be searched.
output_channel
The name of an ouput channel that stories must be associated with.
contrib_id
A Bricolage contributor object ID. Only stories associated with that contributor will have their IDs listed. Throws:
Exception::AP
Side Effects: NONE Notes: In addition to the parameters listed above, you can use most of the parameters listed in the documentation for the list method in Bric::Biz::Asset::Business::Story.
export
The export method retrieves a set of stories from the database, serializes them and returns them as a single XML document. See Bric::SOAP for the schema of the returned document. Accepted paramters are:
story_id
Specifies a single story_id to be retrieved.
story_ids
Specifies a list of story_ids. The value for this option should be an array of interger story_id elements.
export_related_media
If set to 1 any related media attached to the story will be included in the exported document. The story will refer to these included media objects using the relative form of related-media linking. (see the XML Schema document in Bric::SOAP for details)
export_related_stories
If set to 1 then the export will work recursively across related stories. If export_media is also set then media attached to related stories will also be returned. The story element will refer to the included story objects using relative references (see the XML Schema document in Bric::SOAP for details). Throws:
Exception::AP
Side Effects: NONE Notes: NONE
create
The create method creates new objects using the data contained in an XML document of the format created by export(). The create will fail if your story element contains non-relative related_story_ids or related_media_ids that do not refer to existing stories or media in the system. Related stores and media can be identified by either an ID (set the relative attribute to 1 if it refers to an ID elsewhere in the same XML file) or by URI (primary URI for stories) and site ID. If CWrelated_story_uri or CWrelated_media_uri is specified without an accompanying CWrelated_site_id the related document's site is assumed to be the same as the current story or media document. Returns a list of new story_ids and media_ids created in the order of the assets in the document. Available options:
document (required)
The XML document containing objects to be created. The document must contain at least one story and may contain any number of related media objects.
workflow
Specifies the initial workflow the story is to be created in
desk
Specifies the initial desk the story is to be created on Throws:
Exception::AP
Side Effects: NONE Notes: The setting for publish_status in the incoming story is ignored and always 0 for new stories. New stories are put in the first story workflow unless you pass in the --workflow option. The start desk of the workflow is used unless you pass the --desk option.
update
The update method updates stories using the data in an XML document of the format created by export(). A common use of update() is to export() a selected story, make changes to one or more fields and then submit the changes with update(). Returns a list of new story_ids and media_ids updated or created in the order of the assets in the document. Takes the following options:
document (required)
The XML document where the objects to be updated can be found. The document must contain at least one story and may contain any number of related media objects.
update_ids (required)
A list of story_id integers for the assets to be updated. These must match id attributes on story elements in the document. If you include objects in the document that are not listed in update_ids then they will be treated as in create(). For that reason an update() with an empty update_ids list is equivalent to a create().
workflow
Specifies the workflow to move the story to
desk
Specifies the desk to move the story to Throws:
Exception::AP
Side Effects: NONE Notes: The setting for publish_status in a newly created story is ignored and always 0 for new stories. Updated stories do get publish_status set from the document setting.
delete
The delete() method deletes stories. It takes the following options:
story_id
Specifies a single story_id to be deleted.
story_ids
Specifies a list of story_ids to delete. Throws:
Exception::AP
Side Effects: NONE Notes: NONE
$self->module
Returns the module name, that is the first argument passed to bric_soap.
is_allowed_param
Returns true if CW$param is an allowed parameter to the CW$method method.

Private Class Methods

$pkg->load_asset($args)
This method provides the meat of both create() and update(). The only difference between the two methods is that update_ids will be empty on create(). Serializes a single story into a <story> element using the given writer and args. Returns a list of two-element arrays - [ media, CW$id ] or [ story, CW$id ]. These are the related media objects serialized.

AUTHOR

Sam Tregar <stregar@about-inc.com>

SEE ALSO

Bric::SOAP