| 1 | package APISchema::Validator::Decoder; | ||
| 2 | use strict; | ||
| 3 | use warnings; | ||
| 4 | |||
| 5 | # cpan | ||
| 6 | use JSON::XS qw(decode_json); | ||
| 7 | use URL::Encode qw(url_params_mixed); | ||
| 8 | use Class::Accessor::Lite ( new => 1 ); | ||
| 9 | |||
| 10 | sub perl { | ||
| 11 | my ($self, $body) = @_; | ||
| 12 | return $body; | ||
| 13 | } | ||
| 14 | |||
| 15 | my $JSON = JSON::XS->new->utf8; | ||
| 16 | sub json { | ||
| 17 | my ($self, $body) = @_; | ||
| 18 | return $JSON->decode($body); | ||
| 19 | } | ||
| 20 | |||
| 21 | sub url_parameter { | ||
| 22 | my ($self, $body) = @_; | ||
| 23 | return url_params_mixed($body, 1); | ||
| 24 | } | ||
| 25 | |||
| 26 | 1; |