summaryrefslogtreecommitdiff
path: root/lib/Travel/Routing/DE/DBRIS/Offer.pm
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Travel/Routing/DE/DBRIS/Offer.pm')
-rw-r--r--lib/Travel/Routing/DE/DBRIS/Offer.pm39
1 files changed, 39 insertions, 0 deletions
diff --git a/lib/Travel/Routing/DE/DBRIS/Offer.pm b/lib/Travel/Routing/DE/DBRIS/Offer.pm
new file mode 100644
index 0000000..47bf543
--- /dev/null
+++ b/lib/Travel/Routing/DE/DBRIS/Offer.pm
@@ -0,0 +1,39 @@
+package Travel::Routing::DE::DBRIS::Offer;
+
+use strict;
+use warnings;
+use 5.020;
+use utf8;
+
+use parent 'Class::Accessor';
+
+our $VERSION = '0.03';
+
+Travel::Routing::DE::DBRIS::Offer->mk_ro_accessors(
+ qw(class name price price_unit));
+
+sub new {
+ my ( $obj, %opt ) = @_;
+
+ my $json = $opt{json};
+
+ my $ref = {
+ class => $json->{klasse} =~ s{KLASSE_}{}r,
+ name => $json->{name},
+ price => $json->{preis}{betrag},
+ price_unit => $json->{preis}{waehrung},
+ conditions => $json->{konditionsAnzeigen},
+ };
+
+ bless( $ref, $obj );
+
+ return $ref;
+}
+
+sub conditions {
+ my ($self) = @_;
+
+ return @{ $self->{conditions} // [] };
+}
+
+1;