Separate out App::IdiotBox::* DB objects and put create/update
[catagits/App-IdiotBox.git] / lib / App / IdiotBox / Video.pm
diff --git a/lib/App/IdiotBox/Video.pm b/lib/App/IdiotBox/Video.pm
new file mode 100644 (file)
index 0000000..99b7c38
--- /dev/null
@@ -0,0 +1,20 @@
+package App::IdiotBox::Video;
+
+use Moo;
+
+sub fields { return qw(slug bucket_slug name author details announcement_id) }
+
+sub slug { shift->{slug} }
+sub name { shift->{name} }
+sub author { shift->{author} }
+sub details { shift->{details} }
+sub bucket { shift->{bucket} }
+sub file_name {
+  (my $s = join(' ', @{+shift}{qw(author name)})) =~ s/ /-/g;
+  $s;
+}
+sub url_path {
+  join('/', $_[0]->bucket->slug, $_[0]->slug);
+}
+
+1;