| 1 | # ABSTRACT: request - role - has relationship-update-data | ||
| 2 | package PONAPI::Client::Request::Role::HasRelationshipUpdateData; | ||
| 3 | |||
| 4 | use Moose::Role; | ||
| 5 | |||
| 6 | with 'PONAPI::Client::Request::Role::HasData'; | ||
| 7 | has data => ( | ||
| 8 | is => 'ro', | ||
| 9 | isa => 'Maybe[HashRef|ArrayRef]', | ||
| 10 | required => 1, | ||
| 11 | ); | ||
| 12 | |||
| 13 | no Moose::Role; 1; | ||
| 14 | |||
| 15 | __END__ | ||
| 16 | |||
| 17 | =pod | ||
| 18 | |||
| 19 | =encoding UTF-8 | ||
| 20 | |||
| 21 | =head1 NAME | ||
| 22 | |||
| 23 | PONAPI::Client::Request::Role::HasRelationshipUpdateData - request - role - has relationship-update-data | ||
| 24 | |||
| 25 | =head1 VERSION | ||
| 26 | |||
| 27 | version 0.002003 | ||
| 28 | |||
| 29 | =head1 DESCRIPTION | ||
| 30 | |||
| 31 | Similar to L<PONAPI::Client::Request::Role::HasData>, but for relationship updates. | ||
| 32 | Unlike the rest of the spec, relationship updates can take not just a hashref of data, | ||
| 33 | but also undef, or an arrayref. | ||
| 34 | |||
| 35 | # Replaces the specified relationship(s) with a one-to-one relationship to foo. | ||
| 36 | $client->update_relationships( ..., data => { type => "foo", id => 4 } ); | ||
| 37 | |||
| 38 | # Replaces the | ||
| 39 | $client->update_relationships( ..., data => [ { type => "foo", id => 4 }, { ... } ] ); | ||
| 40 | |||
| 41 | # Clears the relationship | ||
| 42 | $client->update_relationships( ..., data => undef ); | ||
| 43 | $client->update_relationships( ..., data => [] ); | ||
| 44 | |||
| 45 | The underlaying repository decides whether the one-to-one or one-to-many difference is | ||
| 46 | significant. | ||
| 47 | |||
| 48 | =head1 AUTHORS | ||
| 49 | |||
| 50 | =over 4 | ||
| 51 | |||
| 52 | =item * | ||
| 53 | |||
| 54 | Mickey Nasriachi <mickey@cpan.org> | ||
| 55 | |||
| 56 | =item * | ||
| 57 | |||
| 58 | Stevan Little <stevan@cpan.org> | ||
| 59 | |||
| 60 | =item * | ||
| 61 | |||
| 62 | Brian Fraser <hugmeir@cpan.org> | ||
| 63 | |||
| 64 | =back | ||
| 65 | |||
| 66 | =head1 COPYRIGHT AND LICENSE | ||
| 67 | |||
| 68 | This software is copyright (c) 2016 by Mickey Nasriachi, Stevan Little, Brian Fraser. | ||
| 69 | |||
| 70 | This is free software; you can redistribute it and/or modify it under | ||
| 71 | the same terms as the Perl 5 programming language system itself. | ||
| 72 | |||
| 73 | =cut |