The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

WWW::LogicBoxes::Role::Command::Raw - Low Level Access to LogicBoxes API

SYNOPSIS

    use WWW::LogicBoxes;

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

    my $response = $logic_boxes->domains__suggest_names({
        'keyword'       => 'car',
        'tlds'          => ['com', 'net', 'org'],
        'no-of-results' => 10,
        'hypehn-allowed'=> 'false',
        'add-related'   => 'true',
    });

REQUIRES

username
password
api_key
_base_uri
response_Type

DESCRIPTION

This role composes a series of methods into the consuming class (WWW::LogicBoxes) that directly expose methods of the LogicBoxes API. It is the lowest level of access to the LogicBoxes API and is intended only for the most advanced usages that are not covered by other commands.

NOTE You almost never want to make this low level of a call. You really should be looking at the commands to find the specific method to accomplish your goals.

METHODS

Methods are constructed by abstracting out the need to specify the HTTP method (POST or GET) and automagically building the request URI according to the documentation provided by LogicBoxes (see the Logic Boxes API user guide at http://manage.logicboxes.com/kb/answer/744 for additional information).

Method Naming

To fully understand the method names it's best to take a specific example (in this case the suggestion of domain names).

Suggest Domains (and many others)

    my $response = $logic_boxes->domains__suggest_names({
        'keyword'       => 'car',
        'tlds'          => ['com', 'net', 'org'],
        'no-of-results' => 10,
        'hypehn-allowed'=> 'false',
        'add-related'   => 'true',
    });

LogicBoxes' API states that this method is part of their HTTP API, specifically the Domain Category and more specifically the Suggest Names method. The sample URI for this request would then be:

https://test.httpapi.com/api/domains/suggest-names.json?auth-userid=0&auth-password=password&keyword=domain&tlds=com&tlds=net&no-of-results=0&hyphen-allowed=true&add-related=true

The method name is built using the URI that the request is expected at in a logical way. Since this method is a member of the Domains Category and is specifically Suggest Names we end up:

    $logic_boxes->domains__suggest_names

Where everything before the first "__" is the category and everything following it is the specific method (with - replaced with _ and / replaced with __).

Arguments Passed to Methods

The specific arguments each method requires is not enforced by this module, rather it is left to the developer to reference the LogicBoxes API and to pass the correct arguments to each method as a hash. Again, this is a module of last resort, you should really be using the exposed Commands if at all posible.

There are two odd cases that you should be aware of with respect to the way arguments must be passed.

Repeated Elements

For methods such as domains__check that accept the same key multiple times:

https://test.httpapi.com/api/domains/available.json?auth-userid=0&auth-password=password&domain-name=domain1&domain-name=domain2&tlds=com&tlds=net

This module accepts a hash where the key is the name of the argument (such as domain-name) and the value is an array of values you wish to pass:

    $logic_boxes->domains__available({
        'domain-name' => ["google", "cnn"],
        'tlds'        => ["com","net"]
    });

This is interpreted for you automagically into the repeating elements when the API's URI is built.

Array of Numbered Elements

For methods such as contacts__set_details that accept the same key multiple times except an incrementing digit is appended:

https://test.httpapi.com/api/contacts/set-details.json?auth-userid=0&auth-password=password&contact-id=0&attr-name1=sponsor1&attr-value1=0&product-key=dotcoop

This module still accepts a hash and leaves it to the developer to handle the appending of the incrementing digit to the keys of the hash:

    $logic_boxes->contacts__set_details({
        'contact-id'    => 1337,
        'attr-name1'    => 'sponsor',
        'attr-value1'   => '0',
        'attr-name2'    => 'CPR',
        'attr-value2'   => 'COO',
        'product-key'   => 'dotcoop'
    });

In this way you are able to overcome the need for unique keys and still pass the needed values onto LogicBoxes' API.