NAME

WWW::LogicBoxes::Role::Command::Contact - Contact Related Operations

SYNOPSIS

use WWW::LogicBoxes;
use WWW::LogicBoxes::Customer;
use WWW::LogicBoxes::Contact;

my $customer = WWW::LogicBoxes::Customer->new( ... );
my $contact  = WWW::LogicBoxes::Contact->new( ... );

# Creation
my $logic_boxes = WWW::LogicBoxes->new( ... );
$logic_boxes->create_contact( contact => $contact );

# Retrieval
my $retrieved_contact = $logic_boxes->get_contact_by_id( $contact->id );

# Update
my $old_contact = $logic_boxes->get_contact_by_id( 42 );
my $contact  = WWW::LogicBoxes::Contact->new(
    id => $old_contact->id,
    ...
);

$logic_boxes->update_contact( contact => $contact );

# Deletion
$logic_boxes->delete_contact_by_id( $contact->id );

REQURIES

submit

DESCRIPTION

Implements contact related operations with the LogicBoxes's API.

METHODS

create_contact

use WWW::LogicBoxes;
use WWW::LogicBoxes::Customer;
use WWW::LogicBoxes::Contact;

my $customer = WWW::LogicBoxes::Customer->new( ... );
my $contact  = WWW::LogicBoxes::Contact->new( ... );

my $logic_boxes = WWW::LogicBoxes->new( ... );
$logic_boxes->create_contact( contact => $contact );

print 'New contact id: ' . $contact->id . "\n";

Given a WWW::LogicBoxes::Contact or a HashRef that can be coerced into a WWW::LogicBoxes::Contact, creates the specified contact with LogicBoxes.

get_contact_by_id

use WWW::LogicBoxes;
use WWW::LogicBoxes::Contact;

my $logic_boxes = WWW::LogicBoxes->new( ... );
my $contact     = $logic_boxes->get_contact_by_id( 42 );

Given an Integer ID, will return an instance of WWW::LogicBoxes::Contact (or one of it's subclass for specialized contacts). Returns undef if there is no matching contact with the specified id.

update_contact

use WWW::LogicBoxes;
use WWW::LogicBoxes::Customer;
use WWW::LogicBoxes::Contact;

my $logic_boxes = WWW::LogicBoxes->new( ... );

my $old_contact = $logic_boxes->get_contact_by_id( 42 );
my $contact  = WWW::LogicBoxes::Contact->new(
    id => $old_contact->id,
    ...
);

$logic_boxes->update_contact( contact => $contact );

Given a WWW::LogicBoxes::Contact or a HashRef that can be coerced into a WWW::LogicBoxes::Contact, updates the contact with the specified id with LogicBoxes.

delete_contact_by_id

use WWW::LogicBoxes;
use WWW::LogicBoxes::Contact;

my $logic_boxes = WWW::LogicBoxes->new( ... );
$logic_boxes->delete_contact_by_id( 42 );

Given an Integer ID, will delete the contact with LogicBoxes.

This method will croak if the contact is in use (assigned to a domain).