The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

Net::API::CPAN::Rating - Meta CPAN API Rating Class

SYNOPSIS

    use Net::API::CPAN::Rating;
    my $obj = Net::API::CPAN::Rating->new( {
      author => "PLACEHOLDER",
      date => "2018-05-31T09:20:07",
      distribution => "Japan-Folklore",
      rating => "5.0",
      release => "PLACEHOLDER",
      user => "CPANRatings",
    } ) || die( Net::API::CPAN::Rating->error );
    
    my $string = $obj->author;
    my $date = $obj->date;
    my $this = $obj->details;
    my $description_obj = $obj->details->description;
    my $string = $obj->distribution;
    my $array = $obj->helpful;
    foreach my $this ( @$array )
    {
        my $scalar = $this->user;
        my $boolean = $this->value;
    }
    my $str = $obj->object;
    my $num = $obj->rating;
    my $string = $obj->release;
    my $string = $obj->user;

VERSION

    v0.1.0

DESCRIPTION

This class serves to retrieve and manipulate ratings.

It inherits from Net::API::CPAN::Generic

CONSTRUCTOR

new

Provided with an hash or hash reference of parameters, and this instantiates a new Net::API::CPAN::Rating object.

The parameters that can be provided bear the same name and supports the same values as the methods below.

METHODS

author

    $obj->author( "PLACEHOLDER" );
    my $string = $obj->author;

Sets or gets a string and returns a scalar object, even if there is no value.

date

    $obj->date( "2018-05-31T09:20:07" );
    my $datetime_obj = $obj->date;

Sets or gets a datetime value, and returns a DateTime object that stringifies to the format that was provided with the string set (usally an ISO 8601 datetime format) or undef if no value is set.

details

Sets or gets a dynamic class object with class name Net::API::CPAN::Rating::Details and having the folowing properties also accessible as methods, and returns an object from such class, or undef if no value was provided.

distribution

    $obj->distribution( "Japan-Folklore" );
    my $string = $obj->distribution;

Sets or gets a string and returns a scalar object, even if there is no value.

helpful

Sets or gets an array of dynamic class objects with class name Net::API::CPAN::Rating::Helpful and having the folowing properties also accessible as methods, and returns an array object even if there is no value.

A Net::API::CPAN::Rating::Helpful object will be instantiated with each value from the array provided and replace said value.

object

Returns the object type for this class, which is rating

rating

    $obj->rating("5.0");
    my $number = $obj->rating;

Sets or gets a float value, and returns a number object or undef if no value is set.

release

    $obj->release( "PLACEHOLDER" );
    my $string = $obj->release;

Sets or gets a string and returns a scalar object, even if there is no value.

user

    $obj->user( "CPANRatings" );
    my $string = $obj->user;

Sets or gets a string and returns a scalar object, even if there is no value.

API SAMPLE

    {
       "rating" : "5.0",
       "user" : "CPANRatings",
       "distribution" : "Japan-Folklore",
       "release" : "PLACEHOLDER",
       "date" : "2018-05-31T09:20:07",
       "author" : "PLACEHOLDER"
    }

AUTHOR

Jacques Deguest <jack@deguest.jp>

SEE ALSO

Net::API::CPAN, Net::API::CPAN::Activity, Net::API::CPAN::Author, Net::API::CPAN::Changes, Net::API::CPAN::Changes::Release, Net::API::CPAN::Contributor, Net::API::CPAN::Cover, Net::API::CPAN::Diff, Net::API::CPAN::Distribution, Net::API::CPAN::DownloadUrl, Net::API::CPAN::Favorite, Net::API::CPAN::File, Net::API::CPAN::Module, Net::API::CPAN::Package, Net::API::CPAN::Permission, Net::API::CPAN::Rating, Net::API::CPAN::Release

MetaCPAN::API, MetaCPAN::Client

https://github.com/metacpan/metacpan-api/blob/master/docs/API-docs.md

COPYRIGHT & LICENSE

Copyright(c) 2023 DEGUEST Pte. Ltd.

All rights reserved

This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.