line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package CanvasCloud::API::Account::SISImport; |
2
|
|
|
|
|
|
|
$CanvasCloud::API::Account::SISImport::VERSION = '0.007'; |
3
|
|
|
|
|
|
|
# ABSTRACT: extends L<CanvasCloud::API::Account> |
4
|
|
|
|
|
|
|
|
5
|
1
|
|
|
1
|
|
1192
|
use Moose; |
|
1
|
|
|
|
|
480113
|
|
|
1
|
|
|
|
|
7
|
|
6
|
1
|
|
|
1
|
|
8417
|
use namespace::autoclean; |
|
1
|
|
|
|
|
8649
|
|
|
1
|
|
|
|
|
5
|
|
7
|
1
|
|
|
1
|
|
595
|
use IO::String; |
|
1
|
|
|
|
|
4001
|
|
|
1
|
|
|
|
|
312
|
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
extends 'CanvasCloud::API::Account'; |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
augment 'uri' => sub { return '/sis_imports'; }; |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
sub sendzip { |
16
|
1
|
|
|
1
|
1
|
3
|
my $self = shift; |
17
|
1
|
|
50
|
|
|
6
|
my $file_or_hash = shift || die 'no data given!'; |
18
|
1
|
|
|
|
|
3
|
my $compressed; |
19
|
1
|
50
|
|
|
|
32
|
if ( -f $file_or_hash ) { |
|
|
0
|
|
|
|
|
|
20
|
1
|
50
|
|
|
|
50
|
open( my $ZF, '<', $file_or_hash ) or die sprintf( 'cannot open input file {%s} error {%s}', $file_or_hash, $! ); |
21
|
1
|
|
|
|
|
5
|
binmode $ZF; |
22
|
1
|
|
|
|
|
19
|
while (<$ZF>) { $compressed .= $_; } |
|
19
|
|
|
|
|
49
|
|
23
|
1
|
|
|
|
|
15
|
close $ZF; |
24
|
|
|
|
|
|
|
} |
25
|
|
|
|
|
|
|
elsif ( ref($file_or_hash) eq 'HASH' ) { |
26
|
0
|
|
|
|
|
0
|
my $sh = IO::String->new($compressed); |
27
|
0
|
|
|
|
|
0
|
$file_or_hash->{zip}->writeToFileHandle($sh); |
28
|
|
|
|
|
|
|
} |
29
|
|
|
|
|
|
|
else { |
30
|
0
|
|
|
|
|
0
|
die sprintf( 'file {%s}{%%%s} does not exist or is not Archive::Zip object', $file_or_hash, ref($file_or_hash) ); |
31
|
|
|
|
|
|
|
} |
32
|
1
|
|
|
|
|
9
|
my $r = $self->request( 'POST', $self->uri . '.json?import_type=instructure_csv&extension=zip' ); |
33
|
1
|
|
|
|
|
11
|
$r->content_type( 'application/zip' ); |
34
|
1
|
|
|
|
|
42
|
$r->content($compressed); |
35
|
1
|
|
|
|
|
36
|
return $self->send( $r ); |
36
|
|
|
|
|
|
|
} |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
sub status { |
40
|
1
|
|
|
1
|
0
|
4
|
my $self = shift; |
41
|
1
|
|
50
|
|
|
17
|
my $id = shift || die 'id must be given!'; |
42
|
1
|
|
|
|
|
7
|
return $self->send( $self->request( 'GET', $self->uri . '/' . $id . '.json' ) ); |
43
|
|
|
|
|
|
|
} |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
__PACKAGE__->meta->make_immutable; |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
1; |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
__END__ |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
=pod |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
=encoding UTF-8 |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
=head1 NAME |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
CanvasCloud::API::Account::SISImport - extends L<CanvasCloud::API::Account> |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
=head1 VERSION |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
version 0.007 |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
=head1 ATTRIBUTES |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
=head2 uri |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
augments base uri to append '/sis_imports'' |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
=head1 METHODS |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
=head2 sendzip |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
send zip data as POST ->uri |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
=head2 zipstatus |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
get sendzip status as GET ->uri/$id.json |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
=head1 AUTHOR |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
Ted Katseres |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
This software is copyright (c) 2019 by Ted Katseres. |
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
This is free software; you can redistribute it and/or modify it under |
88
|
|
|
|
|
|
|
the same terms as the Perl 5 programming language system itself. |
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
=cut |