NAME

WebService::NetSuite::SuiteTalk - NetSuite SOAP interface that caches compiled calls in memory

VERSION

version 0.002

SYNOPSIS

use WebService::NetSuite::SuiteTalk;
my $suitetalk = WebService::NetSuite::SuiteTalk->new(
    account_id    => '12345678',
    email_address => 'netsuite_customer@example.com',
    password      => 'sekrit',
    xsi_auto      => 1,
);
my $answer_ref = $suitetalk->changePassword(
    changePassword => {
        currentPassword => 'sekrit',
        newPassword     => 'tirkes',
        newPassword2    => 'tirkes',
        justThisAccount => 'true',
    },
);

DESCRIPTION

This class provides an in-memory lazy cache for compiled SOAP calls using NetSuite SuiteTalk web services. The first call to any SOAP method uses XML::Compile::WSDL11 to compile and execute that method against the specified NetSuite SuiteTalk service; subsequent calls can vary the parameters but will use the same compiled code.

Available method names are dynamically loaded from the SuiteTalk WSDL file's operations, and can be passed either a hash or reference to a hash with the necessary parameters. In scalar context they return a reference to a hash containing the results of the SOAP call; in list context they return the results hashref and an XML::Compile::SOAP::Trace object suitable for debugging and exception handling.

If there is no result then an exception will be thrown.

As of this writing the following operations are published in the NetSuite SuiteTalk API 2014.2 schema. Consult NetSuite's Help Center for full documentation on input and output parameters for each operation.

METHODS

add

Example:

use Moo;
with 'WebServices::NetSuite::SuiteTalk::Role::Country';
my $answer_ref = $suitetalk->add( record => {
    XSI_TYPE    => 'listRel:Customer',
    isPerson    => 1,
    firstName   => 'Joseph',
    middleName  => 'Random',
    lastName    => 'Netsuite',
    companyName => 'Acme',
    email       => 'joe@example.com',
    addressbookList => [
        {   defaultBilling => 1,
            addr1   => '123 Main Street',
            city    => 'Anytown',
            state   => 'CA',
            zip     => '99999',
            country => code2country('us'),
        },
    ],
} );

addList

Example:

use Moo;
with 'WebServices::NetSuite::SuiteTalk::Role::Country';
my $answer_ref = $suitetalk->addList( record => [
    {
        XSI_TYPE    => 'listRel:Customer',
        isPerson    => 1,
        firstName   => 'Joseph',
        middleName  => 'Random',
        lastName    => 'Netsuite',
        companyName => 'Acme',
        email       => 'joe@example.com',
        addressbookList => [
            {   defaultBilling => 1,
                addr1   => '123 Main Street',
                city    => 'Anytown',
                state   => 'CA',
                zip     => '99999',
                country => code2country('us'),
            },
        ],
    },
    {
        XSI_TYPE    => 'listRel:Customer',
        isPerson    => 1,
        firstName   => 'Jennifer',
        middleName  => 'Random',
        lastName    => 'Netsuite',
        companyName => 'Acme',
        email       => 'jen@example.com',
        addressbookList => [
            {   defaultBilling => 1,
                addr1   => '123 Main Street',
                city    => 'Anytown',
                state   => 'CA',
                zip     => '99999',
                country => code2country('us'),
            },
        ],
    },
] );

asyncAddList

asyncDeleteList

asyncGetList

asyncInitializeList

asyncSearch

asyncUpdateList

asyncUpsertList

attach

changeEmail

changePassword

Example:

my $answer_ref = $suitetalk->changePassword(
    changePassword => {
        currentPassword => 'sekrit',
        newPassword     => 'tirkes',
        newPassword2    => 'tirkes',
        justThisAccount => 'true',
    },
);

checkAsyncStatus

delete

deleteList

detach

get

Example:

my $answer_ref = $suitetalk->get( baseRef => {
    XSI_TYPE   => 'platformCore:RecordRef',
    type       => 'nonInventorySaleItem',
    externalId => '12345',
} );

getAll

getAsyncResult

getBudgetExchangeRate

getConsolidatedExchangeRate

getCurrencyRate

getCustomizationId

getDataCenterUrls

Example:

my $answer_ref = $suitetalk->getDataCenterUrls(account => '1234567');

getDeleted

getItemAvailability

getList

getPostingTransactionSummary

getSavedSearch

getSelectValue

Example:

my $answer_ref = $suitetalk->getSelectValue(
    pageIndex        => 1,
    fieldDescription => { recordType => 'customer', field => 'leadSource' },
);

getServerTime

initialize

Example:

my $answer_ref = $suitetalk->initialize( initializeRecord => {
    type      => 'creditMemo',
    reference => { internalId => '12345', type => 'invoice' },
} );

initializeList

login

logout

mapSso

Example:

my $answer_ref = $suitetalk->search( searchRecord => {
    XSI_TYPE => 'platformCommon:TransactionSearchBasic',
    type     => {
        operator    => 'anyOf',
        searchValue => ['invoice'],
    },
} );

searchMore

searchMoreWithId

searchNext

ssoLogin

update

Example:

my $answer_ref = $suitetalk->update( record => {
    XSI_TYPE   => 'tranCust:CreditMemo',
    internalId => '12345'
    applyList  =>  {
        replaceAll => 0,
        apply => {
            apply => 1,
            total => '1.00',
            doc   => '12346',
            line  => 0,
        },
    },
} );

updateInviteeStatus

updateInviteeStatusList

updateList

upsert

Example:

use Moo;
with 'WebServices::NetSuite::SuiteTalk::Role::Country';
my $answer_ref = $suitetalk->upsert( record => {
    XSI_TYPE    => 'listRel:Customer',
    isPerson    => 1,
    firstName   => 'Joseph',
    middleName  => 'Random',
    lastName    => 'Netsuite',
    companyName => 'Acme',
    email       => 'joe@example.com',
    addressbookList => [
        {   defaultBilling => 1,
            addr1   => '123 Main Street',
            city    => 'Anytown',
            state   => 'CA',
            zip     => '99999',
            country => code2country('us'),
        },
    ],
} );

upsertList

Example:

use Moo;
with 'WebServices::NetSuite::SuiteTalk::Role::Country';
my $answer_ref = $suitetalk->upsertList( record => [
    {
        XSI_TYPE    => 'listRel:Customer',
        isPerson    => 1,
        firstName   => 'Joseph',
        middleName  => 'Random',
        lastName    => 'Netsuite',
        companyName => 'Acme',
        email       => 'joe@example.com',
        addressbookList => [
            {   defaultBilling => 1,
                addr1   => '123 Main Street',
                city    => 'Anytown',
                state   => 'CA',
                zip     => '99999',
                country => code2country('us'),
            },
        ],
    },
    {
        XSI_TYPE    => 'listRel:Customer',
        isPerson    => 1,
        firstName   => 'Jennifer',
        middleName  => 'Random',
        lastName    => 'Netsuite',
        companyName => 'Acme',
        email       => 'jen@example.com',
        addressbookList => [
            {   defaultBilling => 1,
                addr1   => '123 Main Street',
                city    => 'Anytown',
                state   => 'CA',
                zip     => '99999',
                country => code2country('us'),
            },
        ],
    },
] );

OTHER METHODS AND ATTRIBUTES

Because this class consumes the WebService::NetSuite::SuiteTalk::Role::Connection role, it also has that role's attributes and methods. For example, you can use the user_agent attribute to access the LWP::UserAgent used to retrieve and call the SuiteTalk service, or the wsdl method to access the underlying XML::Compile::WSDL11 object.

TESTING

The unit tests included with this distribution need to authenticate to a NetSuite account with SuiteTalk Web Services enabled. To enable web services, use the NetSuite web user interface and select the "Setup" menu, followed by "Company", followed by "Enable Features", then select the "SuiteCloud" tab. Make sure the "Web Services" checkbox is marked and select the "Save" button.

In addition, you need to set the following environment variables in order to run the unit tests:

PERL_TEST_NETSUITE_ACCOUNT
PERL_TEST_NETSUITE_EMAIL
PERL_TEST_NETSUITE_PASSWORD

SUPPORT

Perldoc

You can find documentation for this module with the perldoc command.

perldoc WebService::NetSuite::SuiteTalk

Websites

The following websites have more information about this module, and may be of help to you. As always, in addition to those websites please use your favorite search engine to discover more resources.

Bugs / Feature Requests

Please report any bugs or feature requests through the web interface at https://github.com/mjgardner/webservice-netsuite-suitetalk/issues. You will be automatically notified of any progress on the request by the system.

Source Code

The code is open to the world, and available for you to hack on. Please feel free to browse it and play with it, or whatever. If you want to contribute patches, please send me a diff or prod me to pull from your repository :)

https://github.com/mjgardner/webservice-netsuite-suitetalk

git clone git://github.com/mjgardner/webservice-netsuite-suitetalk.git

AUTHOR

Mark Gardner <mjgardner@cpan.org>

COPYRIGHT AND LICENSE

This software is copyright (c) 2015 by ZipRecruiter.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.