Lines 356-361
sub _numeric_column_type {
Link Here
|
356 |
return ( grep { $column_type eq $_ } @numeric_types) ? 1 : 0; |
356 |
return ( grep { $column_type eq $_ } @numeric_types) ? 1 : 0; |
357 |
} |
357 |
} |
358 |
|
358 |
|
|
|
359 |
=head3 to_api |
360 |
|
361 |
my $object_for_api = $object->to_api; |
362 |
|
363 |
=cut |
364 |
|
365 |
sub to_api { |
366 |
my ( $self ) = @_; |
367 |
my $json_object = $self->TO_JSON; |
368 |
|
369 |
# Rename attributes if there's a mapping |
370 |
if ( $self->can('to_api_mapping') ) { |
371 |
foreach my $column ( keys %{$self->to_api_mapping} ) { |
372 |
my $mapped_column = $self->to_api_mapping->{$column}; |
373 |
if ( exists $json_object->{$column} |
374 |
&& defined $mapped_column ) |
375 |
{ |
376 |
# key != undef |
377 |
$json_object->{$mapped_column} = delete $json_object->{$column}; |
378 |
} |
379 |
elsif ( exists $json_object->{$column} |
380 |
&& !defined $mapped_column ) |
381 |
{ |
382 |
# key == undef |
383 |
delete $json_object->{$column}; |
384 |
} |
385 |
} |
386 |
} |
387 |
|
388 |
return $json_object; |
389 |
} |
390 |
|
359 |
=head3 $object->unblessed_all_relateds |
391 |
=head3 $object->unblessed_all_relateds |
360 |
|
392 |
|
361 |
my $everything_into_one_hashref = $object->unblessed_all_relateds |
393 |
my $everything_into_one_hashref = $object->unblessed_all_relateds |
362 |
- |
|
|