File Coverage

blib/lib/STIX/Opinion.pm
Criterion Covered Total %
statement 41 41 100.0
branch n/a
condition n/a
subroutine 14 14 100.0
pod n/a
total 55 55 100.0


line stmt bran cond sub pod time code
1             package STIX::Opinion;
2              
3 24     24   570 use 5.010001;
  24         103  
4 24     24   147 use strict;
  24         49  
  24         705  
5 24     24   113 use warnings;
  24         56  
  24         1590  
6 24     24   194 use utf8;
  24         85  
  24         233  
7              
8 24     24   12623 use STIX::Common::Enum;
  24         87  
  24         913  
9 24     24   167 use STIX::Common::List;
  24         47  
  24         851  
10 24     24   128 use Types::Standard qw(Str InstanceOf Enum);
  24         57  
  24         245  
11 24     24   84393 use Types::TypeTiny qw(ArrayLike);
  24         63  
  24         192  
12              
13 24     24   13993 use Moo;
  24         61  
  24         216  
14 24     24   11050 use namespace::autoclean;
  24         58  
  24         276  
15              
16             extends 'STIX::Common::Properties';
17              
18 24         2294 use constant SCHEMA =>
19 24     24   2613 'http://raw.githubusercontent.com/oasis-open/cti-stix2-json-schemas/stix2.1/schemas/sdos/opinion.json';
  24         53  
20              
21 24         1621 use constant PROPERTIES => (
22             qw(type spec_version id created modified),
23             qw(created_by_ref revoked labels confidence lang external_references object_marking_refs granular_markings extensions),
24             qw(explanation authors opinion object_refs)
25 24     24   153 );
  24         54  
26              
27 24     24   136 use constant STIX_OBJECT => 'SDO';
  24         50  
  24         1208  
28 24     24   136 use constant STIX_OBJECT_TYPE => 'opinion';
  24         76  
  24         4849  
29              
30             has authors => (is => 'rw', isa => ArrayLike [Str], default => sub { STIX::Common::List->new });
31             has opinion => (is => 'rw', isa => Enum [STIX::Common::Enum->OPINION()], required => 1);
32             has object_refs => (
33             is => 'rw',
34             isa => ArrayLike [InstanceOf ['STIX::Object', 'STIX::Common::Identifier']],
35             required => 1,
36             default => sub { [] }
37             );
38              
39             1;
40              
41             =encoding utf-8
42              
43             =head1 NAME
44              
45             STIX::Opinion - STIX Domain Object (SDO) - Opinion
46              
47             =head1 SYNOPSIS
48              
49             use STIX::Opinion;
50              
51             my $opinion = STIX::Opinion->new();
52              
53              
54             =head1 DESCRIPTION
55              
56             An Opinion is an assessment of the correctness of the information in a STIX
57             Object produced by a different entity and captures the level of agreement
58             or disagreement using a fixed scale.
59              
60              
61             =head2 METHODS
62              
63             L inherits all methods from L
64             and implements the following new ones.
65              
66             =over
67              
68             =item STIX::Opinion->new(%properties)
69              
70             Create a new instance of L.
71              
72             =item $opinion->authors
73              
74             The name of the author(s) of this opinion (e.g., the analyst(s) that
75             created it).
76              
77             =item $opinion->explanation
78              
79             An explanation of why the producer has this Opinion.
80              
81             =item $opinion->id
82              
83             =item $opinion->object_refs
84              
85             The STIX Objects (SDOs and SROs) that the opinion is being applied to.
86              
87             =item $opinion->opinion
88              
89             The opinion that the producer has about about all of the STIX Object(s)
90             listed in the object_refs property.
91              
92             =item $opinion->type
93              
94             The type of this object, which MUST be the literal C.
95              
96             =back
97              
98              
99             =head2 HELPERS
100              
101             =over
102              
103             =item $opinion->TO_JSON
104              
105             Encode the object in JSON.
106              
107             =item $opinion->to_hash
108              
109             Return the object HASH.
110              
111             =item $opinion->to_string
112              
113             Encode the object in JSON.
114              
115             =item $opinion->validate
116              
117             Validate the object using JSON Schema (see L).
118              
119             =back
120              
121              
122             =head1 SUPPORT
123              
124             =head2 Bugs / Feature Requests
125              
126             Please report any bugs or feature requests through the issue tracker
127             at L.
128             You will be notified automatically of any progress on your issue.
129              
130             =head2 Source Code
131              
132             This is open source software. The code repository is available for
133             public review and contribution under the terms of the license.
134              
135             L
136              
137             git clone https://github.com/giterlizzi/perl-STIX.git
138              
139              
140             =head1 AUTHOR
141              
142             =over 4
143              
144             =item * Giuseppe Di Terlizzi
145              
146             =back
147              
148              
149             =head1 LICENSE AND COPYRIGHT
150              
151             This software is copyright (c) 2024 by Giuseppe Di Terlizzi.
152              
153             This is free software; you can redistribute it and/or modify it under
154             the same terms as the Perl 5 programming language system itself.
155              
156             =cut