| 1 | #!/usr/bin/perl | ||
| 2 | |||
| 3 | use strict; | ||
| 4 | use warnings; | ||
| 5 | |||
| 6 | package WWW::Shopify::Model::Product::Variant; | ||
| 7 | use parent 'WWW::Shopify::Model::Item'; | ||
| 8 | |||
| 9 | my $fields; sub fields { return $fields; } | ||
| 10 | BEGIN { $fields = { | ||
| 11 | "fulfillment_service" => new WWW::Shopify::Field::String::Enum(["manual", "automatic"]), | ||
| 12 | "grams" => new WWW::Shopify::Field::Int(), | ||
| 13 | "weight" => new WWW::Shopify::Field::Float(), | ||
| 14 | "weight_unit" => new WWW::Shopify::Field::String::Enum(["g", "kg", "oz", "lb"]), | ||
| 15 | "inventory_management" => new WWW::Shopify::Field::String::Enum(["manual", "shopify"]), | ||
| 16 | "inventory_policy" => new WWW::Shopify::Field::String("continue"), | ||
| 17 | "inventory_quantity_adjustment" => new WWW::Shopify::Field::Int(), | ||
| 18 | "option1" => new WWW::Shopify::Field::String::Words(), | ||
| 19 | "option2" => new WWW::Shopify::Field::String::Words(), | ||
| 20 | "option3" => new WWW::Shopify::Field::String::Words(), | ||
| 21 | "position" => new WWW::Shopify::Field::Int(), | ||
| 22 | "price" => new WWW::Shopify::Field::Money(), | ||
| 23 | "requires_shipping" => new WWW::Shopify::Field::Boolean(), | ||
| 24 | "sku" => new WWW::Shopify::Field::String(), | ||
| 25 | "taxable" => new WWW::Shopify::Field::Boolean(), | ||
| 26 | "tax_code" => new WWW::Shopify::Field::String(), | ||
| 27 | "title" => new WWW::Shopify::Field::String::Words(), | ||
| 28 | "compare_at_price" => new WWW::Shopify::Field::Money(), | ||
| 29 | "inventory_quantity" => new WWW::Shopify::Field::Int(), | ||
| 30 | "old_inventory_quantity" => new WWW::Shopify::Field::Int(), | ||
| 31 | "barcode" => new WWW::Shopify::Field::String(), | ||
| 32 | "metafields" => new WWW::Shopify::Field::Relation::Many("WWW::Shopify::Model::Metafield"), | ||
| 33 | "id" => new WWW::Shopify::Field::Identifier(), | ||
| 34 | "product_id" => new WWW::Shopify::Field::Relation::Parent('WWW::Shopify::Model::Product'), | ||
| 35 | "created_at" => new WWW::Shopify::Field::Date(), | ||
| 36 | "updated_at" => new WWW::Shopify::Field::Date(), | ||
| 37 | "image_id" => new WWW::Shopify::Field::Relation::ReferenceOne("WWW::Shopify::Model::Product::Image"), | ||
| 38 | "presentment_prices" => new WWW::Shopify::Field::Relation::Many("WWW::Shopify::Model::Product::Variant::PresentmentPrice"), | ||
| 39 | "inventory_item_id" => new WWW::Shopify::Field::Relation::ReferenceOne("WWW::Shopify::Model::InventoryItem") | ||
| 40 | }; } | ||
| 41 | |||
| 42 | sub parent { return 'WWW::Shopify::Model::Product'; } | ||
| 43 | |||
| 44 | sub creation_minimal { return qw(option1 price); } | ||
| 45 | sub creation_filled { return qw(id created_at product_id); } | ||
| 46 | sub update_filled { return qw(updated_at); } | ||
| 47 | sub update_fields { return qw(fulfillment_service weight weight_unit inventory_management inventory_policy option1 option2 option3 position price requires_shipping sku taxable compare_at_price inventory_quantity barcode metafields); } | ||
| 48 | |||
| 49 | sub get_through_parent { return undef; } | ||
| 50 | sub update_through_parent { return undef; } | ||
| 51 | sub delete_through_parent { return undef; } | ||
| 52 | |||
| 53 | sub read_scope { return "read_products"; } | ||
| 54 | sub write_scope { return "write_products"; } | ||
| 55 | |||
| 56 | eval(__PACKAGE__->generate_accessors); die $@ if $@; | ||
| 57 | |||
| 58 | 1 |