| 1 | #!/usr/bin/perl | ||
| 2 | |||
| 3 | use strict; | ||
| 4 | use warnings; | ||
| 5 | |||
| 6 | use WWW::Shopify; | ||
| 7 | |||
| 8 | package WWW::Shopify::Model::Product::Image; | ||
| 9 | use parent "WWW::Shopify::Model::NestedItem"; | ||
| 10 | |||
| 11 | my $fields; sub fields { return $fields; } | ||
| 12 | BEGIN { $fields = { | ||
| 13 | "id" => new WWW::Shopify::Field::Identifier(), | ||
| 14 | "position" => new WWW::Shopify::Field::Int(), | ||
| 15 | "width" => new WWW::Shopify::Field::Int(), | ||
| 16 | "height" => new WWW::Shopify::Field::Int(), | ||
| 17 | "src" => new WWW::Shopify::Field::String::URL::Image(), | ||
| 18 | "attachment" => new WWW::Shopify::Field::Text(), | ||
| 19 | # There are are alts definitely over 255. | ||
| 20 | "alt" => new WWW::Shopify::Field::Text(), | ||
| 21 | "filename" => new WWW::Shopify::Field::String(), | ||
| 22 | "product_id" => new WWW::Shopify::Field::Relation::Parent('WWW::Shopify::Model::Product'), | ||
| 23 | "created_at" => new WWW::Shopify::Field::Date(), | ||
| 24 | "updated_at" => new WWW::Shopify::Field::Date(), | ||
| 25 | "metafields" => new WWW::Shopify::Field::Relation::Many('WWW::Shopify::Model::Metafield'), | ||
| 26 | "variant_ids" => new WWW::Shopify::Field::Freeform::Array() | ||
| 27 | }; } | ||
| 28 | |||
| 29 | #sub creation_minimal { return qw(filename); } | ||
| 30 | sub creation_filled { return qw(id created_at ); } | ||
| 31 | sub update_filled { return qw(updated_at); } | ||
| 32 | sub update_fields { return qw(metafields position variant_ids); } | ||
| 33 | sub get_fields { return qw(id position width height src filename product_id created_at updated_at variant_ids metafields) } | ||
| 34 | |||
| 35 | sub read_scope { return "read_products"; } | ||
| 36 | sub write_scope { return "write_products"; } | ||
| 37 | |||
| 38 | eval(__PACKAGE__->generate_accessors); die $@ if $@; | ||
| 39 | |||
| 40 | 1 |