« OpenGbg/Service/TrafficCamera/CameraDevices.pm
↑ Summary
OpenGbg/Service/StyrOchStall/GetBikeStations.pm »
| 1 | 6 | ▶ | use 5.10.0; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 2 | 6 | ▶ | use strict; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 3 | 6 | ▶ | use warnings; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 4 | |||
| 5 | package OpenGbg::Service::Bridge; | ||
| 6 | |||
| 7 | # ABSTRACT: Entry point to the Bridge service | ||
| 8 | 6 | our $AUTHORITY = 'cpan:CSSON'; # AUTHORITY | |
| 9 | 6 | our $VERSION = '0.1402'; | |
| 10 | |||
| 11 | 6 | ▶ | use OpenGbg::Elk; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 12 | 6 | ▶ | use namespace::autoclean; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 13 | 6 | ▶ | use Types::Standard qw/Str/; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 14 | |||
| 15 | 6 | ▶ | use OpenGbg::Service::Bridge::GetIsCurrentlyOpen; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 16 | 6 | ▶ | use OpenGbg::Service::Bridge::GetOpenedStatus; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 17 | |||
| 18 | 6 | with 'OpenGbg::Service::Getter'; | |
| 19 | |||
| 20 | 6 | has handler => ( | |
| 21 | is => 'ro', | ||
| 22 | required => 1, | ||
| 23 | ); | ||
| 24 | 6 | has service_base => ( | |
| 25 | is => 'rw', | ||
| 26 | isa => Str, | ||
| 27 | default => 'BridgeService/v1.0/', | ||
| 28 | ); | ||
| 29 | |||
| 30 | sub get_is_currently_open { | ||
| 31 | 0 | ▶ | my $self = shift; |
|
Subroutine
get_is_currently_open: not called CC=1 SCAR=6.9
Pod
documented
| |||
| 32 | |||
| 33 | 0 | my $url = 'GetGABOpenedStatus/%s?'; | |
| 34 | 0 | my $response = $self->getter($url, 'get_is_currently_open'); | |
| 35 | |||
| 36 | 0 | return OpenGbg::Service::Bridge::GetIsCurrentlyOpen->new(xml => $response); | |
| 37 | } | ||
| 38 | sub get_opened_status { | ||
| 39 | 0 | ▶ | my $self = shift; |
|
Subroutine
get_opened_status: not called CC=1 SCAR=6.9
Pod
documented
| |||
| 40 | 0 | my $start = shift; | |
| 41 | 0 | my $end = shift; | |
| 42 | |||
| 43 | 0 | my $url = "GetGABOpenedStatus/%s/$start/$end?"; | |
| 44 | 0 | my $response = $self->getter($url, 'get_opened_status'); | |
| 45 | |||
| 46 | 0 | return OpenGbg::Service::Bridge::GetOpenedStatus->new(xml => $response); | |
| 47 | } | ||
| 48 | |||
| 49 | sub is_open { | ||
| 50 | 0 | ▶ | return shift->get_is_currently_open->is_open; |
|
Subroutine
is_open: not called CC=1 SCAR=6.9
Pod
undocumented
| |||
| 51 | } | ||
| 52 | |||
| 53 | 6 | __PACKAGE__->meta->make_immutable; | |
| 54 | |||
| 55 | 6 | 1; | |
| 56 | |||
| 57 | __END__ | ||
| 58 | |||
| 59 | =pod | ||
| 60 | |||
| 61 | =encoding utf-8 | ||
| 62 | |||
| 63 | =head1 NAME | ||
| 64 | |||
| 65 | OpenGbg::Service::Bridge - Entry point to the Bridge service | ||
| 66 | |||
| 67 | =head1 VERSION | ||
| 68 | |||
| 69 | Version 0.1402, released 2016-08-12. | ||
| 70 | |||
| 71 | =head1 SYNOPSIS | ||
| 72 | |||
| 73 | my $bridge = OpenGbg->new->bridge; | ||
| 74 | my $response = $bridge->get_is_currently_open; | ||
| 75 | |||
| 76 | print $response->is_open ? 'It is open' : 'It is closed'; | ||
| 77 | |||
| 78 | =head1 DESCRIPTION | ||
| 79 | |||
| 80 | The Göta älvbron is a major bascule bridge in Gothenburg that opens more or less daily. This service publishes two methods with regards to its status. | ||
| 81 | |||
| 82 | L<Official documentation|http://data.goteborg.se/Pages/Webservice.aspx?ID=24> | ||
| 83 | |||
| 84 | See L<OpenGbg> for general information. | ||
| 85 | |||
| 86 | =head1 METHODS | ||
| 87 | |||
| 88 | =head2 get_is_currently_open | ||
| 89 | |||
| 90 | This method is for checking if the bridge is currently open. | ||
| 91 | |||
| 92 | Returns a L<GetIsCurrentlyOpen|OpenGbg::Service::Bridge::GetIsCurrentlyOpen> object. | ||
| 93 | |||
| 94 | =head2 get_opened_status($startdate, $enddate) | ||
| 95 | |||
| 96 | This method is for checking when it was opened in the past. | ||
| 97 | |||
| 98 | C<$startdate> and C<$enddate> are mandatory filtering arguments, both are expected to be in the iso-8601 representation: C<yyyy-mm-dd>. The ending date is not inclusive. | ||
| 99 | |||
| 100 | Returns a L<GetOpenedStatus|OpenGbg::Service::Bridge::GetOpenedStatus> object. | ||
| 101 | |||
| 102 | =head1 SOURCE | ||
| 103 | |||
| 104 | L<https://github.com/Csson/p5-OpenGbg> | ||
| 105 | |||
| 106 | =head1 HOMEPAGE | ||
| 107 | |||
| 108 | L<https://metacpan.org/release/OpenGbg> | ||
| 109 | |||
| 110 | =head1 AUTHOR | ||
| 111 | |||
| 112 | Erik Carlsson <info@code301.com> | ||
| 113 | |||
| 114 | =head1 COPYRIGHT AND LICENSE | ||
| 115 | |||
| 116 | This software is copyright (c) 2016 by Erik Carlsson. | ||
| 117 | |||
| 118 | This is free software; you can redistribute it and/or modify it under | ||
| 119 | the same terms as the Perl 5 programming language system itself. | ||
| 120 | |||
| 121 | =cut | ||