| 1 | ##---------------------------------------------------------------------------- | ||
| 2 | ## Meta CPAN API - ~/lib/Net/API/CPAN/Author.pm | ||
| 3 | ## Version v0.1.0 | ||
| 4 | ## Copyright(c) 2023 DEGUEST Pte. Ltd. | ||
| 5 | ## Author: Jacques Deguest <jack@deguest.jp> | ||
| 6 | ## Created 2023/07/25 | ||
| 7 | ## Modified 2023/09/26 | ||
| 8 | ## All rights reserved | ||
| 9 | ## | ||
| 10 | ## | ||
| 11 | ## This program is free software; you can redistribute it and/or modify it | ||
| 12 | ## under the same terms as Perl itself. | ||
| 13 | ##---------------------------------------------------------------------------- | ||
| 14 | # This module file has been automatically generated. Any change made here will be lost. | ||
| 15 | # Edit the script in ./build/build_modules.pl instead | ||
| 16 | package Net::API::CPAN::Author; | ||
| 17 | BEGIN | ||
| 18 | { | ||
| 19 | use strict; | ||
| 20 | use warnings; | ||
| 21 | use parent qw( Net::API::CPAN::Generic ); | ||
| 22 | use vars qw( $VERSION ); | ||
| 23 | our $VERSION = 'v0.1.0'; | ||
| 24 | }; | ||
| 25 | |||
| 26 | use strict; | ||
| 27 | use warnings; | ||
| 28 | |||
| 29 | sub init | ||
| 30 | { | ||
| 31 | my $self = shift( @_ ); | ||
| 32 | $self->{asciiname} = undef unless( CORE::exists( $self->{asciiname} ) ); | ||
| 33 | $self->{blog} = [] unless( CORE::exists( $self->{blog} ) ); | ||
| 34 | $self->{city} = undef unless( CORE::exists( $self->{city} ) ); | ||
| 35 | $self->{country} = undef unless( CORE::exists( $self->{country} ) ); | ||
| 36 | $self->{donation} = [] unless( CORE::exists( $self->{donation} ) ); | ||
| 37 | $self->{email} = [] unless( CORE::exists( $self->{email} ) ); | ||
| 38 | $self->{gravatar_url} = undef unless( CORE::exists( $self->{gravatar_url} ) ); | ||
| 39 | $self->{is_pause_custodial_account} = undef unless( CORE::exists( $self->{is_pause_custodial_account} ) ); | ||
| 40 | $self->{links} = undef unless( CORE::exists( $self->{links} ) ); | ||
| 41 | $self->{location} = [] unless( CORE::exists( $self->{location} ) ); | ||
| 42 | $self->{name} = undef unless( CORE::exists( $self->{name} ) ); | ||
| 43 | $self->{object} = 'author'; | ||
| 44 | $self->{pauseid} = undef unless( CORE::exists( $self->{pauseid} ) ); | ||
| 45 | $self->{perlmongers} = [] unless( CORE::exists( $self->{perlmongers} ) ); | ||
| 46 | $self->{profile} = [] unless( CORE::exists( $self->{profile} ) ); | ||
| 47 | $self->{region} = undef unless( CORE::exists( $self->{region} ) ); | ||
| 48 | $self->{release_count} = undef unless( CORE::exists( $self->{release_count} ) ); | ||
| 49 | $self->{updated} = undef unless( CORE::exists( $self->{updated} ) ); | ||
| 50 | $self->{user} = undef unless( CORE::exists( $self->{user} ) ); | ||
| 51 | $self->{website} = [] unless( CORE::exists( $self->{website} ) ); | ||
| 52 | $self->{_init_preprocess} = sub | ||
| 53 | { | ||
| 54 | my $this = shift( @_ ); | ||
| 55 | if( $self->_is_hash( $this ) ) | ||
| 56 | { | ||
| 57 | if( exists( $this->{perlmongers} ) && | ||
| 58 | ref( $this->{perlmongers} ) eq 'HASH' ) | ||
| 59 | { | ||
| 60 | $this->{perlmongers} = [$this->{perlmongers}]; | ||
| 61 | } | ||
| 62 | } | ||
| 63 | return( $this ); | ||
| 64 | }; | ||
| 65 | $self->{_init_strict_use_sub} = 1; | ||
| 66 | $self->{_exception_class} = 'Net::API::CPAN::Exception'; | ||
| 67 | $self->SUPER::init( @_ ) || return( $self->pass_error ); | ||
| 68 | $self->{fields} = [qw( | ||
| 69 | asciiname blog city country donation email gravatar_url is_pause_custodial_account | ||
| 70 | links location name pauseid perlmongers profile region release_count updated user | ||
| 71 | website | ||
| 72 | )]; | ||
| 73 | return( $self ); | ||
| 74 | } | ||
| 75 | |||
| 76 | sub asciiname { return( shift->_set_get_scalar_as_object( 'asciiname', @_ ) ); } | ||
| 77 | |||
| 78 | sub blog { return( shift->_set_get_class_array_object( 'blog', { feed => "scalar_as_object", url => "uri" }, @_ ) ); } | ||
| 79 | |||
| 80 | sub city { return( shift->_set_get_scalar_as_object( 'city', @_ ) ); } | ||
| 81 | |||
| 82 | sub country { return( shift->_set_get_scalar_as_object( 'country', @_ ) ); } | ||
| 83 | |||
| 84 | sub dir { return( shift->links->cpan_directory( @_ ) ); } | ||
| 85 | |||
| 86 | sub donation { return( shift->_set_get_class_array_object( 'donation', { id => "scalar_as_object", name => "scalar_as_object" }, @_ ) ); } | ||
| 87 | |||
| 88 | sub email { return( shift->_set_get_object_array_object( { | ||
| 89 | field => 'email', | ||
| 90 | callback => sub | ||
| 91 | { | ||
| 92 | my( $class, $args ) = @_; | ||
| 93 | return( $class->parse_bare_address( $args->[0] ) ); | ||
| 94 | } | ||
| 95 | }, 'Email::Address::XS', @_ ) ); } | ||
| 96 | |||
| 97 | sub gravatar_url { return( shift->_set_get_uri( 'gravatar_url', @_ ) ); } | ||
| 98 | |||
| 99 | sub is_pause_custodial_account { return( shift->_set_get_boolean( 'is_pause_custodial_account', @_ ) ); } | ||
| 100 | |||
| 101 | sub links { return( shift->_set_get_class( 'links', { | ||
| 102 | backpan_directory => "uri", | ||
| 103 | cpan_directory => "uri", | ||
| 104 | cpantesters_matrix => "uri", | ||
| 105 | cpantesters_reports => "uri", | ||
| 106 | cpants => "uri", | ||
| 107 | metacpan_explorer => "uri", | ||
| 108 | repology => "uri", | ||
| 109 | }, @_ ) ); } | ||
| 110 | |||
| 111 | sub location { return( shift->_set_get_array_as_object( 'location', @_ ) ); } | ||
| 112 | |||
| 113 | sub metacpan_url | ||
| 114 | { | ||
| 115 | my $self = shift( @_ ); | ||
| 116 | my $pauseid = $self->pauseid || | ||
| 117 | return( $self->error( "No pause ID is set to return a Meta CPAN URL for this author." ) ); | ||
| 118 | my $api_uri = $self->api->api_uri->clone; | ||
| 119 | $api_uri->path( "/author/$pauseid" ); | ||
| 120 | return( $api_uri ); | ||
| 121 | } | ||
| 122 | |||
| 123 | sub name { return( shift->_set_get_scalar_as_object( 'name', @_ ) ); } | ||
| 124 | |||
| 125 | sub object { return( shift->_set_get_scalar_as_object( 'object', @_ ) ); } | ||
| 126 | |||
| 127 | sub pauseid { return( shift->_set_get_scalar_as_object( 'pauseid', @_ ) ); } | ||
| 128 | |||
| 129 | sub perlmongers { return( shift->_set_get_class_array_object( 'perlmongers', { name => "scalar_as_object", url => "uri" }, @_ ) ); } | ||
| 130 | |||
| 131 | sub profile { return( shift->_set_get_class_array_object( 'profile', { id => "scalar_as_object", name => "scalar_as_object" }, @_ ) ); } | ||
| 132 | |||
| 133 | sub region { return( shift->_set_get_scalar_as_object( 'region', @_ ) ); } | ||
| 134 | |||
| 135 | sub release_count { return( shift->_set_get_class( 'release_count', { backpan_only => "integer", cpan => "integer", latest => "integer" }, @_ ) ); } | ||
| 136 | |||
| 137 | # Taken from MetaCPAN::Client::Author for compatibility | ||
| 138 | sub releases | ||
| 139 | { | ||
| 140 | my $self = shift( @_ ); | ||
| 141 | my $id = $self->pauseid; | ||
| 142 | return( $self->api->release({ | ||
| 143 | all => [ | ||
| 144 | { author => $id }, | ||
| 145 | { status => 'latest' }, | ||
| 146 | ] | ||
| 147 | }) ); | ||
| 148 | } | ||
| 149 | |||
| 150 | sub updated { return( shift->_set_get_datetime( 'updated', @_ ) ); } | ||
| 151 | |||
| 152 | sub user { return( shift->_set_get_scalar_as_object( 'user', @_ ) ); } | ||
| 153 | |||
| 154 | sub website { return( shift->_set_get_object_array_object( 'website', 'URI', @_ ) ); } | ||
| 155 | |||
| 156 | 1; | ||
| 157 | # NOTE: POD | ||
| 158 | __END__ | ||
| 159 | |||
| 160 | =encoding utf-8 | ||
| 161 | |||
| 162 | =head1 NAME | ||
| 163 | |||
| 164 | Net::API::CPAN::Author - Meta CPAN API Author Class | ||
| 165 | |||
| 166 | =head1 SYNOPSIS | ||
| 167 | |||
| 168 | use Net::API::CPAN::Author; | ||
| 169 | my $obj = Net::API::CPAN::Author->new( { | ||
| 170 | asciiname => "Taro Momo", | ||
| 171 | blog => [ | ||
| 172 | { | ||
| 173 | feed => "", | ||
| 174 | url => "https://momotaro.example.jp/", | ||
| 175 | }, | ||
| 176 | { | ||
| 177 | feed => "https://blogs.perl.org/users/momotaro/atom.xml", | ||
| 178 | url => "https://blogs.perl.org/users/momotaro/", | ||
| 179 | }, | ||
| 180 | ], | ||
| 181 | city => "Okayama", | ||
| 182 | country => "JP", | ||
| 183 | donation => [ | ||
| 184 | { | ||
| 185 | id => "momo.taro\@example.jp", | ||
| 186 | name => "stripe", | ||
| 187 | }, | ||
| 188 | ], | ||
| 189 | email => [ | ||
| 190 | "momo.taro\@example.jp", | ||
| 191 | ], | ||
| 192 | gravatar_url => "https://secure.gravatar.com/avatar/a123abc456def789ghi0jkl?s=130&d=identicon", | ||
| 193 | links => { | ||
| 194 | backpan_directory => "https://cpan.metacpan.org/authors/id/M/MO/MOMOTARO", | ||
| 195 | cpan_directory => "http://cpan.org/authors/id/M/MO/MOMOTARO", | ||
| 196 | cpantesters_matrix => "http://matrix.cpantesters.org/?author=MOMOTARO", | ||
| 197 | cpantesters_reports => "http://cpantesters.org/author/M/MOMOTARO.html", | ||
| 198 | cpants => "http://cpants.cpanauthors.org/author/MOMOTARO", | ||
| 199 | metacpan_explorer => "https://explorer.metacpan.org/?url=/author/MOMOTARO", | ||
| 200 | repology => "https://repology.org/maintainer/MOMOTARO%40cpan", | ||
| 201 | }, | ||
| 202 | location => [ | ||
| 203 | "34.7338553", | ||
| 204 | "133.7660595", | ||
| 205 | ], | ||
| 206 | name => "\x{6843}\x{592a}\x{90ce}", | ||
| 207 | pauseid => "MOMOTARO", | ||
| 208 | perlmongers => [ | ||
| 209 | { | ||
| 210 | name => "momo.taro", | ||
| 211 | }, | ||
| 212 | ], | ||
| 213 | profile => [ | ||
| 214 | { | ||
| 215 | id => "momotaro", | ||
| 216 | name => "coderwall", | ||
| 217 | }, | ||
| 218 | { | ||
| 219 | id => "momotaro", | ||
| 220 | name => "github", | ||
| 221 | }, | ||
| 222 | { | ||
| 223 | id => "momotaro", | ||
| 224 | name => "linkedin", | ||
| 225 | }, | ||
| 226 | { | ||
| 227 | id => "momotaro", | ||
| 228 | name => "twitter", | ||
| 229 | }, | ||
| 230 | { | ||
| 231 | id => "momotaro", | ||
| 232 | name => "gitlab", | ||
| 233 | }, | ||
| 234 | ], | ||
| 235 | region => "Okayama", | ||
| 236 | release_count => { | ||
| 237 | "backpan-only" => 12, | ||
| 238 | cpan => 420, | ||
| 239 | latest => 17, | ||
| 240 | }, | ||
| 241 | updated => "2023-07-29T04:45:10", | ||
| 242 | user => "j_20ap7aNOkaYA11m9a2", | ||
| 243 | website => [ | ||
| 244 | "https://www.momotaro.jp/", | ||
| 245 | ], | ||
| 246 | } ) || die( Net::API::CPAN::Author->error ); | ||
| 247 | |||
| 248 | my $string = $obj->asciiname; | ||
| 249 | my $array = $obj->blog; | ||
| 250 | foreach my $this ( @$array ) | ||
| 251 | { | ||
| 252 | my $scalar = $this->feed; | ||
| 253 | my $uri = $this->url; | ||
| 254 | } | ||
| 255 | my $string = $obj->city; | ||
| 256 | my $string = $obj->country; | ||
| 257 | my $string = $obj->dir; | ||
| 258 | my $array = $obj->donation; | ||
| 259 | foreach my $this ( @$array ) | ||
| 260 | { | ||
| 261 | my $scalar = $this->id; | ||
| 262 | my $scalar = $this->name; | ||
| 263 | } | ||
| 264 | my $array = $obj->email; | ||
| 265 | my $uri = $obj->gravatar_url; | ||
| 266 | my $bool = $obj->is_pause_custodial_account; | ||
| 267 | my $this = $obj->links; | ||
| 268 | my $uri = $obj->links->backpan_directory; | ||
| 269 | my $uri = $obj->links->cpan_directory; | ||
| 270 | my $uri = $obj->links->cpantesters_matrix; | ||
| 271 | my $uri = $obj->links->cpantesters_reports; | ||
| 272 | my $uri = $obj->links->cpants; | ||
| 273 | my $uri = $obj->links->metacpan_explorer; | ||
| 274 | my $uri = $obj->links->repology; | ||
| 275 | my $array = $obj->location; | ||
| 276 | my $uri = $obj->metacpan_url; | ||
| 277 | my $string = $obj->name; | ||
| 278 | my $str = $obj->object; | ||
| 279 | my $string = $obj->pauseid; | ||
| 280 | my $array = $obj->perlmongers; | ||
| 281 | foreach my $this ( @$array ) | ||
| 282 | { | ||
| 283 | my $scalar = $this->name; | ||
| 284 | my $uri = $this->url; | ||
| 285 | } | ||
| 286 | my $array = $obj->profile; | ||
| 287 | foreach my $this ( @$array ) | ||
| 288 | { | ||
| 289 | my $scalar = $this->id; | ||
| 290 | my $scalar = $this->name; | ||
| 291 | } | ||
| 292 | my $string = $obj->region; | ||
| 293 | my $this = $obj->release_count; | ||
| 294 | my $integer = $obj->release_count->backpan_only; | ||
| 295 | my $integer = $obj->release_count->cpan; | ||
| 296 | my $integer = $obj->release_count->latest; | ||
| 297 | my $this = $obj->releases; | ||
| 298 | my $date = $obj->updated; | ||
| 299 | my $string = $obj->user; | ||
| 300 | my $array = $obj->website; | ||
| 301 | |||
| 302 | =head1 VERSION | ||
| 303 | |||
| 304 | v0.1.0 | ||
| 305 | |||
| 306 | =head1 DESCRIPTION | ||
| 307 | |||
| 308 | This class serves to retrieve and manipulate authors. | ||
| 309 | |||
| 310 | It inherits from L<Net::API::CPAN::Generic> | ||
| 311 | |||
| 312 | =head1 CONSTRUCTOR | ||
| 313 | |||
| 314 | =head2 new | ||
| 315 | |||
| 316 | Provided with an hash or hash reference of parameters, and this instantiates a new C<Net::API::CPAN::Author> object. | ||
| 317 | |||
| 318 | The parameters that can be provided bear the same name and supports the same values as the methods below. | ||
| 319 | |||
| 320 | =head1 METHODS | ||
| 321 | |||
| 322 | =head2 asciiname | ||
| 323 | |||
| 324 | $obj->asciiname( "Taro Momo" ); | ||
| 325 | my $string = $obj->asciiname; | ||
| 326 | |||
| 327 | Sets or gets a string and returns a L<scalar object|Module::Generic::Scalar>, even if there is no value. | ||
| 328 | |||
| 329 | =head2 blog | ||
| 330 | |||
| 331 | $obj->blog( [ | ||
| 332 | { | ||
| 333 | feed => "", | ||
| 334 | url => "https://momotaro.example.jp/", | ||
| 335 | }, | ||
| 336 | { | ||
| 337 | feed => "https://blogs.perl.org/users/momotaro/atom.xml", | ||
| 338 | url => "https://blogs.perl.org/users/momotaro/", | ||
| 339 | }, | ||
| 340 | ] ); | ||
| 341 | my $array = $obj->blog; | ||
| 342 | foreach my $this ( @$array ) | ||
| 343 | { | ||
| 344 | my $scalar = $this->feed; | ||
| 345 | $this->url( "https://momotaro.example.jp/" ); | ||
| 346 | my $uri = $this->url; | ||
| 347 | } | ||
| 348 | |||
| 349 | Sets or gets an array of dynamic class objects with class name C<Net::API::CPAN::Author::Blog> and having the folowing properties also accessible as methods, and returns an L<array object|Module::Generic::Array> even if there is no value. | ||
| 350 | |||
| 351 | A C<Net::API::CPAN::Author::Blog> object will be instantiated with each value from the array provided and replace said value. | ||
| 352 | |||
| 353 | =over 4 | ||
| 354 | |||
| 355 | =item * C<feed> scalar_as_object | ||
| 356 | |||
| 357 | =item * C<url> URI (L<uri object|URI>) | ||
| 358 | |||
| 359 | =back | ||
| 360 | |||
| 361 | =head2 city | ||
| 362 | |||
| 363 | $obj->city( "Okayama" ); | ||
| 364 | my $string = $obj->city; | ||
| 365 | |||
| 366 | Sets or gets a string and returns a L<scalar object|Module::Generic::Scalar>, even if there is no value. | ||
| 367 | |||
| 368 | =head2 country | ||
| 369 | |||
| 370 | $obj->country( "JP" ); | ||
| 371 | my $string = $obj->country; | ||
| 372 | |||
| 373 | Sets or gets a string and returns a L<scalar object|Module::Generic::Scalar>, even if there is no value. | ||
| 374 | |||
| 375 | =head2 dir | ||
| 376 | |||
| 377 | Sets or gets the C<cpan_directory> link property. | ||
| 378 | |||
| 379 | This is actually a shortcut to accessing the property C<cpan_directory> in L</links> | ||
| 380 | |||
| 381 | It returns an L<URI> object, or C<undef> if no value is set. | ||
| 382 | |||
| 383 | =head2 donation | ||
| 384 | |||
| 385 | $obj->donation( [ | ||
| 386 | { | ||
| 387 | id => "momo.taro\@example.jp", | ||
| 388 | name => "stripe", | ||
| 389 | }, | ||
| 390 | ] ); | ||
| 391 | my $array = $obj->donation; | ||
| 392 | foreach my $this ( @$array ) | ||
| 393 | { | ||
| 394 | $this->id( "momo.taro\@example.jp" ); | ||
| 395 | my $scalar = $this->id; | ||
| 396 | $this->name( "stripe" ); | ||
| 397 | my $scalar = $this->name; | ||
| 398 | } | ||
| 399 | |||
| 400 | Sets or gets an array of dynamic class objects with class name C<Net::API::CPAN::Author::Donation> and having the folowing properties also accessible as methods, and returns an L<array object|Module::Generic::Array> even if there is no value. | ||
| 401 | |||
| 402 | A C<Net::API::CPAN::Author::Donation> object will be instantiated with each value from the array provided and replace said value. | ||
| 403 | |||
| 404 | =over 4 | ||
| 405 | |||
| 406 | =item * C<id> scalar_as_object | ||
| 407 | |||
| 408 | =item * C<name> scalar_as_object | ||
| 409 | |||
| 410 | =back | ||
| 411 | |||
| 412 | =head2 email | ||
| 413 | |||
| 414 | $obj->email( [ | ||
| 415 | "momo.taro\@example.jp", | ||
| 416 | ] ); | ||
| 417 | my $array = $obj->email; | ||
| 418 | |||
| 419 | Sets or gets an array of L<Email::Address::XS> objects, or creates an L<Email::Address::XS> instance for each email provided in the array, and returns an L<array object|Module::Generic::Array>, even if no value was provided. | ||
| 420 | |||
| 421 | =head2 gravatar_url | ||
| 422 | |||
| 423 | $obj->gravatar_url( "https://secure.gravatar.com/avatar/a123abc456def789ghi0jkl?s=130&d=identicon" ); | ||
| 424 | my $uri = $obj->gravatar_url; | ||
| 425 | |||
| 426 | Sets or gets an L<URI>, and returns an L<URI object|URI> or C<undef> if no value is set. | ||
| 427 | |||
| 428 | =head2 is_pause_custodial_account | ||
| 429 | |||
| 430 | Sets or gets a boolean value, and returns a L<boolean object|Module::Generic::Boolean> or C<undef> if no value is set. | ||
| 431 | |||
| 432 | =head2 links | ||
| 433 | |||
| 434 | $obj->links( { | ||
| 435 | backpan_directory => "https://cpan.metacpan.org/authors/id/M/MO/MOMOTARO", | ||
| 436 | cpan_directory => "http://cpan.org/authors/id/M/MO/MOMOTARO", | ||
| 437 | cpantesters_matrix => "http://matrix.cpantesters.org/?author=MOMOTARO", | ||
| 438 | cpantesters_reports => "http://cpantesters.org/author/M/MOMOTARO.html", | ||
| 439 | cpants => "http://cpants.cpanauthors.org/author/MOMOTARO", | ||
| 440 | metacpan_explorer => "https://explorer.metacpan.org/?url=/author/MOMOTARO", | ||
| 441 | repology => "https://repology.org/maintainer/MOMOTARO%40cpan", | ||
| 442 | } ); | ||
| 443 | my $this = $obj->links; | ||
| 444 | $obj->links->backpan_directory( "https://cpan.metacpan.org/authors/id/M/MO/MOMOTARO" ); | ||
| 445 | my $uri = $obj->links->backpan_directory; | ||
| 446 | $obj->links->cpan_directory( "http://cpan.org/authors/id/M/MO/MOMOTARO" ); | ||
| 447 | my $uri = $obj->links->cpan_directory; | ||
| 448 | $obj->links->cpantesters_matrix( "http://matrix.cpantesters.org/?author=MOMOTARO" ); | ||
| 449 | my $uri = $obj->links->cpantesters_matrix; | ||
| 450 | $obj->links->cpantesters_reports( "http://cpantesters.org/author/M/MOMOTARO.html" ); | ||
| 451 | my $uri = $obj->links->cpantesters_reports; | ||
| 452 | $obj->links->cpants( "http://cpants.cpanauthors.org/author/MOMOTARO" ); | ||
| 453 | my $uri = $obj->links->cpants; | ||
| 454 | $obj->links->metacpan_explorer( "https://explorer.metacpan.org/?url=/author/MOMOTARO" ); | ||
| 455 | my $uri = $obj->links->metacpan_explorer; | ||
| 456 | $obj->links->repology( "https://repology.org/maintainer/MOMOTARO%40cpan" ); | ||
| 457 | my $uri = $obj->links->repology; | ||
| 458 | |||
| 459 | Sets or gets a dynamic class object with class name C<Net::API::CPAN::Author::Links> and having the folowing properties also accessible as methods, and returns an object from such class, or C<undef> if no value was provided. | ||
| 460 | |||
| 461 | =over 4 | ||
| 462 | |||
| 463 | =item * C<backpan_directory> URI (L<uri object|URI>) | ||
| 464 | |||
| 465 | =item * C<cpan_directory> URI (L<uri object|URI>) | ||
| 466 | |||
| 467 | =item * C<cpantesters_matrix> URI (L<uri object|URI>) | ||
| 468 | |||
| 469 | =item * C<cpantesters_reports> URI (L<uri object|URI>) | ||
| 470 | |||
| 471 | =item * C<cpants> URI (L<uri object|URI>) | ||
| 472 | |||
| 473 | =item * C<metacpan_explorer> URI (L<uri object|URI>) | ||
| 474 | |||
| 475 | =item * C<repology> URI (L<uri object|URI>) | ||
| 476 | |||
| 477 | =back | ||
| 478 | |||
| 479 | =head2 location | ||
| 480 | |||
| 481 | $obj->location( [ | ||
| 482 | "34.7338553", | ||
| 483 | "133.7660595", | ||
| 484 | ] ); | ||
| 485 | my $array = $obj->location; | ||
| 486 | |||
| 487 | Sets or gets an array of locations and returns an L<array object|Module::Generic::Array>, even if there is no value. | ||
| 488 | |||
| 489 | =head2 metacpan_url | ||
| 490 | |||
| 491 | Returns a link, as an L<URI> object, to the author's page on MetaCPAN, or C<undef> if no C<pauseid> is currently set. | ||
| 492 | |||
| 493 | =head2 name | ||
| 494 | |||
| 495 | $obj->name( "\x{6843}\x{592a}\x{90ce}" ); | ||
| 496 | my $string = $obj->name; | ||
| 497 | |||
| 498 | Sets or gets a string and returns a L<scalar object|Module::Generic::Scalar>, even if there is no value. | ||
| 499 | |||
| 500 | =head2 object | ||
| 501 | |||
| 502 | Returns the object type for this class, which is C<author> | ||
| 503 | |||
| 504 | =head2 pauseid | ||
| 505 | |||
| 506 | $obj->pauseid( "MOMOTARO" ); | ||
| 507 | my $string = $obj->pauseid; | ||
| 508 | |||
| 509 | Sets or gets a string and returns a L<scalar object|Module::Generic::Scalar>, even if there is no value. | ||
| 510 | |||
| 511 | =head2 perlmongers | ||
| 512 | |||
| 513 | $obj->perlmongers( [ | ||
| 514 | { | ||
| 515 | name => "momo.taro", | ||
| 516 | }, | ||
| 517 | ] ); | ||
| 518 | my $array = $obj->perlmongers; | ||
| 519 | foreach my $this ( @$array ) | ||
| 520 | { | ||
| 521 | $this->name( "momo.taro" ); | ||
| 522 | my $scalar = $this->name; | ||
| 523 | my $uri = $this->url; | ||
| 524 | } | ||
| 525 | |||
| 526 | Sets or gets an array of dynamic class objects with class name C<Net::API::CPAN::Author::Perlmongers> and having the folowing properties also accessible as methods, and returns an L<array object|Module::Generic::Array> even if there is no value. | ||
| 527 | |||
| 528 | A C<Net::API::CPAN::Author::Perlmongers> object will be instantiated with each value from the array provided and replace said value. | ||
| 529 | |||
| 530 | =over 4 | ||
| 531 | |||
| 532 | =item * C<name> scalar_as_object | ||
| 533 | |||
| 534 | =item * C<url> URI (L<uri object|URI>) | ||
| 535 | |||
| 536 | =back | ||
| 537 | |||
| 538 | =head2 profile | ||
| 539 | |||
| 540 | $obj->profile( [ | ||
| 541 | { | ||
| 542 | id => "momotaro", | ||
| 543 | name => "coderwall", | ||
| 544 | }, | ||
| 545 | { | ||
| 546 | id => "momotaro", | ||
| 547 | name => "github", | ||
| 548 | }, | ||
| 549 | { | ||
| 550 | id => "momotaro", | ||
| 551 | name => "linkedin", | ||
| 552 | }, | ||
| 553 | { | ||
| 554 | id => "momotaro", | ||
| 555 | name => "twitter", | ||
| 556 | }, | ||
| 557 | { | ||
| 558 | id => "momotaro", | ||
| 559 | name => "gitlab", | ||
| 560 | }, | ||
| 561 | ] ); | ||
| 562 | my $array = $obj->profile; | ||
| 563 | foreach my $this ( @$array ) | ||
| 564 | { | ||
| 565 | $this->id( "momotaro" ); | ||
| 566 | my $scalar = $this->id; | ||
| 567 | $this->name( "coderwall" ); | ||
| 568 | my $scalar = $this->name; | ||
| 569 | } | ||
| 570 | |||
| 571 | Sets or gets an array of dynamic class objects with class name C<Net::API::CPAN::Author::Profile> and having the folowing properties also accessible as methods, and returns an L<array object|Module::Generic::Array> even if there is no value. | ||
| 572 | |||
| 573 | A C<Net::API::CPAN::Author::Profile> object will be instantiated with each value from the array provided and replace said value. | ||
| 574 | |||
| 575 | =over 4 | ||
| 576 | |||
| 577 | =item * C<id> scalar_as_object | ||
| 578 | |||
| 579 | =item * C<name> scalar_as_object | ||
| 580 | |||
| 581 | =back | ||
| 582 | |||
| 583 | =head2 region | ||
| 584 | |||
| 585 | $obj->region( "Okayama" ); | ||
| 586 | my $string = $obj->region; | ||
| 587 | |||
| 588 | Sets or gets a string and returns a L<scalar object|Module::Generic::Scalar>, even if there is no value. | ||
| 589 | |||
| 590 | =head2 release_count | ||
| 591 | |||
| 592 | $obj->release_count( { | ||
| 593 | "backpan-only" => 12, | ||
| 594 | cpan => 420, | ||
| 595 | latest => 17, | ||
| 596 | } ); | ||
| 597 | my $this = $obj->release_count; | ||
| 598 | my $integer = $obj->release_count->backpan_only; | ||
| 599 | $obj->release_count->cpan( 420 ); | ||
| 600 | my $integer = $obj->release_count->cpan; | ||
| 601 | $obj->release_count->latest( 17 ); | ||
| 602 | my $integer = $obj->release_count->latest; | ||
| 603 | |||
| 604 | Sets or gets a dynamic class object with class name C<Net::API::CPAN::Author::ReleaseCount> and having the folowing properties also accessible as methods, and returns an object from such class, or C<undef> if no value was provided. | ||
| 605 | |||
| 606 | =over 4 | ||
| 607 | |||
| 608 | =item * C<backpan_only> integer (L<number object|Module::Generic::Number>) | ||
| 609 | |||
| 610 | =item * C<cpan> integer (L<number object|Module::Generic::Number>) | ||
| 611 | |||
| 612 | =item * C<latest> integer (L<number object|Module::Generic::Number>) | ||
| 613 | |||
| 614 | =back | ||
| 615 | |||
| 616 | =head2 releases | ||
| 617 | |||
| 618 | Returns an L<Net::API::CPAN::ResultSet> oject containing all the author latest releases as L<release objects|Net::API::CPAN::Release>. | ||
| 619 | |||
| 620 | =head2 updated | ||
| 621 | |||
| 622 | $obj->updated( "2023-07-29T04:45:10" ); | ||
| 623 | my $datetime_obj = $obj->updated; | ||
| 624 | |||
| 625 | Sets or gets a datetime value, and returns a L<DateTime object|DateTime> that stringifies to the format that was provided with the string set (usally an ISO 8601 datetime format) or C<undef> if no value is set. | ||
| 626 | |||
| 627 | =head2 user | ||
| 628 | |||
| 629 | $obj->user( "j_20ap7aNOkaYA11m9a2" ); | ||
| 630 | my $string = $obj->user; | ||
| 631 | |||
| 632 | Sets or gets a string and returns a L<scalar object|Module::Generic::Scalar>, even if there is no value. | ||
| 633 | |||
| 634 | =head2 website | ||
| 635 | |||
| 636 | $obj->website( [ | ||
| 637 | "https://www.momotaro.jp/", | ||
| 638 | ] ); | ||
| 639 | my $array = $obj->website; | ||
| 640 | |||
| 641 | Sets or gets an array of L<URI> objects, or creates an L<URI> instance for each website provided in the array, and returns an L<array object|Module::Generic::Array>, even if no value was provided. | ||
| 642 | |||
| 643 | =head1 API SAMPLE | ||
| 644 | |||
| 645 | { | ||
| 646 | "asciiname" : "Taro Momo", | ||
| 647 | "blog" : [ | ||
| 648 | { | ||
| 649 | "feed" : "", | ||
| 650 | "url" : "https://momotaro.example.jp/" | ||
| 651 | }, | ||
| 652 | { | ||
| 653 | "feed" : "https://blogs.perl.org/users/momotaro/atom.xml", | ||
| 654 | "url" : "https://blogs.perl.org/users/momotaro/" | ||
| 655 | }, | ||
| 656 | ], | ||
| 657 | "city" : "Okayama", | ||
| 658 | "country" : "JP", | ||
| 659 | "donation" : [ | ||
| 660 | { | ||
| 661 | "name" : "stripe", | ||
| 662 | "id" : "momo.taro@example.jp" | ||
| 663 | } | ||
| 664 | ], | ||
| 665 | "perlmongers": [ | ||
| 666 | { | ||
| 667 | "name": "momo.taro" | ||
| 668 | } | ||
| 669 | ], | ||
| 670 | "email" : [ | ||
| 671 | "momo.taro@example.jp" | ||
| 672 | ], | ||
| 673 | "gravatar_url" : "https://secure.gravatar.com/avatar/a123abc456def789ghi0jkl?s=130&d=identicon", | ||
| 674 | "links" : { | ||
| 675 | "backpan_directory" : "https://cpan.metacpan.org/authors/id/M/MO/MOMOTARO", | ||
| 676 | "cpan_directory" : "http://cpan.org/authors/id/M/MO/MOMOTARO", | ||
| 677 | "cpantesters_matrix" : "http://matrix.cpantesters.org/?author=MOMOTARO", | ||
| 678 | "cpantesters_reports" : "http://cpantesters.org/author/M/MOMOTARO.html", | ||
| 679 | "cpants" : "http://cpants.cpanauthors.org/author/MOMOTARO", | ||
| 680 | "metacpan_explorer" : "https://explorer.metacpan.org/?url=/author/MOMOTARO", | ||
| 681 | "repology" : "https://repology.org/maintainer/MOMOTARO%40cpan" | ||
| 682 | }, | ||
| 683 | "location" : [ | ||
| 684 | 34.7338553, | ||
| 685 | 133.7660595 | ||
| 686 | ], | ||
| 687 | "name" : "桃太郎", | ||
| 688 | "pauseid" : "MOMOTARO", | ||
| 689 | "profile" : [ | ||
| 690 | { | ||
| 691 | "id" : "momotaro", | ||
| 692 | "name" : "coderwall" | ||
| 693 | }, | ||
| 694 | { | ||
| 695 | "id" : "momotaro", | ||
| 696 | "name" : "github" | ||
| 697 | }, | ||
| 698 | { | ||
| 699 | "id" : "momotaro", | ||
| 700 | "name" : "linkedin" | ||
| 701 | }, | ||
| 702 | { | ||
| 703 | "id" : "momotaro", | ||
| 704 | "name" : "twitter" | ||
| 705 | }, | ||
| 706 | { | ||
| 707 | "id" : "momotaro", | ||
| 708 | "name" : "gitlab" | ||
| 709 | } | ||
| 710 | ], | ||
| 711 | "region" : "Okayama", | ||
| 712 | "release_count" : { | ||
| 713 | "backpan-only" : 12, | ||
| 714 | "cpan" : 420, | ||
| 715 | "latest" : 17 | ||
| 716 | }, | ||
| 717 | "updated" : "2023-07-29T04:45:10", | ||
| 718 | "user" : "j_20ap7aNOkaYA11m9a2", | ||
| 719 | "website" : [ | ||
| 720 | "https://www.momotaro.jp/" | ||
| 721 | ] | ||
| 722 | } | ||
| 723 | |||
| 724 | =head1 AUTHOR | ||
| 725 | |||
| 726 | Jacques Deguest E<lt>F<jack@deguest.jp>E<gt> | ||
| 727 | |||
| 728 | =head1 SEE ALSO | ||
| 729 | |||
| 730 | L<Net::API::CPAN>, L<Net::API::CPAN::Activity>, L<Net::API::CPAN::Author>, L<Net::API::CPAN::Changes>, L<Net::API::CPAN::Changes::Release>, L<Net::API::CPAN::Contributor>, L<Net::API::CPAN::Cover>, L<Net::API::CPAN::Diff>, L<Net::API::CPAN::Distribution>, L<Net::API::CPAN::DownloadUrl>, L<Net::API::CPAN::Favorite>, L<Net::API::CPAN::File>, L<Net::API::CPAN::Module>, L<Net::API::CPAN::Package>, L<Net::API::CPAN::Permission>, L<Net::API::CPAN::Rating>, L<Net::API::CPAN::Release> | ||
| 731 | |||
| 732 | L<MetaCPAN::API>, L<MetaCPAN::Client> | ||
| 733 | |||
| 734 | L<https://github.com/metacpan/metacpan-api/blob/master/docs/API-docs.md> | ||
| 735 | |||
| 736 | =head1 COPYRIGHT & LICENSE | ||
| 737 | |||
| 738 | Copyright(c) 2023 DEGUEST Pte. Ltd. | ||
| 739 | |||
| 740 | All rights reserved | ||
| 741 | |||
| 742 | This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. | ||
| 743 | |||
| 744 | =cut | ||
| 745 |