File Coverage

lib/Net/API/Stripe/Order/SKU.pm
Criterion Covered Total %
statement 19 33 57.5
branch n/a
condition n/a
subroutine 7 21 33.3
pod 14 14 100.0
total 40 68 58.8


line stmt bran cond sub pod time code
1             ##----------------------------------------------------------------------------
2             ## Stripe API - ~/lib/Net/API/Stripe/Order/SKU.pm
3             ## Version v0.100.0
4             ## Copyright(c) 2019 DEGUEST Pte. Ltd.
5             ## Author: Jacques Deguest <jack@deguest.jp>
6             ## Created 2019/11/02
7             ## Modified 2020/05/15
8             ##
9             ##----------------------------------------------------------------------------
10             ## https://stripe.com/docs/api/skus/object
11             BEGIN
12             {
13             use strict;
14 1     1   1009 use warnings;
  1         2  
  1         32  
15 1     1   4 use parent qw( Net::API::Stripe::Generic );
  1         2  
  1         31  
16 1     1   4 use vars qw( $VERSION );
  1         2  
  1         8  
17 1     1   72 our( $VERSION ) = 'v0.100.0';
  1         2  
  1         46  
18 1     1   36 };
19              
20             use strict;
21 1     1   7 use warnings;
  1         2  
  1         23  
22 1     1   4  
  1         3  
  1         388  
23              
24 0     0 1    
25              
26 0     0 1    
27              
28 0     0 1    
29              
30 0     0 1    
31              
32 0     0 1    
33              
34 0     0 1    
35              
36 0     0 1    
37             1;
38 0     0 1    
39              
40 0     0 1   =encoding utf8
41              
42 0     0 1   =head1 NAME
43              
44 0     0 1   Net::API::Stripe::Order::SKU - A Stripe SKU Object
45              
46 0     0 1   =head1 SYNOPSIS
47              
48 0     0 1   my $sku = $stripe->sku({
49             active => $stripe->true,
50 0     0 1   attributes =>
51             {
52             size => 'Medium',
53             gender => 'Unisex',
54             },
55             currency => 'jpy',
56             image => 'https://example.com/path/product.jpg',
57             inventory => $inventory_object,
58             metadata => { transaction_id => 123 },
59             package_dimensions =>
60             {
61             # In inches
62             height => 6,
63             length => 20,
64             # Ounce
65             weight => 21
66             width => 12
67             },
68             price => 2000,
69             product => $product_object,
70             });
71              
72             See documentation in L<Net::API::Stripe> for example to make api calls to Stripe to create those objects.
73              
74             =head1 VERSION
75              
76             v0.100.0
77              
78             =head1 DESCRIPTION
79              
80             Stores representations of stock keeping units (L<http://en.wikipedia.org/wiki/Stock_keeping_unit>). SKUs describe specific product variations, taking into account any combination of: attributes, currency, and cost. For example, a product may be a T-shirt, whereas a specific SKU represents the size: large, color: red version of that shirt.
81              
82             Can also be used to manage inventory.
83              
84             =head1 CONSTRUCTOR
85              
86             =head2 new( %ARG )
87              
88             Creates a new L<Net::API::Stripe::Order::SKU> object.
89             It may also take an hash like arguments, that also are method of the same name.
90              
91             =head1 METHODS
92              
93             =head2 id string
94              
95             Unique identifier for the object.
96              
97             =head2 object string, value is "sku"
98              
99             String representing the object’s type. Objects of the same type share the same value.
100              
101             =head2 active boolean
102              
103             Whether the SKU is available for purchase.
104              
105             =head2 attributes hash
106              
107             A dictionary of attributes and values for the attributes defined by the product. If, for example, a product’s attributes are ["size", "gender"], a valid SKU has the following dictionary of attributes: {"size": "Medium", "gender": "Unisex"}.
108              
109             =head2 created timestamp
110              
111             Time at which the object was created. Measured in seconds since the Unix epoch.
112              
113             =head2 currency currency
114              
115             Three-letter ISO currency code, in lowercase. Must be a supported currency.
116              
117             =head2 image string
118              
119             The URL of an image for this SKU, meant to be displayable to the customer.
120              
121             This is a L<URI> object.
122              
123             =head2 inventory hash
124              
125             Description of the SKU’s inventory.
126              
127             This is a L<Net::API::Stripe::Order::SKU::Inventory> object.
128              
129             =head2 livemode boolean
130              
131             Has the value true if the object exists in live mode or the value false if the object exists in test mode.
132              
133             =head2 metadata hash
134              
135             Set of key-value pairs that you can attach to an object. This can be useful for storing additional information about the object in a structured format.
136              
137             =head2 package_dimensions hash
138              
139             The dimensions of this SKU for shipping purposes.
140              
141             This is a L<Net::API::Stripe::Order::SKU::PackageDimensions> object.
142              
143             =head2 price positive integer or zero
144              
145             The cost of the item as a positive integer in the smallest currency unit (that is, 100 cents to charge $1.00, or 100 to charge ¥100, Japanese Yen being a zero-decimal currency).
146              
147             =head2 product string (expandable)
148              
149             The ID of the product this SKU is associated with. The product must be currently active.
150              
151             When expanded, this is a L<Net::API::Stripe::Product> object.
152              
153             =head2 updated timestamp
154              
155             Time at which the object was last updated. Measured in seconds since the Unix epoch.
156              
157             =head1 API SAMPLE
158              
159             {
160             "id": "sku_fake123456789",
161             "object": "sku",
162             "active": true,
163             "attributes": {
164             "size": "Medium",
165             "gender": "Unisex"
166             },
167             "created": 1571480453,
168             "currency": "jpy",
169             "image": null,
170             "inventory": {
171             "quantity": 50,
172             "type": "finite",
173             "value": null
174             },
175             "livemode": false,
176             "metadata": {},
177             "package_dimensions": null,
178             "price": 1500,
179             "product": "prod_fake123456789",
180             "updated": 1571480453
181             }
182              
183             =head1 HISTORY
184              
185             =head2 v0.1
186              
187             Initial version
188              
189             =head1 AUTHOR
190              
191             Jacques Deguest E<lt>F<jack@deguest.jp>E<gt>
192              
193             =head1 SEE ALSO
194              
195             Stripe API documentation:
196              
197             L<https://stripe.com/docs/api/skus>, L<https://stripe.com/docs/orders>
198              
199             =head1 COPYRIGHT & LICENSE
200              
201             Copyright (c) 2019-2020 DEGUEST Pte. Ltd.
202              
203             You can use, copy, modify and redistribute this package and associated
204             files under the same terms as Perl itself.
205              
206             =cut