File Coverage

lib/Business/Fixflo/QuickViewPanel.pm
Criterion Covered Total %
statement 19 19 100.0
branch n/a
condition n/a
subroutine 7 7 100.0
pod 1 1 100.0
total 27 27 100.0


line stmt bran cond sub pod time code
1             package Business::Fixflo::QuickViewPanel;
2              
3             =head1 NAME
4              
5             Business::Fixflo::Property::QuickViewPanel
6              
7             =head1 DESCRIPTION
8              
9             A class for a fixflo QVP, extends L
10              
11             =cut
12              
13 16     16   100 use strict;
  16         32  
  16         461  
14 16     16   74 use warnings;
  16         31  
  16         353  
15              
16 16     16   69 use Moo;
  16         28  
  16         72  
17 16     16   4729 use Business::Fixflo::Exception;
  16         45  
  16         600  
18              
19             extends 'Business::Fixflo::Resource';
20              
21 16     16   84 use Carp qw/ confess /;
  16         136  
  16         5619  
22              
23             =head1 ATTRIBUTES
24              
25             DataTypeName
26             Explanation
27             QVPTypeId
28             Title
29             Url
30              
31             issue_summary
32             issue_status_summary
33              
34             issue_summary and issue_status_summary will return the corresponding data from
35             the quick view panel - an array(ref) of hash(refs)
36              
37             =cut
38              
39             has [ qw/
40             DataTypeName
41             Explanation
42             QVPTypeId
43             Title
44             Url
45             / ] => (
46             is => 'rw',
47             );
48              
49             has 'issue_summary' => (
50             is => 'ro',
51             isa => sub {
52             confess( "$_[0] is not an ARRAY ref" )
53             if defined $_[0] && ref $_[0] ne 'ARRAY';
54             },
55             lazy => 1,
56             default => sub {
57             my ( $self ) = @_;
58             return $self->_get if $self->DataTypeName eq 'IssueSummary';
59             return;
60             },
61             );
62              
63             has 'issue_status_summary' => (
64             is => 'ro',
65             isa => sub {
66             confess( "$_[0] is not an ARRAY ref" )
67             if defined $_[0] && ref $_[0] ne 'ARRAY';
68             },
69             lazy => 1,
70             default => sub {
71             my ( $self ) = @_;
72             return $self->_get if $self->DataTypeName eq 'IssueStatusSummary';
73             return;
74             },
75             );
76              
77             =head1 METHODS
78              
79             =head2 get
80              
81             Returns the data associated with a QuickViewPanel:
82              
83             my ( $issues_of_properties_without_ext_ref ) = grep { $_->QVPTypeId == 40 }
84             $ff->quick_view_panels;
85              
86             my $key_value_pairs = $issues_of_properties_without_ext_ref->get;
87              
88             Since there are many QuickViewPanels you can get the data for a specific
89             QuickViewPanel by calling get on that QuickViewPanel
90              
91             There are quite a lot of QuickViewPanels, to see them all:
92              
93             foreach my $qvp (
94             sort { $a->QVPTypeId <=> $b->QVPTypeId }
95             $ff->quick_view_panels
96             ) {
97             printf( "%d - %s",$qvp->QVPTypeId,$qvp->Explanation );
98             }
99              
100             =cut
101              
102             sub get {
103 1     1 1 12883 my ( $self ) = @_;
104 1         10 return $self->client->api_get( $self->Url );
105             }
106              
107             sub _get {
108 1     1   3 my ( $self ) = @_;
109 1         10 return $self->client->api_get( $self->Url );
110             }
111              
112             =head1 AUTHOR
113              
114             Lee Johnson - C
115              
116             This library is free software; you can redistribute it and/or modify it under
117             the same terms as Perl itself. If you would like to contribute documentation,
118             features, bug fixes, or anything else then please raise an issue / pull request:
119              
120             https://github.com/Humanstate/business-fixflo
121              
122             =cut
123              
124             1;
125              
126             # vim: ts=4:sw=4:et