File Coverage

blib/lib/STIX/Grouping.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::Grouping;
2              
3 24     24   536 use 5.010001;
  24         103  
4 24     24   173 use strict;
  24         49  
  24         829  
5 24     24   122 use warnings;
  24         52  
  24         1394  
6 24     24   160 use utf8;
  24         51  
  24         206  
7              
8 24     24   1084 use STIX::Common::List;
  24         505  
  24         1209  
9 24     24   15954 use STIX::Common::OpenVocabulary;
  24         91  
  24         1117  
10 24     24   151 use Types::Standard qw(Str Enum InstanceOf);
  24         45  
  24         234  
11 24     24   57414 use Types::TypeTiny qw(ArrayLike);
  24         57  
  24         246  
12              
13 24     24   15535 use Moo;
  24         58  
  24         208  
14 24     24   11062 use namespace::autoclean;
  24         59  
  24         268  
15              
16             extends 'STIX::Common::Properties';
17              
18 24         2368 use constant SCHEMA =>
19 24     24   2607 'http://raw.githubusercontent.com/oasis-open/cti-stix2-json-schemas/stix2.1/schemas/sdos/grouping.json';
  24         58  
20              
21 24         1572 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(name description context object_refs)
25 24     24   146 );
  24         49  
26              
27 24     24   135 use constant STIX_OBJECT => 'SDO';
  24         47  
  24         1240  
28 24     24   156 use constant STIX_OBJECT_TYPE => 'grouping';
  24         43  
  24         4637  
29              
30             has name => (is => 'rw', required => 1, isa => Str);
31             has description => (is => 'rw', isa => Str);
32             has context => (is => 'rw', required => 1, isa => Enum [STIX::Common::OpenVocabulary->GROUPING_CONTEXT()]);
33             has object_refs => (
34             is => 'rw',
35             required => 1,
36             isa => ArrayLike [InstanceOf ['STIX::Object', 'STIX::Common::Identifier']],
37             default => sub { [] }
38             );
39              
40             1;
41              
42              
43             =encoding utf-8
44              
45             =head1 NAME
46              
47             STIX::Grouping - STIX Domain Object (SDO) - Grouping
48              
49             =head1 SYNOPSIS
50              
51             use STIX::Grouping;
52              
53             my $grouping = STIX::Grouping->new();
54              
55              
56             =head1 DESCRIPTION
57              
58             A Grouping object explicitly asserts that the referenced STIX Objects have
59             a shared content.
60              
61              
62             =head2 METHODS
63              
64             L inherits all methods from L
65             and implements the following new ones.
66              
67             =over
68              
69             =item STIX::Grouping->new(%properties)
70              
71             Create a new instance of L.
72              
73             =item $grouping->context
74              
75             A short description of the particular context shared by the content
76             referenced by the Grouping.
77              
78             =item $grouping->description
79              
80             A description which provides more details and context about the Grouping,
81             potentially including the purpose and key characteristics.
82              
83             =item $grouping->id
84              
85             =item $grouping->name
86              
87             A name used to identify the Grouping.
88              
89             =item $grouping->object_refs
90              
91             The STIX Objects (SDOs and SROs) that are referred to by this Grouping.
92              
93             =item $grouping->type
94              
95             The type of this object, which MUST be the literal C.
96              
97             =back
98              
99              
100             =head2 HELPERS
101              
102             =over
103              
104             =item $grouping->TO_JSON
105              
106             Encode the object in JSON.
107              
108             =item $grouping->to_hash
109              
110             Return the object HASH.
111              
112             =item $grouping->to_string
113              
114             Encode the object in JSON.
115              
116             =item $grouping->validate
117              
118             Validate the object using JSON Schema (see L).
119              
120             =back
121              
122              
123             =head1 SUPPORT
124              
125             =head2 Bugs / Feature Requests
126              
127             Please report any bugs or feature requests through the issue tracker
128             at L.
129             You will be notified automatically of any progress on your issue.
130              
131             =head2 Source Code
132              
133             This is open source software. The code repository is available for
134             public review and contribution under the terms of the license.
135              
136             L
137              
138             git clone https://github.com/giterlizzi/perl-STIX.git
139              
140              
141             =head1 AUTHOR
142              
143             =over 4
144              
145             =item * Giuseppe Di Terlizzi
146              
147             =back
148              
149              
150             =head1 LICENSE AND COPYRIGHT
151              
152             This software is copyright (c) 2024 by Giuseppe Di Terlizzi.
153              
154             This is free software; you can redistribute it and/or modify it under
155             the same terms as the Perl 5 programming language system itself.
156              
157             =cut