Net-LimeLight-Purge

 view release on metacpan or  search on metacpan

lib/Net/LimeLight/Purge.pm  view on Meta::CPAN

package Net::LimeLight::Purge;

use warnings;
use strict;

use DateTime::Format::ISO8601;
use Moose;
use SOAP::Lite;

use Net::LimeLight::Purge::Request;
use Net::LimeLight::Purge::StatusResponse;

=head1 NAME

Net::LimeLight::Purge - LimeLight Purge Service API

=cut

our $VERSION = '0.03';

=head1 SYNOPSIS

  use Net::LimeLight::Purge;
  use Net::LimeLight::Purge::Request;

  my $req = Net::LimeLight::Purge::Request->new(
      shortname => 'mysite',
      url => 'http://cdn.mysite.com/static/images/foo.jpg'
  );

  my $purge = Net::LimeLight::Purge->new(
      username => 'luxuser',
      password => 'luxpass'
  );
  my $ret = $purge->create_purge_request([ $req ]);
  if($ret == -1) {
      say "Something broke!";
  } else {
      say "Successful Request: $ret";
  }

=head1 METHODS

=cut

has '_date_parser' => (
    is => 'rw',
    lazy => 1,
    default => sub {
        return DateTime::Format::ISO8601->new;
    }
);

has '_header' => (
    is => 'rw',
    isa => 'SOAP::Header',
    lazy => 1,
    default => sub {
        my ($self) = @_;

        return SOAP::Header->new(
            name => 'AuthHeader',
            attr => { xmlns => 'http://www.llnw.com/Purge' },
            value => {
                Username => $self->username,
                Password => $self->password
            }
        );
    }
);

has '_soap' => (
    is => 'rw',
    isa => 'SOAP::Lite',
    lazy => 1,
    default => sub {
        my ($self) = @_;

        return SOAP::Lite->new(
            proxy => $self->proxy,
            uri => $self->uri
        );
    }
);

=head2 username

Your LUX username.

=cut

has 'username' => (
    is => 'rw',
    isa => 'Str',
    required => 1
);

=head2 password

Your LUX password.

=cut

has 'password' => (
    is => 'rw',
    isa => 'Str',
    required => 1
);

=head2 proxy

The address to send SOAP requests.  Defaults to
C<https://soap.llnw.net/PurgeFiles/PurgeService.asmx>.

=cut

has 'proxy' => (
    is => 'rw',
    isa => 'Str',
    default => sub { 'https://soap.llnw.net/PurgeFiles/PurgeService.asmx' }
);



( run in 1.892 second using v1.01-cache-2.11-cpan-75ffa21a3d4 )