| 1 | #!/usr/bin/perl | ||
| 2 | |||
| 3 | use strict; | ||
| 4 | use warnings; | ||
| 5 | |||
| 6 | use WWW::Shopify; | ||
| 7 | |||
| 8 | package WWW::Shopify::Model::Asset; | ||
| 9 | use parent "WWW::Shopify::Model::Item"; | ||
| 10 | |||
| 11 | sub parent { return "WWW::Shopify::Model::Theme"; } | ||
| 12 | sub countable { return undef; } | ||
| 13 | sub identifier { return qw(key theme_id); } | ||
| 14 | |||
| 15 | my $fields; sub fields { return $fields; } | ||
| 16 | BEGIN { $fields = { | ||
| 17 | "key" => new WWW::Shopify::Field::Identifier::String(), | ||
| 18 | "value" => new WWW::Shopify::Field::Text(), | ||
| 19 | "theme_id" => new WWW::Shopify::Field::Relation::Parent("WWW::Shopify::Model::Theme"), | ||
| 20 | "attachment" => new WWW::Shopify::Field::Text(), | ||
| 21 | "public_url" => new WWW::Shopify::Field::String::URL(), | ||
| 22 | "source_key" => new WWW::Shopify::Field::String(), | ||
| 23 | "src" => new WWW::Shopify::Field::String::URL(), | ||
| 24 | "created_at" => new WWW::Shopify::Field::Date(), | ||
| 25 | "updated_at" => new WWW::Shopify::Field::Date(), | ||
| 26 | "content_type" => new WWW::Shopify::Field::String("image/(gif|jpg|png)"), | ||
| 27 | "size" => new WWW::Shopify::Field::Int(1, 5000) | ||
| 28 | }; } | ||
| 29 | |||
| 30 | # Look into finding some way to validate whether it's value OR attachment. | ||
| 31 | sub included_in_parent { 0 } | ||
| 32 | sub creation_minimal { return qw(key); } | ||
| 33 | sub creation_filled { return qw(public_url created_at); } | ||
| 34 | sub update_filled { return qw(updated_at size src content_type); } | ||
| 35 | sub update_fields { qw(attachment value key) } | ||
| 36 | sub create_method { return "PUT"; } | ||
| 37 | sub paginates { undef; } | ||
| 38 | # No limit? | ||
| 39 | sub default_per_page { undef; } | ||
| 40 | sub max_per_page { undef; } | ||
| 41 | |||
| 42 | |||
| 43 | sub read_scope { return "read_themes"; } | ||
| 44 | sub write_scope { return "write_themes"; } | ||
| 45 | |||
| 46 | eval(__PACKAGE__->generate_accessors); die $@ if $@; | ||
| 47 | |||
| 48 | 1 |