OpenWeatherMap/Result/Forecast/Hour.pm

filter: Statementstmt 85.1% 46 / 54 Branchbran n/a Conditioncond 60.0% 6 / 10 MC/DCmcdc 20.0% 1 / 5 Subroutinesub 68.0% 17 / 25 Podpod 66.6% 2 / 3 totaltotal 74.2% 72 / 97 CC 6 SCAR 4.6
CC
6
Cov
81%
__ANON__
2.1
_build_wind_direction_degrees
2.1
cloud_coverage
2.1
CRAP 1.6
« OpenWeatherMap/Result/Forecast/Block.pm ↑ Summary OpenWeatherMap/Request/Forecast.pm »
1 package Weather::OpenWeatherMap::Result::Forecast::Hour;
2 2 $Weather::OpenWeatherMap::Result::Forecast::Hour::VERSION = '0.003001';
3 2 ▶use strictures 2;
Subroutine BEGIN: called CC=1 SCAR=0.0
4  
5 2 ▶use Types::Standard -all;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 2 ▶use Types::DateTime -all;
Subroutine BEGIN: called CC=1 SCAR=0.0
7 2 ▶use List::Objects::Types -all;
Subroutine BEGIN: called CC=1 SCAR=0.0
8  
9 2 ▶use Weather::OpenWeatherMap::Units -all;
Subroutine BEGIN: called CC=1 SCAR=0.0
10  
11  
12 2 ▶use Moo;
Subroutine BEGIN: called CC=1 SCAR=0.0
13  
14 has dt_txt => (
15 lazy => 1,
16 is => 'ro',
17 isa => Str,
18 0 ▶ builder => sub { '' },
Subroutine _build_dt_txt: not called CC=1 SCAR=6.9
Subroutine __ANON__: not called CC=1 SCAR=6.9
19 2 );
20  
21 2 has _main => (
22 init_arg => 'main',
23 required => 1,
24 is => 'ro',
25 isa => HashObj,
26 coerce => 1,
27 );
28  
29 has temp => (
30 lazy => 1,
31 is => 'ro',
32 isa => CoercedInt,
33 coerce => 1,
34 1 ▶ builder => sub { shift->_main->{temp} },
Subroutine __ANON__: called CC=1 SCAR=1.2
Subroutine _build_temp: not called CC=1 SCAR=1.2
35 2 );
36  
37 has temp_c => (
38 lazy => 1,
39 is => 'ro',
40 isa => CoercedInt,
41 coerce => 1,
42 1 ▶ builder => sub { f_to_c shift->temp },
Subroutine __ANON__: called CC=1 SCAR=1.2
Subroutine _build_temp_c: not called CC=1 SCAR=1.2
43 2 );
44  
45 has humidity => (
46 lazy => 1,
47 is => 'ro',
48 isa => CoercedInt,
49 coerce => 1,
50 1 ▶ builder => sub { shift->_main->{humidity} },
Subroutine _build_humidity: called CC=1 SCAR=0.0
51 2 );
52  
53 has pressure => (
54 lazy => 1,
55 is => 'ro',
56 isa => StrictNum,
57 coerce => 1,
58 1 ▶ builder => sub { shift->_main->{pressure} },
Subroutine _build_pressure: called CC=1 SCAR=0.0
59 2 );
60  
61 has _wind => (
62 init_arg => 'wind',
63 lazy => 1,
64 is => 'ro',
65 isa => HashObj,
66 coerce => 1,
67 0 ▶ builder => sub { +{ speed => 0, deg => 0 } },
Subroutine _build__wind: not called CC=1 SCAR=6.9
68 2 );
69  
70 has wind_speed_mph => (
71 lazy => 1,
72 is => 'ro',
73 isa => CoercedInt,
74 coerce => 1,
75 1 ▶ builder => sub { shift->_wind->{speed} // 0 },
Subroutine __ANON__: called CC=2 SCAR=7.6
Condition50%1/2
+(shift())->_wind->{"speed"} // 0
l!l
10
MC/DC0%0/1
+(shift())->_wind->{"speed"} // 0
+(shift())->_wind->{"speed"}
Truth table50%1/2
A
A= +(shift())->_wind->{"speed"}
Aresult
11
00
76 2 );
77  
78 has wind_speed_kph => (
79 lazy => 1,
80 is => 'ro',
81 isa => CoercedInt,
82 coerce => 1,
83 1 ▶ builder => sub { mph_to_kph shift->wind_speed_mph },
Subroutine __ANON__: called CC=1 SCAR=0.0
84 2 );
85  
86 has wind_direction => (
87 lazy => 1,
88 is => 'ro',
89 isa => Str,
90 1 ▶ builder => sub { deg_to_compass shift->wind_direction_degrees },
Subroutine __ANON__: called CC=1 SCAR=0.0
91 2 );
92  
93 has wind_direction_degrees => (
94 lazy => 1,
95 is => 'ro',
96 isa => CoercedInt,
97 coerce => 1,
98 1 ▶ builder => sub { shift->_wind->{deg} // 0 },
Subroutine _build_wind_direction_degrees: called CC=2 SCAR=7.6
Condition50%1/2
+(shift())->_wind->{"deg"} // 0
l!l
10
MC/DC0%0/1
+(shift())->_wind->{"deg"} // 0
+(shift())->_wind->{"deg"}
Truth table50%1/2
A
A= +(shift())->_wind->{"deg"}
Aresult
11
00
99 2 );
100  
101 has _clouds => (
102 init_arg => 'clouds',
103 lazy => 1,
104 is => 'ro',
105 isa => HashObj,
106 coerce => 1,
107 0 ▶ builder => sub { +{ all => 0 } },
Subroutine __ANON__: not called CC=1 SCAR=6.9
108 2 );
109  
110 1 ▶sub cloud_coverage { shift->_clouds->{all} // 0 }
Subroutine cloud_coverage: called CC=2 SCAR=7.6
Pod undocumented
Condition50%1/2
+(shift())->_clouds->{"all"} // 0
l!l
10
MC/DC0%0/1
+(shift())->_clouds->{"all"} // 0
+(shift())->_clouds->{"all"}
Truth table50%1/2
A
A= +(shift())->_clouds->{"all"}
Aresult
11
00
111  
112 has _snow => (
113 init_arg => 'snow',
114 lazy => 1,
115 is => 'ro',
116 isa => HashObj,
117 coerce => 1,
118 0 ▶ builder => sub { +{ '3h' => 0 } },
Subroutine __ANON__: not called CC=1 SCAR=6.9
119 2 );
120  
121 1 ▶sub snow { shift->_snow->{'3h'} // 0 }
Subroutine snow: called CC=2 SCAR=7.6
Pod documented
Condition50%1/2
+(shift())->_snow->{"3h"} // 0
l!l
10
MC/DC0%0/1
+(shift())->_snow->{"3h"} // 0
+(shift())->_snow->{"3h"}
Truth table50%1/2
A
A= +(shift())->_snow->{"3h"}
Aresult
11
00
122  
123 has _rain => (
124 init_arg => 'rain',
125 lazy => 1,
126 is => 'ro',
127 isa => HashObj,
128 coerce => 1,
129 0 ▶ builder => sub { +{ '3h' => 0 } },
Subroutine _build__rain: not called CC=1 SCAR=6.9
130 2 );
131  
132 2 ▶sub rain { shift->_rain->{'3h'} // 0 }
Subroutine rain: called CC=2 SCAR=6.9
Pod documented
Condition100%2/2
+(shift())->_rain->{"3h"} // 0
l!l
11
MC/DC100%1/1
+(shift())->_rain->{"3h"} // 0
+(shift())->_rain->{"3h"}
Truth table100%2/2
A
A= +(shift())->_rain->{"3h"}
Aresult
11
00
133  
134  
135 2 with 'Weather::OpenWeatherMap::Result::Forecast::Block';
136  
137  
138 2 1;
139  
140 =pod
141  
142 =head1 NAME
143  
144 Weather::OpenWeatherMap::Result::Forecast::Hour - Weather report for a 3hr block
145  
146 =head1 SYNOPSIS
147  
148 # Usually retrieved via a Weather::OpenWeatherMap::Result::Forecast
149  
150 =head1 DESCRIPTION
151  
152 A L<Weather::OpenWeatherMap> weather forecast for a 3-hr block, provided by a
153 L<Weather::OpenWeatherMap::Result::Forecast> hourly weather report.
154  
155 This class consumes L<Weather::OpenWeatherMap::Result::Forecast::Block>; look
156 there for other applicable methods and attributes.
157  
158 =head2 ATTRIBUTES
159  
160 =head3 dt_txt
161  
162 A textual representation of the date/time (UTC) for this forecast block, as
163 provided by the OpenWeatherMap service.
164  
165 See also: L<Weather::OpenWeatherMap::Result::Forecast::Block/dt>
166  
167 =head3 temp
168  
169 The predicted temperature (in Fahrenheit).
170  
171 =head3 temp_c
172  
173 The predicted temperature (in Celsius).
174  
175 =head3 snow
176  
177 The predicted amount of snow (in inches), if applicable.
178  
179 =head3 rain
180  
181 The predicted amount of rain (in inches), if applicable.
182  
183 =head1 SEE ALSO
184  
185 L<http://www.openweathermap.org/forecast5>
186  
187 L<Weather::OpenWeatherMap::Result>
188  
189 L<Weather::OpenWeatherMap::Result::Forecast>
190  
191 L<Weather::OpenWeatherMap::Result::Forecast::Block>
192  
193 L<Weather::OpenWeatherMap::Result::Forecast::Day>
194  
195 L<Weather::OpenWeatherMap::Result::Current>
196  
197 =head1 AUTHOR
198  
199 Jon Portnoy <avenj@cobaltirc.org>
200  
201 =cut
202  
203  
« OpenWeatherMap/Result/Forecast/Block.pm ↑ Summary OpenWeatherMap/Request/Forecast.pm »