File Coverage

blib/lib/STIX/Observable/Type/EmailMIMEPart.pm
Criterion Covered Total %
statement 26 26 100.0
branch n/a
condition n/a
subroutine 9 9 100.0
pod n/a
total 35 35 100.0


line stmt bran cond sub pod time code
1             package STIX::Observable::Type::EmailMIMEPart;
2              
3 24     24   574 use 5.010001;
  24         116  
4 24     24   178 use strict;
  24         87  
  24         842  
5 24     24   127 use warnings;
  24         78  
  24         1536  
6 24     24   166 use utf8;
  24         56  
  24         280  
7              
8 24     24   995 use Moo;
  24         64  
  24         218  
9 24     24   12008 use Types::Standard qw(Str InstanceOf);
  24         66  
  24         236  
10 24     24   61997 use namespace::autoclean;
  24         93  
  24         296  
11              
12             extends 'STIX::Object';
13              
14 24         3240 use constant SCHEMA =>
15 24     24   3520 'http://raw.githubusercontent.com/oasis-open/cti-stix2-json-schemas/stix2.1/schemas/observables/email-message.json#/definitions/mime-part-type';
  24         59  
16              
17 24         4781 use constant PROPERTIES => (qw(
18             body body_raw_ref content_type content_disposition
19 24     24   207 ));
  24         59  
20              
21             has body => (is => 'rw', isa => Str);
22              
23             has body_raw_ref => (
24             is => 'rw',
25             isa => InstanceOf ['STIX::Observable::Artifact', 'STIX::Observable::File', 'STIX::Common::Identifier']
26             );
27              
28             has content_type => (is => 'rw', isa => Str);
29             has content_disposition => (is => 'rw', isa => Str);
30              
31             1;
32              
33             =encoding utf-8
34              
35             =head1 NAME
36              
37             STIX::Observable::Type::EmailMIMEPart - STIX Cyber-observable Object (SCO) - Email MIME Component Type
38              
39             =head1 SYNOPSIS
40              
41             use STIX::Observable::Type::EmailMIMEPart;
42              
43             my $mime_part_type = STIX::Observable::Type::EmailMIMEPart->new();
44              
45              
46             =head1 DESCRIPTION
47              
48             Specifies a component of a multi-part email body.
49              
50             L
51              
52              
53             =head2 METHODS
54              
55             L inherits all methods from L
56             and implements the following new ones.
57              
58             =over
59              
60             =item STIX::Observable::Type::EmailMIMEPart->new(%properties)
61              
62             Create a new instance of L.
63              
64             =item $mime_part_type->body
65              
66             Specifies the contents of the MIME part if the content_type is not provided
67             OR starts with text/
68              
69             =item $mime_part_type->body_raw_ref
70              
71             Specifies the contents of non-textual MIME parts, that is those whose
72             content_type does not start with text/, as a reference to an L
73             Object or L Object.
74              
75             =item $mime_part_type->content_disposition
76              
77             Specifies the value of the 'Content-Disposition' header field of the MIME
78             part.
79              
80             =item $mime_part_type->content_type
81              
82             Specifies the value of the 'Content-Type' header field of the MIME part.
83              
84             =back
85              
86              
87             =head2 HELPERS
88              
89             =over
90              
91             =item $mime_part_type->TO_JSON
92              
93             Helper for JSON encoders.
94              
95             =item $mime_part_type->to_hash
96              
97             Return the object HASH.
98              
99             =item $mime_part_type->to_string
100              
101             Encode the object in JSON.
102              
103             =item $mime_part_type->validate
104              
105             Validate the object using JSON Schema (see L).
106              
107             =back
108              
109              
110             =head1 SUPPORT
111              
112             =head2 Bugs / Feature Requests
113              
114             Please report any bugs or feature requests through the issue tracker
115             at L.
116             You will be notified automatically of any progress on your issue.
117              
118             =head2 Source Code
119              
120             This is open source software. The code repository is available for
121             public review and contribution under the terms of the license.
122              
123             L
124              
125             git clone https://github.com/giterlizzi/perl-STIX.git
126              
127              
128             =head1 AUTHOR
129              
130             =over 4
131              
132             =item * Giuseppe Di Terlizzi
133              
134             =back
135              
136              
137             =head1 LICENSE AND COPYRIGHT
138              
139             This software is copyright (c) 2024 by Giuseppe Di Terlizzi.
140              
141             This is free software; you can redistribute it and/or modify it under
142             the same terms as the Perl 5 programming language system itself.
143              
144             =cut