package Amazon::API::HTTP::Response;

use strict;
use warnings;

use parent qw(Class::Accessor::Fast);

__PACKAGE__->follow_best_practice;
__PACKAGE__->mk_accessors(qw( response ));

sub new {
  my ( $class, $response ) = @_;
  return bless { response => $response }, $class;
}

sub content      { return $_[0]->{response}{content} }
sub content_type { return ( $_[0]->{response}{headers}{'content-type'} // '' ) =~ s/;.*//r }
sub is_success   { return $_[0]->{response}{success} }
sub code         { return $_[0]->{response}{status} }
sub message      { return $_[0]->{response}{reason} }

1;
