Skip to content

Commit

Permalink
Added token() and base_url() methods.
Browse files Browse the repository at this point in the history
  • Loading branch information
ironcamel committed Jan 3, 2012
1 parent 1352434 commit d3c0d8a
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 10 deletions.
3 changes: 3 additions & 0 deletions Changes
@@ -1,5 +1,8 @@
Revision history for Net-OpenStack-Compute

1.0302 2012-01-03
Added token() and base_url() methods.

1.0301 2012-01-03
Forgot to add App::Rad::Plugin::MoreHelp dep.

Expand Down
2 changes: 1 addition & 1 deletion dist.ini
Expand Up @@ -4,7 +4,7 @@ license = Perl_5
copyright_holder = Naveed Massjouni
copyright_year = 2011

version = 1.0301
version = 1.0302

[Prereqs]
Any::Moose = 0
Expand Down
12 changes: 3 additions & 9 deletions lib/Net/OpenStack/Compute.pm
Expand Up @@ -29,13 +29,7 @@ has _auth => (
region => $self->region,
);
},
);

has _base_url => (
is => 'ro',
isa => 'Str',
lazy => 1,
default => sub { shift->_auth->base_url },
handles => [qw(base_url token)],
);

has _ua => (
Expand All @@ -44,7 +38,7 @@ has _ua => (
default => sub {
my $self = shift;
my $agent = LWP::UserAgent->new();
$agent->default_header(x_auth_token => $self->_auth->token);
$agent->default_header(x_auth_token => $self->token);
return $agent;
},
);
Expand Down Expand Up @@ -146,7 +140,7 @@ sub get_flavor {

sub _url {
my ($self, $path, $is_detail) = @_;
my $url = $self->_base_url . $path;
my $url = $self->base_url . $path;
$url .= '/detail' if $is_detail;
return $url;
}
Expand Down

0 comments on commit d3c0d8a

Please sign in to comment.