| 1 | #!/usr/bin/perl | ||
| 2 | |||
| 3 | use strict; | ||
| 4 | use warnings; | ||
| 5 | |||
| 6 | use WWW::Shopify; | ||
| 7 | |||
| 8 | package WWW::Shopify::Model::CustomCollection::Collect; | ||
| 9 | use parent "WWW::Shopify::Model::Item"; | ||
| 10 | |||
| 11 | my $fields; sub fields { return $fields; } | ||
| 12 | BEGIN { $fields = { | ||
| 13 | "product_id" => new WWW::Shopify::Field::Relation::ReferenceOne("WWW::Shopify::Model::Product", 1), | ||
| 14 | "collection_id" => new WWW::Shopify::Field::Relation::ReferenceOne("WWW::Shopify::Model::CustomCollection", 1), | ||
| 15 | "created_at" => new WWW::Shopify::Field::Date(), | ||
| 16 | "updated_at" => new WWW::Shopify::Field::Date(), | ||
| 17 | "featured" => new WWW::Shopify::Field::Boolean(), | ||
| 18 | "position" => new WWW::Shopify::Field::Int(), | ||
| 19 | "id" => new WWW::Shopify::Field::Identifier(), | ||
| 20 | # Same as position, but padded with 0s. Unfortunately, this is a lie, and is ocassionally a product name, arbitarily. | ||
| 21 | "sort_value" => new WWW::Shopify::Field::String(), | ||
| 22 | }; } | ||
| 23 | |||
| 24 | |||
| 25 | my $queries; sub queries { return $queries; } | ||
| 26 | BEGIN { $queries = { | ||
| 27 | collection_id => new WWW::Shopify::Query::Match('collection_id') | ||
| 28 | }; } | ||
| 29 | |||
| 30 | sub creation_minimal { return qw(product_id collection_id); } | ||
| 31 | sub creation_filled { return qw(position created_at); } | ||
| 32 | sub update_filled { return qw(updated_at); } | ||
| 33 | |||
| 34 | sub read_scope { return "read_products"; } | ||
| 35 | sub write_scope { return "write_products"; } | ||
| 36 | |||
| 37 | eval(__PACKAGE__->generate_accessors); die $@ if $@; | ||
| 38 | |||
| 39 | 1; |