| 1 | #!/usr/bin/perl | ||
| 2 | |||
| 3 | use strict; | ||
| 4 | use warnings; | ||
| 5 | |||
| 6 | use WWW::Shopify; | ||
| 7 | |||
| 8 | package WWW::Shopify::Model::Discount; | ||
| 9 | use parent "WWW::Shopify::Model::Item"; | ||
| 10 | |||
| 11 | my $fields; sub fields { return $fields; } | ||
| 12 | BEGIN { $fields = { | ||
| 13 | "applies_once" => new WWW::Shopify::Field::Boolean(), | ||
| 14 | "code" => new WWW::Shopify::Field::String(), | ||
| 15 | "ends_at" => new WWW::Shopify::Field::Date(min => '2010-01-01 00:00:00', max => 'now'), | ||
| 16 | "starts_at" => new WWW::Shopify::Field::Date(min => '2010-01-01 00:00:00', max => 'now'), | ||
| 17 | "id" => new WWW::Shopify::Field::Identifier(), | ||
| 18 | "minimum_order_amount" => new WWW::Shopify::Field::Money(), | ||
| 19 | "status" => new WWW::Shopify::Field::String::Enum(["enabled", "disabled"]), | ||
| 20 | "usage_limit" => new WWW::Shopify::Field::Int(), | ||
| 21 | "value" => new WWW::Shopify::Field::Money(), | ||
| 22 | "discount_type" => new WWW::Shopify::Field::String::Enum(["fixed_amount", "percentage"]), | ||
| 23 | "applies_to_resource" => new WWW::Shopify::Field::String::Enum(["order", "product", "collection", "customer_group"]), | ||
| 24 | "times_used" => new WWW::Shopify::Field::Int(), | ||
| 25 | "applies_to_id" => new WWW::Shopify::Field::Relation::ReferenceOne("WWW::Shopify::Model::Product") | ||
| 26 | }; } | ||
| 27 | |||
| 28 | sub creation_minimal { return qw(discount_type code value); } | ||
| 29 | sub creation_filled { return qw(status); } | ||
| 30 | sub update_filled { return qw(); } | ||
| 31 | |||
| 32 | sub actions { return qw(disable enable); } | ||
| 33 | |||
| 34 | sub countable { return 0; } | ||
| 35 | |||
| 36 | sub default_per_page { return 15; } | ||
| 37 | sub max_per_page { return 200; } | ||
| 38 | |||
| 39 | sub needs_login { return 1; } | ||
| 40 | sub needs_plus { return 1; } | ||
| 41 | |||
| 42 | eval(__PACKAGE__->generate_accessors); die $@ if $@; | ||
| 43 | |||
| 44 | 1; |