summaryrefslogtreecommitdiff
path: root/lib/DeWeave/Collection.pm
blob: 803a8ccea87e0194ba7836dc6aad93fe459b03e0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
package DeWeave::Collection; 
use Moose;
use namespace::autoclean;
use MooseX::Types::Moose qw(ArrayRef Int Str Num);
use JSON::Any;
use DeWeave::EDO;
 
has items => (
    isa => ArrayRef['DeWeave::WBO'],
    is => 'ro',
    required => 1,
);
 
sub from_json {
    my ($class,$json,$crypt)=@_;
 
    my $j = JSON::Any->new;
 
    my $args = $j->decode($json);
    use Data::Dump 'pp';warn pp $args;
 
    my @items = map {
        DeWeave::EDO->new({%$_,__crypt=>$crypt})
      @$args;
    return $class->new({
        items => \@items,
    });
}
 
1;