| 1 | #!/usr/bin/perl | ||
| 2 | |||
| 3 | use strict; | ||
| 4 | use warnings; | ||
| 5 | |||
| 6 | use WWW::Shopify; | ||
| 7 | |||
| 8 | package WWW::Shopify::Model::Customer; | ||
| 9 | use parent "WWW::Shopify::Model::Item"; | ||
| 10 | |||
| 11 | my $fields; sub fields { return $fields; } | ||
| 12 | BEGIN { $fields = { | ||
| 13 | "accepts_marketing" => new WWW::Shopify::Field::Boolean(), | ||
| 14 | "created_at" => new WWW::Shopify::Field::Date(), | ||
| 15 | "email" => new WWW::Shopify::Field::String::Email(), | ||
| 16 | "phone" => new WWW::Shopify::Field::String::Phone(), | ||
| 17 | "first_name" => new WWW::Shopify::Field::String::FirstName(), | ||
| 18 | "id" => new WWW::Shopify::Field::Identifier(), | ||
| 19 | "last_name" => new WWW::Shopify::Field::String::LastName(), | ||
| 20 | "last_order_id" => new WWW::Shopify::Field::Relation::ReferenceOne('WWW::Shopify::Model::Order'), | ||
| 21 | "note" => new WWW::Shopify::Field::String::Words(0, 6), | ||
| 22 | "orders_count" => new WWW::Shopify::Field::Int(0, 1000), | ||
| 23 | "state" => new WWW::Shopify::Field::String::Enum([qw(disabled invited enabled declined)]), | ||
| 24 | "total_spent" => new WWW::Shopify::Field::Money(), | ||
| 25 | "updated_at" => new WWW::Shopify::Field::Date(), | ||
| 26 | "tags" => new WWW::Shopify::Field::String::Words(0, 6), | ||
| 27 | "last_order_name" => new WWW::Shopify::Field::String(), | ||
| 28 | "default_address" => new WWW::Shopify::Field::Relation::OwnOne('WWW::Shopify::Model::Customer::Address'), | ||
| 29 | "addresses" => new WWW::Shopify::Field::Relation::Many('WWW::Shopify::Model::Customer::Address'), | ||
| 30 | "metafields" => new WWW::Shopify::Field::Relation::Many("WWW::Shopify::Model::Metafield"), | ||
| 31 | "image_url" => new WWW::Shopify::Field::String::URL(), | ||
| 32 | "send_email_invite" => new WWW::Shopify::Field::Boolean(), | ||
| 33 | "send_email_welcome" => new WWW::Shopify::Field::Boolean(), | ||
| 34 | "password" => new WWW::Shopify::Field::String::Password(), | ||
| 35 | "multipass_identifier" => new WWW::Shopify::Field::String(), | ||
| 36 | "password_confirmation" => new WWW::Shopify::Field::String::Password(), | ||
| 37 | "verified_email" => new WWW::Shopify::Field::Boolean(), | ||
| 38 | "tax_exempt" => new WWW::Shopify::Field::Boolean(), | ||
| 39 | "tax_exemptions" => new WWW::Shopify::Field::String(), | ||
| 40 | "currency" => new WWW::Shopify::Field::Currency(), | ||
| 41 | "marketing_opt_in_level" => new WWW::Shopify::Field::String::Enum([qw(single_opt_in confirmed_opt_in unknown)]), | ||
| 42 | "sms_marketing_consent" => new WWW::Shopify::Field::Relation::OwnOne('WWW::Shopify::Model::Customer::SmsMarketingConsent'), | ||
| 43 | }; } | ||
| 44 | |||
| 45 | my $queries; sub queries { return $queries; } | ||
| 46 | BEGIN { $queries = { | ||
| 47 | created_at_min => new WWW::Shopify::Query::LowerBound('created_at'), | ||
| 48 | created_at_max => new WWW::Shopify::Query::UpperBound('created_at'), | ||
| 49 | updated_at_min => new WWW::Shopify::Query::LowerBound('updated_at'), | ||
| 50 | updated_at_max => new WWW::Shopify::Query::UpperBound('updated_at'), | ||
| 51 | name => new WWW::Shopify::Query::Match('name'), | ||
| 52 | status => new WWW::Shopify::Query::Enum('status', ['open', 'closed', 'cancelled', 'any']), | ||
| 53 | financial_status => new WWW::Shopify::Query::Enum('financial_status', ['authorized', 'pending', 'paid', 'partially_paid', 'abandoned', 'refunded', 'voided', 'any']), | ||
| 54 | fulfillment_status => new WWW::Shopify::Query::Enum('fulfillment_status', ['shipped', 'partial', 'unshipped', 'any']), | ||
| 55 | since_id => new WWW::Shopify::Query::LowerBound('id') | ||
| 56 | }; } | ||
| 57 | sub unique_fields { return qw(email); } | ||
| 58 | |||
| 59 | sub get_fields { return grep { $_ ne "password" && $_ ne "password_confirmation" && $_ ne "send_email_invite" } keys(%{$_[0]->fields}); } | ||
| 60 | sub creation_minimal { return qw(email); } | ||
| 61 | sub creation_filled { return qw(created_at); } | ||
| 62 | sub update_filled { return qw(updated_at); } | ||
| 63 | sub update_fields { return qw(email password password_confirmation metafields last_name first_name accepts_marketing tags note state send_email_invite addresses tax_exempt phone); } | ||
| 64 | sub throws_webhooks { return 1; } | ||
| 65 | |||
| 66 | sub searchable($) { return 1; } | ||
| 67 | |||
| 68 | sub read_scope { return "read_customers"; } | ||
| 69 | sub write_scope { return "write_customers"; } | ||
| 70 | |||
| 71 | sub actions { return qw(enable disable account_activation_url); } | ||
| 72 | |||
| 73 | eval(__PACKAGE__->generate_accessors); die $@ if $@; | ||
| 74 | |||
| 75 | 1; |