File Coverage

blib/lib/WWW/MetaForge/ArcRaiders/Result/Quest.pm
Criterion Covered Total %
statement 11 11 100.0
branch n/a
condition 6 6 100.0
subroutine 4 4 100.0
pod 1 1 100.0
total 22 22 100.0


line stmt bran cond sub pod time code
1             package WWW::MetaForge::ArcRaiders::Result::Quest;
2             our $AUTHORITY = 'cpan:GETTY';
3             # ABSTRACT: Quest result object
4             our $VERSION = '0.002';
5 6     6   351904 use Moo;
  6         7979  
  6         70  
6 6     6   4542 use Types::Standard qw(Str Int ArrayRef HashRef Maybe);
  6         109175  
  6         61  
7 6     6   16697 use namespace::clean;
  6         13304  
  6         52  
8              
9             has id => (
10             is => 'ro',
11             isa => Str,
12             required => 1,
13             );
14              
15             has name => (
16             is => 'ro',
17             isa => Str,
18             required => 1,
19             );
20              
21             has type => (
22             is => 'ro',
23             isa => Maybe[Str],
24             );
25              
26             has description => (
27             is => 'ro',
28             isa => Maybe[Str],
29             );
30              
31             has objectives => (
32             is => 'ro',
33             isa => ArrayRef[Str],
34             default => sub { [] },
35             );
36              
37             has required_items => (
38             is => 'ro',
39             isa => ArrayRef[HashRef],
40             default => sub { [] },
41             );
42              
43             has rewards => (
44             is => 'ro',
45             isa => ArrayRef[HashRef],
46             default => sub { [] },
47             );
48              
49             has xp_reward => (
50             is => 'ro',
51             isa => Maybe[Int],
52             );
53              
54             has reputation_reward => (
55             is => 'ro',
56             isa => Maybe[Int],
57             );
58              
59             has next_quest => (
60             is => 'ro',
61             isa => Maybe[Int],
62             );
63              
64             has prev_quest => (
65             is => 'ro',
66             isa => Maybe[Int],
67             );
68              
69             has last_updated => (
70             is => 'ro',
71             isa => Maybe[Str],
72             );
73              
74             has _raw => (
75             is => 'ro',
76             isa => HashRef,
77             );
78              
79             sub from_hashref {
80 11     11 1 15397 my ($class, $data) = @_;
81             return $class->new(
82             id => $data->{id},
83             name => $data->{name},
84             type => $data->{type},
85             description => $data->{description},
86             objectives => $data->{objectives} // [],
87             required_items => $data->{requiredItems} // [],
88             rewards => $data->{rewards} // [],
89             xp_reward => $data->{xpReward},
90             reputation_reward => $data->{reputationReward},
91             next_quest => $data->{nextQuest},
92             prev_quest => $data->{prevQuest},
93             last_updated => $data->{lastUpdated},
94 11   100     423 _raw => $data,
      100        
      100        
95             );
96             }
97              
98             1;
99              
100             __END__
101              
102             =pod
103              
104             =encoding UTF-8
105              
106             =head1 NAME
107              
108             WWW::MetaForge::ArcRaiders::Result::Quest - Quest result object
109              
110             =head1 VERSION
111              
112             version 0.002
113              
114             =head1 SYNOPSIS
115              
116             my $quests = $api->quests(type => 'StoryQuest');
117             for my $quest (@$quests) {
118             say $quest->name;
119             say " " . $_ for $quest->objectives->@*;
120             }
121              
122             =head1 DESCRIPTION
123              
124             Represents a quest from the ARC Raiders game.
125              
126             =head2 id
127              
128             Quest identifier (string slug).
129              
130             =head2 name
131              
132             Quest name.
133              
134             =head2 type
135              
136             Quest type (e.g., "StoryQuest", "SideQuest").
137              
138             =head2 description
139              
140             Quest description text.
141              
142             =head2 objectives
143              
144             ArrayRef of objective strings.
145              
146             =head2 required_items
147              
148             ArrayRef of required items: C<[{ item => "Name", quantity => 5 }]>.
149              
150             =head2 rewards
151              
152             ArrayRef of rewards: C<[{ item => "Name", quantity => 1 }, { coins => 500 }]>.
153              
154             =head2 xp_reward
155              
156             Experience points reward.
157              
158             =head2 reputation_reward
159              
160             Reputation points reward.
161              
162             =head2 next_quest
163              
164             ID of next quest in chain.
165              
166             =head2 prev_quest
167              
168             ID of previous quest in chain.
169              
170             =head2 last_updated
171              
172             ISO timestamp of last data update.
173              
174             =head2 from_hashref
175              
176             my $quest = WWW::MetaForge::ArcRaiders::Result::Quest->from_hashref(\%data);
177              
178             Construct from API response.
179              
180             =head1 SUPPORT
181              
182             =head2 Issues
183              
184             Please report bugs and feature requests on GitHub at
185             L<https://github.com/Getty/p5-www-metaforge/issues>.
186              
187             =head2 IRC
188              
189             You can reach Getty on C<irc.perl.org> for questions and support.
190              
191             =head1 CONTRIBUTING
192              
193             Contributions are welcome! Please fork the repository and submit a pull request.
194              
195             =head1 AUTHOR
196              
197             Torsten Raudssus <torsten@raudssus.de>
198              
199             =head1 COPYRIGHT AND LICENSE
200              
201             This software is copyright (c) 2026 by Torsten Raudssus.
202              
203             This is free software; you can redistribute it and/or modify it under
204             the same terms as the Perl 5 programming language system itself.
205              
206             =cut