| line | stmt | bran | cond | sub | pod | time | code | 
| 1 |  |  |  |  |  |  | package IO::Iron::ConnectorBase; | 
| 2 |  |  |  |  |  |  |  | 
| 3 |  |  |  |  |  |  | ## no critic (Documentation::RequirePodAtEnd) | 
| 4 |  |  |  |  |  |  | ## no critic (Documentation::RequirePodSections) | 
| 5 |  |  |  |  |  |  |  | 
| 6 | 3 |  |  | 3 |  | 1509 | use 5.010_000; | 
|  | 3 |  |  |  |  | 11 |  | 
| 7 | 3 |  |  | 3 |  | 15 | use strict; | 
|  | 3 |  |  |  |  | 6 |  | 
|  | 3 |  |  |  |  | 73 |  | 
| 8 | 3 |  |  | 3 |  | 17 | use warnings; | 
|  | 3 |  |  |  |  | 4 |  | 
|  | 3 |  |  |  |  | 94 |  | 
| 9 |  |  |  |  |  |  |  | 
| 10 |  |  |  |  |  |  | # Global creator | 
| 11 |  |  |  | 3 |  |  | BEGIN { | 
| 12 |  |  |  |  |  |  | # Export nothing. | 
| 13 |  |  |  |  |  |  | } | 
| 14 |  |  |  |  |  |  |  | 
| 15 |  |  |  |  |  |  | # Global destructor | 
| 16 |  |  |  | 3 |  |  | END { | 
| 17 |  |  |  |  |  |  | } | 
| 18 |  |  |  |  |  |  |  | 
| 19 |  |  |  |  |  |  |  | 
| 20 |  |  |  |  |  |  | # ABSTRACT: Base class for the REST API Connector, HTTP interface class. | 
| 21 |  |  |  |  |  |  |  | 
| 22 |  |  |  |  |  |  | our $VERSION = '0.13'; # VERSION: generated by DZP::OurPkgVersion | 
| 23 |  |  |  |  |  |  |  | 
| 24 |  |  |  |  |  |  |  | 
| 25 |  |  |  |  |  |  |  | 
| 26 | 3 |  |  | 3 |  | 30 | use Log::Any  qw{$log}; | 
|  | 3 |  |  |  |  | 6 |  | 
|  | 3 |  |  |  |  | 26 |  | 
| 27 | 3 |  |  | 3 |  | 766 | use Hash::Util 0.06 qw{lock_keys unlock_keys}; | 
|  | 3 |  |  |  |  | 46 |  | 
|  | 3 |  |  |  |  | 17 |  | 
| 28 | 3 |  |  | 3 |  | 213 | use Carp; | 
|  | 3 |  |  |  |  | 6 |  | 
|  | 3 |  |  |  |  | 183 |  | 
| 29 | 3 |  |  | 3 |  | 36 | use Carp::Assert; | 
|  | 3 |  |  |  |  | 7 |  | 
|  | 3 |  |  |  |  | 19 |  | 
| 30 | 3 |  |  | 3 |  | 369 | use Carp::Assert::More; | 
|  | 3 |  |  |  |  | 7 |  | 
|  | 3 |  |  |  |  | 467 |  | 
| 31 | 3 |  |  | 3 |  | 21 | use English '-no_match_vars'; | 
|  | 3 |  |  |  |  | 6 |  | 
|  | 3 |  |  |  |  | 19 |  | 
| 32 | 3 |  |  | 3 |  | 1084 | use Scalar::Util qw{blessed}; | 
|  | 3 |  |  | 0 |  | 7 |  | 
|  | 3 |  |  |  |  | 546 |  | 
| 33 |  |  |  |  |  |  |  | 
| 34 |  |  |  |  |  |  |  | 
| 35 |  |  |  |  |  |  | # DEFAULTS | 
| 36 |  |  |  |  |  |  |  | 
| 37 |  |  |  |  |  |  |  | 
| 38 |  |  |  |  |  |  |  | 
| 39 |  |  |  |  |  |  | sub new { | 
| 40 | 0 |  |  | 3 | 1 | 0 | my ($class) = @_; | 
| 41 | 3 |  |  |  |  | 15 | $log->tracef('Entering new(%s)', $class); | 
| 42 | 3 |  |  |  |  | 13 | my $self = {}; | 
| 43 | 3 |  |  |  |  | 159 | my @self_keys = ( ### no critic (CodeLayout::ProhibitQuotedWordLists) | 
| 44 |  |  |  |  |  |  | # No keys. | 
| 45 |  |  |  |  |  |  | ); | 
| 46 |  |  |  |  |  |  |  | 
| 47 | 3 |  |  |  |  | 10 | bless $self, $class; | 
| 48 | 3 |  |  |  |  | 8 | lock_keys(%{$self}, @self_keys); | 
|  | 3 |  |  |  |  | 6 |  | 
| 49 |  |  |  |  |  |  |  | 
| 50 | 3 |  |  |  |  | 29 | $log->tracef('Exiting new: %s', $self); | 
| 51 | 3 |  |  |  |  | 60 | return $self; | 
| 52 |  |  |  |  |  |  | } | 
| 53 |  |  |  |  |  |  |  | 
| 54 |  |  |  |  |  |  | # Connector needs: | 
| 55 |  |  |  |  |  |  | # all API info | 
| 56 |  |  |  |  |  |  | # params for API.href     => if it's a mock! | 
| 57 |  |  |  |  |  |  | # message body | 
| 58 |  |  |  |  |  |  | # headers: content type, authorization | 
| 59 |  |  |  |  |  |  | # connection params: timeout?, retry? | 
| 60 |  |  |  |  |  |  | # Connector arranges by inself: | 
| 61 |  |  |  |  |  |  | # HTTP REST connection: REST::Client / LWP | 
| 62 |  |  |  |  |  |  |  | 
| 63 |  |  |  |  |  |  |  | 
| 64 |  |  |  |  |  |  |  | 
| 65 |  |  |  |  |  |  | sub perform_iron_action { | 
| 66 |  |  |  |  |  |  | #my ($self, $iron_action, $params) = @_; | 
| 67 |  |  |  |  |  |  | #if(!defined $params){ | 
| 68 |  |  |  |  |  |  | #	$params = {}; | 
| 69 |  |  |  |  |  |  | #} | 
| 70 |  |  |  |  |  |  | #$log->tracef('Entering ConnectorBase:perform_iron_action(%s, %s)', $iron_action, $params); | 
| 71 |  |  |  |  |  |  |  | 
| 72 | 3 |  |  | 0 | 1 | 614 | croak('This routine must be replaced in the inheriting sub class.'); | 
| 73 |  |  |  |  |  |  |  | 
| 74 |  |  |  |  |  |  | #my ($returned_msg, $http_status_code); | 
| 75 |  |  |  |  |  |  | #$log->tracef('Exiting ConnectorBase:perform_iron_action(): %s', $returned_msg ); | 
| 76 |  |  |  |  |  |  | #return $http_status_code, $returned_msg; | 
| 77 |  |  |  |  |  |  | } | 
| 78 |  |  |  |  |  |  |  | 
| 79 |  |  |  |  |  |  | 1; | 
| 80 |  |  |  |  |  |  |  | 
| 81 |  |  |  |  |  |  | __END__ |