File Coverage

blib/lib/STIX/Identity.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::Identity;
2              
3 24     24   556 use 5.010001;
  24         121  
4 24     24   178 use strict;
  24         68  
  24         763  
5 24     24   124 use warnings;
  24         49  
  24         1579  
6 24     24   154 use utf8;
  24         51  
  24         213  
7              
8 24     24   952 use STIX::Common::List;
  24         63  
  24         724  
9 24     24   124 use STIX::Common::OpenVocabulary;
  24         85  
  24         848  
10 24     24   135 use Types::Standard qw(Str Enum);
  24         78  
  24         716  
11 24     24   90923 use Types::TypeTiny qw(ArrayLike);
  24         65  
  24         317  
12              
13 24     24   14147 use Moo;
  24         63  
  24         268  
14 24     24   11996 use namespace::autoclean;
  24         59  
  24         322  
15              
16             extends 'STIX::Common::Properties';
17              
18 24         2819 use constant SCHEMA =>
19 24     24   2936 'http://raw.githubusercontent.com/oasis-open/cti-stix2-json-schemas/stix2.1/schemas/sdos/identity.json';
  24         57  
20              
21 24         1775 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 roles identity_class sectors contact_information)
25 24     24   152 );
  24         52  
26              
27 24     24   142 use constant STIX_OBJECT => 'SDO';
  24         51  
  24         1209  
28 24     24   130 use constant STIX_OBJECT_TYPE => 'identity';
  24         48  
  24         6745  
29              
30             has name => (is => 'rw', isa => Str, required => 1);
31             has description => (is => 'rw', isa => Str);
32             has roles => (is => 'rw', isa => ArrayLike [Str], default => sub { STIX::Common::List->new });
33             has identity_class => (is => 'rw', isa => Enum [STIX::Common::OpenVocabulary->IDENTITY_CLASS()]);
34              
35             has sectors => (
36             is => 'rw',
37             isa => ArrayLike [Enum [STIX::Common::OpenVocabulary->INDUSTRY_SECTOR()]],
38             default => sub { STIX::Common::List->new }
39             );
40              
41             has contact_information => (is => 'rw', isa => Str);
42              
43             1;
44              
45             =encoding utf-8
46              
47             =head1 NAME
48              
49             STIX::Identity - STIX Domain Object (SDO) - Identity
50              
51             =head1 SYNOPSIS
52              
53             use STIX::Identity;
54              
55             my $identity = STIX::Identity->new();
56              
57              
58             =head1 DESCRIPTION
59              
60             Identities can represent actual individuals, organizations, or groups
61             (e.g., ACME, Inc.) as well as classes of individuals, organizations, or
62             groups.
63              
64              
65             =head2 METHODS
66              
67             L inherits all methods from L
68             and implements the following new ones.
69              
70             =over
71              
72             =item STIX::Identity->new(%properties)
73              
74             Create a new instance of L.
75              
76             =item $identity->contact_information
77              
78             The contact information (e-mail, phone number, etc.) for this Identity.
79              
80             =item $identity->description
81              
82             A description that provides more details and context about the Identity.
83              
84             =item $identity->id
85              
86             =item $identity->identity_class
87              
88             The type of entity that this Identity describes, e.g., an individual or
89             organization. C (L)
90              
91             =item $identity->name
92              
93             The name of this Identity.
94              
95             =item $identity->roles
96              
97             The list of roles that this Identity performs (e.g., CEO, Domain
98             Administrators, Doctors, Hospital, or Retailer). No open vocabulary is yet
99             defined for this property.
100              
101             =item $identity->sectors
102              
103             The list of sectors that this Identity belongs to. C
104             (L)
105              
106             =item $identity->type
107              
108             The type of this object, which MUST be the literal C.
109              
110             =back
111              
112              
113             =head2 HELPERS
114              
115             =over
116              
117             =item $identity->TO_JSON
118              
119             Encode the object in JSON.
120              
121             =item $identity->to_hash
122              
123             Return the object HASH.
124              
125             =item $identity->to_string
126              
127             Encode the object in JSON.
128              
129             =item $identity->validate
130              
131             Validate the object using JSON Schema (see L).
132              
133             =back
134              
135              
136             =head1 SUPPORT
137              
138             =head2 Bugs / Feature Requests
139              
140             Please report any bugs or feature requests through the issue tracker
141             at L.
142             You will be notified automatically of any progress on your issue.
143              
144             =head2 Source Code
145              
146             This is open source software. The code repository is available for
147             public review and contribution under the terms of the license.
148              
149             L
150              
151             git clone https://github.com/giterlizzi/perl-STIX.git
152              
153              
154             =head1 AUTHOR
155              
156             =over 4
157              
158             =item * Giuseppe Di Terlizzi
159              
160             =back
161              
162              
163             =head1 LICENSE AND COPYRIGHT
164              
165             This software is copyright (c) 2024 by Giuseppe Di Terlizzi.
166              
167             This is free software; you can redistribute it and/or modify it under
168             the same terms as the Perl 5 programming language system itself.
169              
170             =cut