| 1 | 7 | ▶ | use 5.10.0; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 2 | 7 | ▶ | use strict; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 3 | 7 | ▶ | use warnings; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 4 | |||
| 5 | package OpenGbg::Service::StyrOchStall::GetBikeStation; | ||
| 6 | |||
| 7 | # ABSTRACT: Get data about a bike station | ||
| 8 | 7 | our $AUTHORITY = 'cpan:CSSON'; # AUTHORITY | |
| 9 | 7 | our $VERSION = '0.1401'; | |
| 10 | |||
| 11 | 7 | ▶ | use XML::Rabbit::Root; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 12 | 7 | ▶ | use DateTime::Format::HTTP; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 13 | 7 | ▶ | use MooseX::AttributeShortcuts; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 14 | 7 | ▶ | use Types::Standard qw/Str/; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 15 | 7 | ▶ | use Types::DateTime qw/DateTime/; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 16 | |||
| 17 | 7 | has xml => ( | |
| 18 | is => 'ro', | ||
| 19 | isa => Str, | ||
| 20 | required => 1, | ||
| 21 | ); | ||
| 22 | |||
| 23 | 7 | add_xpath_namespace 'x' => 'TK.DevServer.Services.RentalBikeService'; | |
| 24 | |||
| 25 | 7 | has_xpath_value _timestamp => '/x:RentalBikes/x:TimeStamp'; | |
| 26 | |||
| 27 | 7 | has_xpath_object station => '/x:RentalBikes/x:Stations[1]/x:Details' => 'OpenGbg::Service::StyrOchStall::Station', | |
| 28 | handles => [qw/label capacity free_bikes free_stands full empty to_text/]; | ||
| 29 | |||
| 30 | 7 | has timestamp => ( | |
| 31 | is => 'ro', | ||
| 32 | isa => DateTime, | ||
| 33 | lazy => 1, | ||
| 34 | builder => 1, | ||
| 35 | ); | ||
| 36 | |||
| 37 | sub _build_timestamp { | ||
| 38 | 0 | ▶ | return DateTime::Format::HTTP->parse_datetime(shift->_timestamp); |
|
Subroutine
_build_timestamp: not called CC=1 SCAR=6.9
| |||
| 39 | } | ||
| 40 | |||
| 41 | 7 | finalize_class(); | |
| 42 | |||
| 43 | 7 | 1; | |
| 44 | |||
| 45 | __END__ | ||
| 46 | |||
| 47 | =pod | ||
| 48 | |||
| 49 | =encoding utf-8 | ||
| 50 | |||
| 51 | =head1 NAME | ||
| 52 | |||
| 53 | OpenGbg::Service::StyrOchStall::GetBikeStation - Get data about a bike station | ||
| 54 | |||
| 55 | =head1 VERSION | ||
| 56 | |||
| 57 | Version 0.1401, released 2016-05-05. | ||
| 58 | |||
| 59 | =head1 SYNOPSIS | ||
| 60 | |||
| 61 | my $service = OpenGbg->new->styr_och_stall; | ||
| 62 | my $station = $service->get_bike_station(1); | ||
| 63 | |||
| 64 | printf 'Time: %s', $response->timestamp; | ||
| 65 | print $station->to_text; | ||
| 66 | |||
| 67 | =head1 METHODS | ||
| 68 | |||
| 69 | All attributes and methods in L<OpenGbg::Service::StyrOchStall::Station> are available on an instance of this class. | ||
| 70 | |||
| 71 | =head2 timestamp | ||
| 72 | |||
| 73 | Returns the timestamp given in the response as a L<DateTime> object. | ||
| 74 | |||
| 75 | =head1 SOURCE | ||
| 76 | |||
| 77 | L<https://github.com/Csson/p5-OpenGbg> | ||
| 78 | |||
| 79 | =head1 HOMEPAGE | ||
| 80 | |||
| 81 | L<https://metacpan.org/release/OpenGbg> | ||
| 82 | |||
| 83 | =head1 AUTHOR | ||
| 84 | |||
| 85 | Erik Carlsson <info@code301.com> | ||
| 86 | |||
| 87 | =head1 COPYRIGHT AND LICENSE | ||
| 88 | |||
| 89 | This software is copyright (c) 2016 by Erik Carlsson. | ||
| 90 | |||
| 91 | This is free software; you can redistribute it and/or modify it under | ||
| 92 | the same terms as the Perl 5 programming language system itself. | ||
| 93 | |||
| 94 | =cut | ||