Browse files

Release 1.00

Bump version to 1.00
Update Pod
  • Loading branch information...
1 parent 2990dfa commit 2a8e99d4aef05aefcb77259fdd7e3680414e01e1 @mrallen1 committed Dec 31, 2011
Showing with 71 additions and 39 deletions.
  1. +3 −0 Build.PL
  2. +44 −15 lib/Net/API/Gett.pm
  3. +13 −13 lib/Net/API/Gett/File.pm
  4. +1 −1 lib/Net/API/Gett/Request.pm
  5. +4 −2 lib/Net/API/Gett/Share.pm
  6. +6 −8 lib/Net/API/Gett/User.pm
View
3 Build.PL
@@ -7,6 +7,9 @@ my $builder = Module::Build->new(
license => 'perl',
dist_author => q{Mark Allen <mrallen1@yahoo.com>},
dist_version_from => 'lib/Net/API/Gett.pm',
+ configure_requires => {
+ 'Module::Build' => 0.38,
+ },
build_requires => {
'Test::More' => 0,
},
View
59 lib/Net/API/Gett.pm
@@ -24,11 +24,11 @@ Net::API::Gett - Perl bindings for Ge.tt API
=head1 VERSION
-Version 0.02
+Version 1.00
=cut
-our $VERSION = '0.02';
+our $VERSION = '1.00';
=head1 SYNOPSIS
@@ -71,6 +71,13 @@ share up to 2 GB of files for free. They recently implemented a REST API; this
binding for the API. See L<http://ge.tt/developers> for full details and how to get an
API key.
+=head1 CHANGES FROM PREVIOUS VERSION
+
+This library is more encapsulated. Share functions which act on shares are in the L<Net::API::Gett::Share>
+object namespace, and likewise with Ge.tt L<files|Net::API::Gett:File>. Future versions of this library
+will modify the L<Request|Net::API::Gett::Request> and L<User|Net::API::Gett::User> objects to be
+L<roles|Moo::Role> rather than objects.
+
=cut
sub BUILD {
@@ -88,9 +95,6 @@ sub BUILD {
=head1 ATTRIBUTES
-If attributes are read‐write mutators, they behave in a Perl‐ish way:
-pass values to set them, pass no arguments to get current values.
-
=over
=item user
@@ -133,6 +137,26 @@ errors.
=over
+=item new()
+
+Constructs a new object. Optionally accepts:
+
+=over
+
+=item * A Ge.tt API key, email, and password, or,
+
+=item * A Ge.tt refresh token, or,
+
+=item * A Ge.tt access token
+
+=back
+
+If any of these parameters are passed, they will be proxied into the L<Net::API::Gett::User> object which
+will then permit you to make authenticated API calls. Without an access token (or the means to acquire one)
+only non-authenticated calls are allowed; they are: C<get_share()>, C<get_file()> and C<$file->contents()>.
+
+=back
+
=head2 Share functions
All of these functions cache L<Net::API::Gett::Share> objects. Retrieve objects from the
@@ -291,6 +315,10 @@ This method uploads a file to Gett. The following key/value pairs are valid:
=over
+=item * filename (B<required>)
+
+What to call the uploaded file when it's inside of the Gett service.
+
=item * sharename (optional)
If not specified, a new share will be automatically created.
@@ -299,27 +327,28 @@ If not specified, a new share will be automatically created.
If specified, this value is used when creating a new share to hold the file.
-=item * filename (required)
-
-What to call the uploaded file when it's inside of the Gett service.
+=item * content (optional)
+
+A synonym for C<contents>. (Yes, I've typo'd this too many times.) Anything in C<contents> has
+precedent, though.
-=item * content (optional)
+=item * contents (optional)
A representation of the file's contents. This can be one of:
=over
-=item A buffer
+=item * A buffer
-=item An L<IO::Handle> object
+=item * An L<IO::Handle> object
-=item A FILEGLOB
+=item * A FILEGLOB
-=item A pathname to a file to be read
+=item * A pathname to a file to be read
=back
-If not specified, the filename parameter is used as a pathname.
+If not specified, the C<filename> parameter is treated as a pathname.
=item * encoding
@@ -476,7 +505,7 @@ sub shares {
=head1 AUTHOR
-Mark Allen, C<mrallen1 at yahoo dot com>
+Mark Allen, C<< <mrallen1 at yahoo dot com> >>
=head1 BUGS
View
26 lib/Net/API/Gett/File.pm
@@ -12,7 +12,7 @@ use Carp qw(croak);
use File::Slurp qw(read_file);
use MooX::Types::MooseLike qw(Int Str);
-our $VERSION = '0.02';
+our $VERSION = '1.00';
=head1 PURPOSE
@@ -166,26 +166,26 @@ has 'request' => (
lazy => 1,
);
+=head1 METHODS
+
=over
=item send_file()
This method actually uploads the file to the Gett service. This method is normally invoked by the
-C<upload_file()> method, but it's a public method which might be useful in combination with
-C<get_upload_url()>. It takes the following parameters:
+C<upload_file()> method, but it might be useful in combination with C<get_upload_url()>. It takes
+the following parameters:
=over
-=item *
-
-a PUT based Gett upload url
+=item * a Gett put upload url
-=item *
+=item * data
a scalar representing the file contents which can be one of: a buffer, an L<IO::Handle> object, a FILEGLOB, or a
file pathname.
-=item *
+=item * encoding
an encoding scheme. By default, it uses C<:raw> (see C<perldoc -f binmode> for more information.)
@@ -251,9 +251,9 @@ sub get_upload_url {
=over
-=item destroy_file()
+=item destroy()
-This method destroys a file specified by the given sharename/fileid parameters. Returns a true value.
+This method destroys the file represented by the object. Returns a true value on success.
=back
@@ -299,7 +299,7 @@ sub _file_contents {
=item contents()
This method retrieves the contents of a this file in the Gett service. You are responsible for
-outputting the file (if desired) with any appropriate encoding.
+outputting the file (if desired) with any appropriate encoding. Does not require an access token.
=back
@@ -317,8 +317,8 @@ sub contents {
=item thumbnail()
-This method returns a thumbnail if the file in Gett is an image. Requires a
-sharename and fileid.
+This method returns a thumbnail if the file in Gett is an image. Does not require an access token, but
+is really only meaningful if the data is a valid image format file.
=back
View
2 lib/Net/API/Gett/Request.pm
@@ -7,7 +7,7 @@ use JSON;
use LWP::UserAgent;
use HTTP::Request::Common;
-our $VERSION = '0.02';
+our $VERSION = '1.00';
=head1 NAME
View
6 lib/Net/API/Gett/Share.pm
@@ -7,11 +7,11 @@ Net::API::Gett::Share - Gett share object
=cut
use Moo;
-use Sub::Quote;
use Carp qw(croak);
use Array::Iterator;
+use MooX::Types::MooseLike qw(Int Str);
-our $VERSION = '0.02';
+our $VERSION = '1.00';
=head1 PURPOSE
@@ -81,6 +81,7 @@ C<get_file_iterator()> below.
has 'sharename' => (
is => 'ro',
+ isa => Str,
);
has 'title' => (
@@ -89,6 +90,7 @@ has 'title' => (
has 'created' => (
is => 'ro',
+ isa => Int,
);
sub files {
View
14 lib/Net/API/Gett/User.pm
@@ -3,12 +3,11 @@ package Net::API::Gett::User;
use Moo;
use Sub::Quote;
use Carp qw(croak);
-use Scalar::Util qw(looks_like_number);
use MooX::Types::MooseLike qw(Str Int);
use Net::API::Gett::Request;
-our $VERSION = '0.02';
+our $VERSION = '1.00';
=head1 NAME
@@ -21,14 +20,13 @@ this class on its own as the library will create and return this object when app
=head1 ATTRIBUTES
-Here are the attributes of this class. If they are read-write mutators, they behave in
-a Perl-ish way: pass values to set them, pass no arguments to get current values.
+Here are the attributes of this class. They are read only.
=over
=item api_key
-Scalar string. Read-only. C<has_api_key> predicate.
+Scalar string. C<has_api_key> predicate.
=back
@@ -44,7 +42,7 @@ has 'api_key' => (
=item email
-Scalar string. Read-only. C<has_email> predicate.
+Scalar string. C<has_email> predicate.
=back
@@ -60,7 +58,7 @@ has 'email' => (
=item password
-Scalar string. Read-only. C<has_password> predicate.
+Scalar string. C<has_password> predicate.
=back
@@ -194,7 +192,7 @@ has 'storage_limit' => (
writer => '_set_storage_limit',
);
-=head2 Account methods
+=head1 METHODS
=over

0 comments on commit 2a8e99d

Please sign in to comment.