File Coverage

blib/lib/WebService/ProfitBricks/Base.pm
Criterion Covered Total %
statement 9 20 45.0
branch 0 2 0.0
condition n/a
subroutine 3 7 42.8
pod 4 4 100.0
total 16 33 48.4


line stmt bran cond sub pod time code
1             #
2             # (c) Jan Gehring
3             #
4             # vim: set ts=3 sw=3 tw=0:
5             # vim: set expandtab:
6              
7             =head1 NAME
8              
9             WebService::ProfitBricks::Base - Base Class
10              
11             =head1 DESCRIPTION
12              
13             This is the base class of all ProfitBricks classes.
14              
15             =head1 SYNOPSIS
16              
17             package WebService::ProfitBricks::Image;
18             use WebService::ProfitBricks::Class;
19             use base qw(WebService::ProfitBricks::Class);
20              
21             =head1 METHODS
22              
23             =over 4
24              
25             =cut
26            
27             package WebService::ProfitBricks::Base;
28              
29 1     1   5 use strict;
  1         2  
  1         33  
30 1     1   6 use warnings;
  1         1  
  1         31  
31              
32             my $connection;
33              
34 1     1   6 use WebService::ProfitBricks::Class;
  1         1  
  1         233  
35              
36             =item connection([$con])
37              
38             Sets or gets the current connection object. You can create your own connection objects as long it has an I method. See L for more information.
39              
40             =cut
41             sub connection {
42 0     0 1   my ($self, $con) = @_;
43 0 0         if($con) {
44 0           $connection = $con;
45             }
46              
47 0           return $connection;
48             }
49              
50             =item get_data
51              
52             Returns the objects data as an hashRef.
53              
54             =cut
55              
56             sub get_data {
57 0     0 1   my ($self) = @_;
58 0           return $self->{__data__};
59             }
60              
61              
62             =item set_data($data = {});
63              
64             Sets the objects data.
65              
66             =cut
67             sub set_data {
68 0     0 1   my ($self, $data) = @_;
69 0           for my $key (keys %{ $data }) {
  0            
70 0           $self->{__data__}->{$key} = $data->{$key};
71             }
72             }
73              
74             =item get_relations
75              
76             If you're object will have relations to other objects you have to override this method.
77              
78             =cut
79 0     0 1   sub get_relations { return(); }
80              
81             =back
82              
83             =cut
84              
85             "No one is save";