NAME

Mango::Product - A product

SYNOPSIS

my $product = $provider->get_by_sku('ABC-123');
print $product->created;

my $attributes = $product->attributes;
while (my $attribute = $attributes->next) {
    print $attribute->name, ': ', $attribute->value;
};

DESCRIPTION

Mango::Product represents a product returned from the products provider.

METHODS

add_attributes

Arguments: @attributes

Adds attribute to the product. atttributes may be hashes containing name/value data, or Mango::Attribute objects;

$product->add_attributes(
    {name => 'Color', value => 'red'},
    $attributeobject
);

add_attribute

Same as add_attributes.

add_tags

Arguments: @tags

Adds tags to the product. tags may be tag strings, or Mango::Tag objects;

$product->add_tags(
    'computers',
    $tagobject
);

add_tag

Same as add_tag.

attributes

Arguments: $filter, $options

Returns a list of attributes for the product in list context, or a Mango::Iterator in scalar context.

my @attributes = $product->attributes({
    name => 'A%'
});

my $iterator = $product->attributes({
    name => 'A%'
});

destroy

Deletes the current item from the provider.

delete_attributes

Arguments: $filter

Deletes attributes for the product matching the supplied filter..

$product->delete_attributes({
    name => 'Color'
});

delete_attribute

Sames as delete_attributes.

id

Returns id of the current product.

print $product->id;

created

Returns the date the product was created as a DateTime object.

print $product->created;

updated

Returns the date the product was last updated as a DateTime object.

print $product->updated;

sku

Arguments: $sku

Gets/sets the sku/part number of the product.

print $product->sku;

name

Arguments: $name

Gets/sets the name of the product.

print $product->description;

price

Arguments: $price

Gets/sets the price of the product.

print $product->price;

tags

Arguments: $filter, $options

Returns a list of tags for the product in list context, or a Mango::Iterator in scalar context.

my @tags = $product->tags({
    name => 'A%'
});

my $iterator = $product->tags({
    name => 'A%'
});

delete_tags

Arguments: $filter

Deletes tags from the product matching the supplied filter..

$product->delete_tags({
    'computer'
});

delete_tag

Sames as delete_tags.

update

Saves any changes to the profile back to the provider.

SEE ALSO

Mango::Object, Mango::Provider::Profiles

AUTHOR

Christopher H. Laco
CPAN ID: CLACO
claco@chrislaco.com
http://today.icantfocus.com/blog/