Confman

 view release on metacpan or  search on metacpan

lib/Confman/API.pm  view on Meta::CPAN

  $self->{api_key} = shift if scalar(@_) > 0;
  return $self->{api_key};
}

sub secret {
  my $self = shift;
  $self->{secret} = shift if scalar(@_) > 0;
  return $self->{secret};
}

sub endpoint_url {
  my $self = shift;
  $self->{endpoint_url} = shift if scalar(@_) > 0;
  return $self->{endpoint_url};
}

sub load_config {
  my $self = shift;
  my $config_path = shift || $self->config_path;
  if(-e $config_path) {
    my $fh = IO::File->new($config_path);
    local $/ = undef;
    my $config = $self->json->decode(<$fh>);
    $fh->close();

lib/Confman/API.pm  view on Meta::CPAN

  }
  my $cloud_meta = encode_base64($self->json->encode($self->cloud_metadata));
  $cloud_meta =~ s/\s+//ism;
  my $headers = {
    Accept => 'application/json',
    'Content-type' => 'application/json',
    Authorization => 'Basic ' . encode_base64($self->api_key . ':' . "$secret_hash:$timestamp"),
    HTTP_CLOUD_META => $cloud_meta
  };

  $client->setHost($self->endpoint_url);
  $client->request($method, $path, $body, $headers);

  my $response;
  if($client->responseCode eq '200') {
    $response = $self->json->decode($client->responseContent());
  }
  return $response, $client;
}

sub cloud_metadata {



( run in 0.263 second using v1.01-cache-2.11-cpan-27979f6cc8f )