Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Add payment_options to Entry data structure for REST API

  • Loading branch information...
commit ce9045203fc894082a2defa11eb25bb620659ed4 1 parent 6d14d06
@autarch autarch authored
View
5 lib/VegGuide/Vendor.pm
@@ -2322,6 +2322,11 @@ sub _core_rest_data {
$rest{price_range} = $self->price_range()->description();
}
+ my @options = $self->payment_options();
+ if (@options) {
+ $rest{payment_options} = [ map { $_->name() } @options ];
+ }
+
if ( $self->has_hours_info() ) {
$rest{hours} = [ $self->hours_as_descriptions() ];
}
View
8 share/mason/site/api-docs
@@ -481,6 +481,14 @@ unless ($toc) {
<td>&#x2714;</td>
</tr>
<tr>
+ <td>payment_options</td>
+ <td>array of strings</td>
+ <td>
+ An array of strings with payment options like "Check" or "Visa". These
+ are always returned in alphabetically sorted order.
+ </td>
+ <td></td>
+ <tr>
<td>
creation_datetime,<br />
last_modified_datetime
View
15 t/rest-api/Entry.t
@@ -415,6 +415,21 @@ use_test_database();
my $entry = json_ok($response);
+ my @options = (
+ 'American Express',
+ 'Check',
+ q{Diner's Club},
+ 'Discover',
+ 'MasterCard',
+ 'Visa'
+ );
+
+ is_deeply(
+ $entry->{payment_options},
+ \@options,
+ 'got expected payment_options for entry'
+ );
+
my @tags = (
'(Mostly) Organic',
'Large Group-Friendly',
Please sign in to comment.
Something went wrong with that request. Please try again.