blib/lib/OxdPackages/OxdRemove.pm untested

filter: Statementstmt 0.0% 0 / 45 Branchbran 0.0% 0 / 4 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 15 Podpod 0.0% 0 / 10 totaltotal 0.0% 0 / 74 CC 3 SCAR 10.8
CC
3
Cov
0%
setRequestOxdId
6.0
setRequestProtectionAccessToken
6.0
new
2.0
CRAP 2.9
1 #!/usr/bin/perl
2 # OxdRemove.pm, a number as an object
3
4 #
5 # Gluu-oxd-library
6 #
7 # An open source application library for Perl
8 #
9 # This content is released under the MIT License (MIT)
10 #
11 # Copyright (c) 2018, Gluu inc, USA, Austin
12 #
13 # Permission is hereby granted, free of charge, to any person obtaining a copy
14 # of this software and associated documentation files (the "Software"), to deal
15 # in the Software without restriction, including without limitation the rights
16 # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
17 # copies of the Software, and to permit persons to whom the Software is
18 # furnished to do so, subject to the following conditions:
19 #
20 # The above copyright notice and this permission notice shall be included in
21 # all copies or substantial portions of the Software.
22 #
23 # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
24 # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
25 # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
26 # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
27 # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
28 # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
29 # THE SOFTWARE.
30 #
31 # @package Gluu-oxd-library
32 # @version 3.1.2
33 # @author Sobhan Panda
34 # @author_email sobhan@centroxy.com
35 # @copyright Copyright (c) 2018, Gluu inc federation (https://gluu.org/)
36 # @license http://opensource.org/licenses/MIT MIT License
37 # @link https://gluu.org/
38 # @since Version 3.1.2
39 # @filesource
40 #/
41
42 use JSON::PP;
43
44 package OxdRemove; # This is the "Class"
45 use vars qw($VERSION);
46 $VERSION = '0.01';
47
48 use OxdPackages::OxdClient;
49 use base qw(OxdClient Class::Accessor);
50 #use base 'OxdClient';
51 use strict;
52 our @ISA = qw(OxdClient); # inherits from OxdClient
53
54 sub new {
55 my $class = shift;
56
57 my $self = {
58
59 # @var string _request_oxd_id OxdId from Client registration
60 _request_oxd_id => shift,
61
62 # @var array $request_protection_access_token To protect the command with access token
63 _request_protection_access_token => shift,
64
65 # Response parameter from oxd-server
66 # It is basic parameter for other protocols
67 #
68 # @var string _response_oxd_id
69 _response_oxd_id => shift,
70
71 };
72
73 bless $self, $class;
74 return $self;
75 }
76
77 sub _initialize {}
78
79
80 # @param string $request_op_host
81 # @return void
82 sub setRequestOxdId {
83 my ( $self, $request_op_host ) = @_;
84 $self->{_request_oxd_id} = $request_op_host if defined($request_op_host);
85 return $self->{_request_oxd_id};
86 }
87
88 # @return string
89 sub getRequestOxdId {
90 my( $self ) = @_;
91 return $self->{_request_oxd_id};
92 }
93
94
95 # @return string
96 sub getResponseOxdId{
97 my( $self ) = @_;
98 $self->{_response_oxd_id} = $self->getResponseData()->{oxd_id};
99 return $self->{_response_oxd_id};
100 }
101
102
103 # @return array
104 sub getRequestProtectionAccessToken
105 {
106 my( $self ) = @_;
107 return $self->{_request_protection_access_token};
108 }
109
110
111 # @param array $request_request_protection_access_token
112 # @return void
113 sub setRequestProtectionAccessToken
114 {
115 my ( $self, $request_protection_access_token ) = @_;
116 $self->{_request_protection_access_token} = $request_protection_access_token if defined($request_protection_access_token);
117 return $self->{_request_protection_access_token};
118 }
119
120 # Protocol command to oxd server
121 # @return void
122 sub setCommand{
123 # my $command = 'remove_site';
124 my ( $self, $command ) = @_;
125 $self->{_command} = 'remove_site';
126 return $self->{_command};
127 #return $command;
128 }
129
130 # Protocol command to oxd to http server
131 # @return void
132 sub sethttpCommand{
133 # my $command = 'remove-site';
134 my ( $self, $httpCommand ) = @_;
135 $self->{_httpcommand} = 'remove-site';
136 return $self->{_httpcommand};
137 #return $httpcommand;
138 }
139
140 # Method: setParams
141 # This method sets the parameters for remove_site command.
142 # This module uses `request` method of OxdClient module for sending request to oxd-server
143 #
144 # Parameters:
145 #
146 # string $oxd_id - (Required) oxd Id from Client registration
147 #
148 # string $protection_access_token - Protection Acccess Token. OPTIONAL for `oxd-server` but REQUIRED for `oxd-https-extension`
149 #
150 # Returns:
151 # void
152 #
153 # This module uses `getResponseObject` method of OxdClient module for getting response from oxd.
154 #
155 # *Example response from getResponseObject:*
156 # --- Code
157 # { "status":"ok", "data":{ "oxd_id":"c73134c8-c4ca-4bab-9baa-2e0ca20cc433" } }
158 # ---
159 #
160 sub setParams{
161
162 my ( $self, $params ) = @_;
163 #use Data::Dumper;
164 my $paramsArray = {
165 "oxd_id" => $self->getRequestOxdId(),
166 "protection_access_token"=> $self->getRequestProtectionAccessToken()
167 };
168
169 $self->{_params} = $paramsArray;
170 return $self->{_params};
171 #print Dumper( $params );
172 #return $paramsArray;
173 }
174
175 1; # this 1; is neccessary for our class to work