| 1 | 1 | ▶ | use strict; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 2 | 1 | ▶ | use warnings; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 3 | |||
| 4 | package Badge::Depot::Plugin::Gratipay; | ||
| 5 | |||
| 6 | 1 | ▶ | use Moose; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 7 | 1 | ▶ | use namespace::autoclean; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 8 | 1 | ▶ | use Types::Standard qw/Str/; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 9 | 1 | ▶ | use Types::URI qw/Uri/; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 10 | 1 | with 'Badge::Depot'; | |
| 11 | |||
| 12 | 1 | our $VERSION = '0.0102'; # VERSION | |
| 13 | # ABSTRACT: Gratipay plugin for Badge::Depot | ||
| 14 | |||
| 15 | 1 | has user => ( | |
| 16 | is => 'ro', | ||
| 17 | isa => Str, | ||
| 18 | required => 1, | ||
| 19 | ); | ||
| 20 | 1 | has custom_image_url => ( | |
| 21 | is => 'ro', | ||
| 22 | isa => Uri, | ||
| 23 | coerce => 1, | ||
| 24 | default => 'https://img.shields.io/gratipay/%s.svg', | ||
| 25 | ); | ||
| 26 | |||
| 27 | |||
| 28 | sub BUILD { | ||
| 29 | 2 | ▶ | my $self = shift; |
|
Subroutine
BUILD: called CC=1 SCAR=0.0
Pod
undocumented
| |||
| 30 | 2 | $self->link_url(sprintf 'https://gratipay.com/%s', $self->user); | |
| 31 | 2 | $self->image_url(sprintf $self->custom_image_url, $self->user); | |
| 32 | 2 | $self->image_alt('Gratipay'); | |
| 33 | } | ||
| 34 | |||
| 35 | 1 | 1; | |
| 36 | |||
| 37 | __END__ | ||
| 38 | |||
| 39 | =pod | ||
| 40 | |||
| 41 | =encoding UTF-8 | ||
| 42 | |||
| 43 | =head1 NAME | ||
| 44 | |||
| 45 | Badge::Depot::Plugin::Gratipay - Gratipay plugin for Badge::Depot | ||
| 46 | |||
| 47 | =head1 VERSION | ||
| 48 | |||
| 49 | Version 0.0102, released 2015-03-19. | ||
| 50 | |||
| 51 | =head1 SYNOPSIS | ||
| 52 | |||
| 53 | use Badge::Depot::Plugin::Gratipay; | ||
| 54 | |||
| 55 | my $badge = Badge::Depot::Plugin::Gratipay->new(user => 'my_name'); | ||
| 56 | |||
| 57 | print $badge->to_html; | ||
| 58 | # prints '<a href="https://gratipay.com/my_name"><img src="https://img.shields.io/my_name.svg" /></a>' | ||
| 59 | |||
| 60 | =head1 DESCRIPTION | ||
| 61 | |||
| 62 | Create a L<Gratipay|https://gratipay.com> badge for a Gratipay user. | ||
| 63 | |||
| 64 | This class consumes the L<Badge::Depot> role. | ||
| 65 | |||
| 66 | =head1 ATTRIBUTES | ||
| 67 | |||
| 68 | =head2 user | ||
| 69 | |||
| 70 | The Gratipay user name. | ||
| 71 | |||
| 72 | =head2 custom_image_url | ||
| 73 | |||
| 74 | By default, this module shows an image from L<shields.io|https://shields.io>. Use this attribute to override that with a custom url. Use a C<%s> placeholder where the user name should be inserted. | ||
| 75 | |||
| 76 | =head1 SEE ALSO | ||
| 77 | |||
| 78 | =over 4 | ||
| 79 | |||
| 80 | =item * | ||
| 81 | |||
| 82 | L<Badge::Depot> | ||
| 83 | |||
| 84 | =item * | ||
| 85 | |||
| 86 | L<Task::Badge::Depot> | ||
| 87 | |||
| 88 | =back | ||
| 89 | |||
| 90 | =head1 SOURCE | ||
| 91 | |||
| 92 | L<https://github.com/Csson/p5-Badge-Depot-Plugin-Gratipay> | ||
| 93 | |||
| 94 | =head1 HOMEPAGE | ||
| 95 | |||
| 96 | L<https://metacpan.org/release/Badge-Depot-Plugin-Gratipay> | ||
| 97 | |||
| 98 | =head1 AUTHOR | ||
| 99 | |||
| 100 | Erik Carlsson <info@code301.com> | ||
| 101 | |||
| 102 | =head1 COPYRIGHT AND LICENSE | ||
| 103 | |||
| 104 | This software is copyright (c) 2015 by Erik Carlsson <info@code301.com>. | ||
| 105 | |||
| 106 | This is free software; you can redistribute it and/or modify it under | ||
| 107 | the same terms as the Perl 5 programming language system itself. | ||
| 108 | |||
| 109 | =cut | ||