NAGATA Hiroaki > Net-Nakamap > Net::Nakamap

Download:
Net-Nakamap-0.03.tar.gz

Dependencies

Annotate this POD

CPAN RT

New  1
Open  0
View/Report Bugs
Module Version: 0.03   Source  

ATTENTION ^

THIS MODULE IS UNDER CONSTRUCTION. INTERFACES AND RESPONCES ARE NOT STABLE.

NAME ^

Net::Nakamap - A Perl interface to the Nakamap API

VERSION ^

This document describes Net::Nakamap version 0.02.

SYNOPSIS ^

    use Net::Nakamap;

    my $nakamap = Net::Nakamap->new(
        client_id     => $client_id,
        client_secret => $client_secret,
    );

    # generate uri for authentication
    my $auth_uri = $nakamap->auth_uri();

    # get access token
    my $res   = $nakamap->auth_code({ code => $code });
    my $token = $res->{access_token};

    # GET
    my $me = $nakamap->get('/1/me', { token => $token });

    # POST
    $nakamap->post('/1/me/profile', {
        token => $token,
        name  => 'Alice',
    });

DESCRIPTION ^

Tiny helper for using Nakamap API.

METHODS ^

$nakamap = Net::Nakamap->new(%options)

Creates a new Net::Nakamap instance.

%options is a Hash. kesy of %option are:

  • client_id

    client id for your app.

  • client_secret

    client secret for your app.

  • token

    Not required. If given, you can ommit token for each get or post method.

$nakamap->auth_uri($params)

Generate uri for authentication. Returns URI object.

$params is a HashRef. keys of $params are:

  • response_type
  • scope
$nakamap->auth_code($code)

Authenticate authorization code. Returns hash including token.

$nakamap->get($path, $params)

Send GET request to Nakamap API.

$nakamap->post($path, $params, $files)

Send POST request to Nakamap API.

files in $files are sent as multipart/form-data.

    $files = {
        icon => 'path/to/file',
    }

or

    $files = {
        icon => \$binary_data,
    }

SEE ALSO ^

REPOSITORY ^

AUTHOR ^

NAGATA Hiroaki <handlename> <handle _at_ cpan _dot_ org>

LICENSE AND COPYRIGHT ^

Copyright (c) 2013, NAGATA Hiroaki <handlename>. All rights reserved.

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

syntax highlighting: