Skip to content

Commit

Permalink
More refactoring.
Browse files Browse the repository at this point in the history
  • Loading branch information
davorg committed Jun 5, 2015
1 parent b382b88 commit 00fd65f
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion lib/Hive.pm
Expand Up @@ -41,6 +41,18 @@ has base_url => (
default => 'https://api.hivehome.com/v5/',
);

has user_url => (
is => 'ro',
isa => 'Str',
lazy_build => 1,
);

sub _build_user_url {
my $self = shift;
return $self->base_url . '/users/' . $self->username;
}


has json => (
is => 'ro',
isa => 'JSON',
Expand Down Expand Up @@ -77,7 +89,7 @@ sub get_target_temperature {
sub get {
my $self = shift;

my $url = $self->base_url . '/users/' . $self->username . shift;
my $url = $self->user_url . shift;

my $req = GET $url;
$self->ua->request($req);
Expand Down

0 comments on commit 00fd65f

Please sign in to comment.