MWS/Products.pm

filter: Statementstmt 51.1% 23 / 45 Branchbran 0.0% 0 / 14 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 28.5% 2 / 7 Podpod n/a totaltotal 37.8% 25 / 66 CC 8 SCAR 24.2
CC
8
Cov
39%
_convert_lowest_offers_listing
20.0
__ANON__
12.0
__ANON__
12.0
CRAP 11.3
« MWS/XML/Response/OrderReport/Item.pm ↑ Summary MWS/XML/ShippedOrder.pm »
1 package Amazon::MWS::Products;
2  
3 8 ▶use Amazon::MWS::Routines qw(:all);
Subroutine BEGIN: called CC=1 SCAR=0.0
4  
5 8 my $version = '2011-10-01';
6 8 my $products_service = "/Products/$version";
7  
8 define_api_method GetServiceStatus =>
9 raw_body => 0,
10 version => $version,
11 service => "$products_service",
12 parameters => {},
13 1 ▶ respond => sub {
Subroutine __ANON__: called CC=1 SCAR=0.0
14 1 my $root = shift;
15 1 return $root->{Status};
16 8 };
17  
18 define_api_method ListMatchingProducts =>
19 raw_body => 0,
20 service => "$products_service",
21 version => $version,
22 parameters => {
23 Query => {
24 type => 'string',
25 required => 1
26 },
27 MarketplaceId => { type => 'string', required=>1 },
28 },
29 0 ▶ respond => sub {
Subroutine __ANON__: not called CC=1 SCAR=6.9
30 0 my $root = shift;
31 # unclear if we can get an array here. TODO.
32 0 return $root->{Products}->{Product};
33 8 };
34  
35 8 define_api_method GetMatchingProduct =>
36 raw_body => 1,
37 service => "$products_service",
38 version => $version,
39 parameters => {
40 ASINList => {
41 type => 'ASINList',
42 required => 1
43 },
44 MarketplaceId => { type => 'string', required=>1 },
45 };
46  
47 define_api_method GetMatchingProductForId =>
48 raw_body => 0,
49 service => $products_service,
50 version => $version,
51 parameters => {
52 MarketplaceId => {
53 type => 'string',
54 required => 1
55 },
56 IdType => {
57 type => 'string',
58 required => 1
59 },
60 IdList => {
61 type => 'IdList',
62 required => 1,
63 }
64 },
65 0 ▶ respond => sub {
Subroutine __ANON__: not called CC=3 SCAR=24.8
66 0 my $root = shift;
67 0 ▶ return unless $root; # failed totally
Branch: 1 branch
BranchTrueFalseTotal
unless $root 0 0 0
68 0 ▶ if (ref($root) ne 'ARRAY') {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $root ne 'ARRAY') { } 0 0 0
69 0 return [ $root ];
70 }
71 else {
72 0 return $root;
73 }
74 8 };
75  
76 define_api_method GetMyFeesEstimate =>
77 raw_body => 0,
78 service => $products_service,
79 version => $version,
80 parameters => {
81 'FeesEstimateRequestList' => {
82 required => 1,
83 array_names => ['MarketplaceId','IdType','IdValue','IsAmazonFulfilled','Identifier',
84 'PriceToEstimateFees.ListingPrice.Amount', 'PriceToEstimateFees.ListingPrice.CurrencyCode',
85 'PriceToEstimateFees.Shipping.Amount', 'PriceToEstimateFees.Shipping.CurrencyCode',
86 'PriceToEstimateFees.Points.PointsNumber'],
87 type => 'FeesEstimateRequestArray',
88  
89 },
90 },
91 0 ▶ respond => sub {
Subroutine __ANON__: not called CC=3 SCAR=24.8
92 0 my $root = shift;
93 0 ▶ return unless $root; # failed totally
Branch: 1 branch
BranchTrueFalseTotal
unless $root 0 0 0
94 0 ▶ if (ref($root) ne 'ARRAY') {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $root ne 'ARRAY') { } 0 0 0
95 0 return [ $root ];
96 }
97 else {
98 0 return $root;
99 }
100 8 };
101  
102 8 define_api_method GetLowestOfferListingsForSKU =>
103 raw_body => 0,
104 service => "$products_service",
105 version => $version,
106 parameters => {
107 SellerSKUList => {
108 type => 'SellerSKUList',
109 required => 1
110 },
111 MarketplaceId => { type => 'string', required=>1 },
112 ItemCondition => { type => 'List', values=>['Any', 'New', 'Used', 'Collectible', 'Refurbished', 'Club'],
113 required => 0 },
114 ExcludeMe => { type => 'boolean' },
115 },
116 respond => \&_convert_lowest_offers_listing;
117  
118 8 define_api_method GetLowestOfferListingsForASIN =>
119 raw_body => 0,
120 service => "$products_service",
121 version => $version,
122 parameters => {
123 ASINList => {
124 type => 'ASINList',
125 required => 1
126 },
127 MarketplaceId => { type => 'string', required=>1 },
128 ItemCondition => { type => 'List', values=>['Any', 'New', 'Used', 'Collectible', 'Refurbished', 'Club'],
129 required => 0 },
130 ExcludeMe => { type => 'boolean' },
131 },
132 respond => \&_convert_lowest_offers_listing;
133  
134  
135 8 define_api_method GetCompetitivePricingForSKU =>
136 raw_body => 1,
137 service => "$products_service",
138 version => $version,
139 parameters => {
140 SellerSKUList => {
141 type => 'SellerSKUList',
142 required => 1
143 },
144 MarketplaceId => { type => 'string', required=>1 },
145 };
146  
147 8 define_api_method GetCompetitivePricingForASIN =>
148 raw_body => 1,
149 service => "$products_service",
150 version => $version,
151 parameters => {
152 ASINList => {
153 type => 'ASINList',
154 required => 1
155 },
156 MarketplaceId => { type => 'string', required=>1 },
157 };
158  
159 8 define_api_method GetLowestPricedOffersForSKU =>
160 raw_body => 1,
161 service => "$products_service",
162 version => $version,
163 parameters => {
164 SellerSKU => {
165 type => 'string',
166 required => 1
167 },
168 MarketplaceId => { type => 'string', required=>1 },
169 ItemCondition => { type => 'List', values=>['Any', 'New', 'Used', 'Collectible', 'Refurbished', 'Club'],
170 required => 1 },
171 };
172  
173 8 define_api_method GetLowestPricedOffersForASIN =>
174 raw_body => 1,
175 service => "$products_service",
176 version => $version,
177 parameters => {
178 ASIN => {
179 type => 'string',
180 required => 1
181 },
182 MarketplaceId => { type => 'string', required=>1 },
183 ItemCondition => { type => 'List', values=>['Any', 'New', 'Used', 'Collectible', 'Refurbished', 'Club'],
184 required => 1 },
185 };
186  
187 8 define_api_method GetMyPriceForSKU =>
188 raw_body => 1,
189 service => "$products_service",
190 version => $version,
191 parameters => {
192 SellerSKUList => {
193 type => 'SellerSKUList',
194 required => 1
195 },
196 MarketplaceId => { type => 'string', required=>1 },
197 ItemCondition => { type => 'List', values=>['Any', 'New', 'Used', 'Collectible', 'Refurbished', 'Club'],
198 required => 0 },
199 };
200  
201 8 define_api_method GetMyPriceForASIN =>
202 raw_body => 1,
203 service => "$products_service",
204 version => $version,
205 parameters => {
206 ASINList => {
207 type => 'ASINList',
208 required => 1
209 },
210 MarketplaceId => { type => 'string', required=>1 },
211 ItemCondition => { type => 'List', values=>['Any', 'New', 'Used', 'Collectible', 'Refurbished', 'Club'],
212 required => 0 },
213 };
214  
215 8 define_api_method GetProductCategoriesForSKU =>
216 raw_body => 1,
217 service => "$products_service",
218 version => $version,
219 parameters => {
220 SellerSKU => {
221 type => 'string',
222 required => 1
223 },
224 MarketplaceId => { type => 'string', required=>1 },
225 };
226  
227 define_api_method GetProductCategoriesForASIN =>
228 raw_body => 0,
229 service => "$products_service",
230 version => $version,
231 parameters => {
232 ASIN => {
233 type => 'string',
234 required => 1
235 },
236 MarketplaceId => { type => 'string', required=>1 },
237 },
238 0 ▶ respond => sub {
Subroutine __ANON__: not called CC=1 SCAR=6.9
239 0 my $root = shift;
240 0 force_array($root, 'Self');
241 0 return $root->{Self};
242 8 };
243  
244 0 ▶sub _convert_lowest_offers_listing {
Subroutine _convert_lowest_offers_listing: not called CC=4 SCAR=30.0
245 0 my $root = shift;
246 0 ▶ return [] unless $root;
Branch: 1 branch
BranchTrueFalseTotal
unless $root 0 0 0
247 # here basically we cut out the info we sent and get only the listings.
248 0 ▶ if (my $listing = $root->{Product}->{LowestOfferListings}->{LowestOfferListing}) {
Branch: 1 branch
BranchTrueFalseTotal
if (my $listing = $root->{'Product'}{'LowestOfferListings'}{'LowestOfferListing'}) { } 0 0 0
249 0 ▶ if (ref($listing) ne 'ARRAY') {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $listing ne 'ARRAY') { } 0 0 0
250 0 return [ $listing ];
251 }
252 else {
253 0 return $listing;
254 }
255 }
256 else {
257 0 return [];
258 }
259 }
260  
261  
262 8 1;
263  
« MWS/XML/Response/OrderReport/Item.pm ↑ Summary MWS/XML/ShippedOrder.pm »