Amazon/Result/Seller/Listing.pm

filter: Statementstmt 96.7% 30 / 31 Branchbran 50.0% 1 / 2 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 7 / 7 Podpod 0.0% 0 / 2 totaltotal 90.4% 38 / 42 CC 3 SCAR 5.2
CC
3
Cov
94%
new
3.0
BEGIN
1.0
BEGIN
1.0
CRAP 1.7
« Amazon/Validate/Type/ItemLookup.pm ↑ Summary Amazon/Property/CE.pm »
1 ######################################################################
2 package Net::Amazon::Result::Seller::Listing;
3 ######################################################################
4 2 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 2 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 2 ▶use base qw(Net::Amazon);
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 2 ▶use Data::Dumper;
Subroutine BEGIN: called CC=1 SCAR=0.0
9 2 ▶use Log::Log4perl qw(:easy);
Subroutine BEGIN: called CC=1 SCAR=0.0
10  
11 # Tracking the different functions between AWS3 and AWS4.
12 # ExchangeConditionType -> ExchangeCondition
13 # ExchangeSellerRating -> ???
14 # ExchangeQuantityAllocated -> ExchangeQuantity
15 # ExchangeSellerCountry -> ???
16 # ExchangeSellerState -> ???
17 # ExchangeFeaturedCategory -> ???
18 # ExchangeAvailability -> ???
19 # ExchangeOfferingType -> ???
20 # ??? -> ExchangeSubCondition
21 # ExchangeDescription -> ???
22  
23  
24 2 our %DEFAULT_ATTRIBUTES_XPATH = (
25 ExchangeStartDate => [qw(StartDate)],
26 ExchangeEndDate => [qw(EndDate)],
27 ExchangeAsin => [qw(ASIN)],
28 ExchangeTitle => [qw(Title)],
29 ListingId => [qw(ListingId)],
30 ExchangeId => [qw(ExchangeId)],
31 ExchangeQuantityAllocated => [qw(Quantity)],
32 ExchangeQuantity => [qw(Quantity)],
33 ExchangeCondition => [qw(Condition)],
34 ExchangeConditionType=> [qw(SubCondition)],
35 ExchangeSubCondition => [qw(SubCondition)],
36 ExchangeStatus => [qw(Status)],
37 ExchangePrice => [qw(Price FormattedPrice)],
38 ExchangeCurrencyCode => [qw(Price CurrencyCode)],
39 ExchangeAmount => [qw(Price Amount)],
40 ExchangeSellerId => [qw(Seller SellerId)],
41 ExchangeSellerNickname => [qw(Seller Nickname)],
42 );
43  
44 2 __PACKAGE__->make_accessor($_) for keys %DEFAULT_ATTRIBUTES_XPATH;
45  
46 ##################################################
47 63 ▶sub new {
Subroutine new: called CC=3 SCAR=11.1
Pod undocumented
48 ##################################################
49 63 my($class, %options) = @_;
50  
51 63 ▶ if(!$options{xmlref}) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($options{"xmlref"}) 0 63 63
52 0 die "Mandatory param xmlref missing";
53 }
54  
55 63 my $self = {
56 %options,
57 };
58  
59 63 bless $self, $class;
60  
61 63 DEBUG "Calling Listing with xmlref=", Dumper($options{xmlref});
62  
63 63 for my $attr (keys %DEFAULT_ATTRIBUTES_XPATH) {
64 1071 my $value = __PACKAGE__->walk_hash_ref($options{xmlref}, $DEFAULT_ATTRIBUTES_XPATH{$attr});
65 1071 $self->$attr($value);
66 }
67  
68 63 return $self;
69 }
70  
71 ##################################################
72 1 ▶sub as_string {
Subroutine as_string: called CC=1 SCAR=0.0
Pod undocumented
73 ##################################################
74 1 my($self) = @_;
75  
76 1 my $result =
77 $self->ExchangeTitle() .
78 " (" .
79 $self->ExchangeAsin() .
80 "): " .
81 $self->ExchangePrice() .
82 "";
83  
84 1 return $result;
85 }
86  
87 2 1;
88  
89 __END__
« Amazon/Validate/Type/ItemLookup.pm ↑ Summary Amazon/Property/CE.pm »