| 1 | #!/usr/bin/perl | ||
| 2 | |||
| 3 | use strict; | ||
| 4 | use warnings; | ||
| 5 | |||
| 6 | use WWW::Shopify; | ||
| 7 | |||
| 8 | package WWW::Shopify::Model::Comment; | ||
| 9 | use parent 'WWW::Shopify::Model::Item'; | ||
| 10 | |||
| 11 | my $fields; sub fields { return $fields; } | ||
| 12 | BEGIN { $fields = { | ||
| 13 | "article_id" => new WWW::Shopify::Field::Relation::Parent("WWW::Shopify::Model::Article"), | ||
| 14 | "blog_id" => new WWW::Shopify::Field::Relation::ReferenceOne("WWW::Shopify::Model::Blog"), | ||
| 15 | "body" => new WWW::Shopify::Field::Text(), | ||
| 16 | "body_html" => new WWW::Shopify::Field::Text::HTML(), | ||
| 17 | "created_at" => new WWW::Shopify::Field::Date(), | ||
| 18 | "email" => new WWW::Shopify::Field::String::Email(), | ||
| 19 | "id" => new WWW::Shopify::Field::Identifier(), | ||
| 20 | "ip" => new WWW::Shopify::Field::String::IPAddress(), | ||
| 21 | "published_at" => new WWW::Shopify::Field::Date(), | ||
| 22 | "status" => new WWW::Shopify::Field::String::Enum([qw(removed unapproved published spam)]), | ||
| 23 | "updated_at" => new WWW::Shopify::Field::Date(), | ||
| 24 | "user_agent" => new WWW::Shopify::Field::String(), | ||
| 25 | "author" => new WWW::Shopify::Field::String() | ||
| 26 | |||
| 27 | }; } | ||
| 28 | |||
| 29 | my $queries; sub queries { return $queries; } | ||
| 30 | BEGIN { $queries = { | ||
| 31 | article_id => new WWW::Shopify::Query::Match('article_id'), | ||
| 32 | blog_id => new WWW::Shopify::Query::Match('blog_id'), | ||
| 33 | since_id => new WWW::Shopify::Query::LowerBound('id'), | ||
| 34 | published_status => new WWW::Shopify::Query::Enum("published_status", [{ "published" => { status => "published" } }, { "unpublished" => { status => {"!=" => "published"} } }, { "any" => { } }]), | ||
| 35 | status => new WWW::Shopify::Query::Match('status'), | ||
| 36 | created_at_min => new WWW::Shopify::Query::LowerBound('created_at'), | ||
| 37 | created_at_max => new WWW::Shopify::Query::UpperBound('created_at'), | ||
| 38 | updated_at_min => new WWW::Shopify::Query::LowerBound('updated_at'), | ||
| 39 | updated_at_max => new WWW::Shopify::Query::UpperBound('updated_at'), | ||
| 40 | published_at_min => new WWW::Shopify::Query::LowerBound('published_at'), | ||
| 41 | published_at_max => new WWW::Shopify::Query::UpperBound('published_at'), | ||
| 42 | }; } | ||
| 43 | |||
| 44 | sub updatable { return undef; } | ||
| 45 | sub deletable { return undef; } | ||
| 46 | sub parent { return "WWW::Shopify::Model::Article" } | ||
| 47 | sub actions { return qw(remove approve not_spam spam); } | ||
| 48 | sub create_minimal { return qw(body author email ip blog_id article_id); } | ||
| 49 | sub create_filled { return qw(body_html created_at id published_at status updated_at user_agent); } | ||
| 50 | |||
| 51 | sub read_scope { return "read_content"; } | ||
| 52 | sub write_scope { return "write_content"; } | ||
| 53 | |||
| 54 | eval(__PACKAGE__->generate_accessors); die $@ if $@; | ||
| 55 | |||
| 56 | 1 |