Skip to content

Commit

Permalink
be able to authorize
Browse files Browse the repository at this point in the history
  • Loading branch information
shelling committed Aug 18, 2009
1 parent f62f8d5 commit 47dd1da
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions lib/Posterous.pm
Expand Up @@ -7,25 +7,26 @@ use warnings;
use LWP::UserAgent;
use HTTP::Request;
use MIME::Base64;
use Data::Dumper;
use Rubyish::Attribute;
use Data::Dumper;


our $VERSION = '0.01';

our $DOMAIN = "posterous.com";
our $DOMAIN = "http://posterous.com";

our $AUTH_PATH = "/api/getsites";
our $NEWPOST_PATH = "/api/newpost";
our $COMMMENT_PATH = "/api/newcomment";
our $READPOST_PATH = "/api/readposts";
our $AUTH_PATH = $DOMAIN."/api/getsites";
our $NEWPOST_PATH = $DOMAIN."/api/newpost";
our $COMMMENT_PATH = $DOMAIN."/api/newcomment";
our $READPOST_PATH = $DOMAIN."/api/readposts";

our $UA = LWP::UserAgent->new();

attr_accessor "user", "pass";

sub new {
my ($class, $user, $pass, $site_id) = @_;
die "didn\'t give user\' email or password" unless defined($user) && defined($pass);
my $self = bless {}, $class;
$self->user($user)->pass($pass);
$self;
Expand All @@ -40,6 +41,9 @@ sub auth_key {

sub account_info {
my ($self) = @_;
my $request = HTTP::Request->new( GET => $AUTH_PATH );
$request->header( Authorization => "Basic ". $self->auth_key );
my $content = $UA->request($request)->content;
}

1;
Expand Down

0 comments on commit 47dd1da

Please sign in to comment.