| 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 <@sitael.tokyo.deguest.jp> | ||
| 6 | ## Created 2019/11/02 | ||
| 7 | ## Modified 2020/05/15 | ||
| 8 | ## | ||
| 9 | ##---------------------------------------------------------------------------- | ||
| 10 | ## https://stripe.com/docs/api/skus/object | ||
| 11 | package Net::API::Stripe::Order::SKU; | ||
| 12 | BEGIN | ||
| 13 | { | ||
| 14 | 1 | ▶ | use strict; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 15 | 1 | ▶ | use parent qw( Net::API::Stripe::Generic ); |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 16 | 1 | ▶ | our( $VERSION ) = 'v0.100.0'; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 17 | }; | ||
| 18 | |||
| 19 | 0 | ▶ | sub id { shift->_set_get_scalar( 'id', @_ ); } |
|
Subroutine
id: not called CC=1 SCAR=6.9
Pod
documented
| |||
| 20 | |||
| 21 | 0 | ▶ | sub object { shift->_set_get_scalar( 'object', @_ ); } |
|
Subroutine
object: not called CC=1 SCAR=6.9
Pod
documented
| |||
| 22 | |||
| 23 | 0 | ▶ | sub active { shift->_set_get_boolean( 'active', @_ ); } |
|
Subroutine
active: not called CC=1 SCAR=6.9
Pod
documented
| |||
| 24 | |||
| 25 | 0 | ▶ | sub attributes { shift->_set_get_hash( 'attributes', @_ ); } |
|
Subroutine
attributes: not called CC=1 SCAR=6.9
Pod
documented
| |||
| 26 | |||
| 27 | 0 | ▶ | sub created { shift->_set_get_datetime( 'created', @_ ); } |
|
Subroutine
created: not called CC=1 SCAR=6.9
Pod
documented
| |||
| 28 | |||
| 29 | 0 | ▶ | sub currency { shift->_set_get_scalar( 'currency', @_ ); } |
|
Subroutine
currency: not called CC=1 SCAR=6.9
Pod
documented
| |||
| 30 | |||
| 31 | 0 | ▶ | sub image { shift->_set_get_uri( 'image', @_ ); } |
|
Subroutine
image: not called CC=1 SCAR=6.9
Pod
documented
| |||
| 32 | |||
| 33 | 0 | ▶ | sub inventory { shift->_set_get_object( 'inventory', 'Net::API::Stripe::Order::SKU::Inventory', @_ ); } |
|
Subroutine
inventory: not called CC=1 SCAR=6.9
Pod
documented
| |||
| 34 | |||
| 35 | 0 | ▶ | sub livemode { shift->_set_get_boolean( 'livemode', @_ ); } |
|
Subroutine
livemode: not called CC=1 SCAR=6.9
Pod
documented
| |||
| 36 | |||
| 37 | 0 | ▶ | sub metadata { shift->_set_get_hash( 'metadata', @_ ); } |
|
Subroutine
metadata: not called CC=1 SCAR=6.9
Pod
documented
| |||
| 38 | |||
| 39 | 0 | ▶ | sub package_dimensions { shift->_set_get_object( 'package_dimensions', 'Net::API::Stripe::Order::SKU::PackageDimensions', @_ ); } |
|
Subroutine
package_dimensions: not called CC=1 SCAR=6.9
Pod
documented
| |||
| 40 | |||
| 41 | 0 | ▶ | sub price { shift->_set_get_number( 'price', @_ ); } |
|
Subroutine
price: not called CC=1 SCAR=6.9
Pod
documented
| |||
| 42 | |||
| 43 | 0 | ▶ | sub product { shift->_set_get_scalar_or_object( 'product', 'Net::API::Stripe::Product', @_ ); } |
|
Subroutine
product: not called CC=1 SCAR=6.9
Pod
documented
| |||
| 44 | |||
| 45 | 0 | ▶ | sub updated { shift->_set_get_datetime( 'updated', @_ ); } |
|
Subroutine
updated: not called CC=1 SCAR=6.9
Pod
documented
| |||
| 46 | |||
| 47 | 1 | 1; | |
| 48 | |||
| 49 | __END__ | ||
| 50 | |||
| 51 | =encoding utf8 | ||
| 52 | |||
| 53 | =head1 NAME | ||
| 54 | |||
| 55 | Net::API::Stripe::Order::SKU - A Stripe SKU Object | ||
| 56 | |||
| 57 | =head1 SYNOPSIS | ||
| 58 | |||
| 59 | my $sku = $stripe->sku({ | ||
| 60 | active => $stripe->true, | ||
| 61 | attributes => | ||
| 62 | { | ||
| 63 | size => 'Medium', | ||
| 64 | gender => 'Unisex', | ||
| 65 | }, | ||
| 66 | currency => 'jpy', | ||
| 67 | image => 'https://example.com/path/product.jpg', | ||
| 68 | inventory => $inventory_object, | ||
| 69 | metadata => { transaction_id => 123 }, | ||
| 70 | package_dimensions => | ||
| 71 | { | ||
| 72 | # In inches | ||
| 73 | height => 6, | ||
| 74 | length => 20, | ||
| 75 | # Ounce | ||
| 76 | weight => 21 | ||
| 77 | width => 12 | ||
| 78 | }, | ||
| 79 | price => 2000, | ||
| 80 | product => $product_object, | ||
| 81 | }); | ||
| 82 | |||
| 83 | See documentation in L<Net::API::Stripe> for example to make api calls to Stripe to create those objects. | ||
| 84 | |||
| 85 | =head1 VERSION | ||
| 86 | |||
| 87 | v0.100.0 | ||
| 88 | |||
| 89 | =head1 DESCRIPTION | ||
| 90 | |||
| 91 | 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. | ||
| 92 | |||
| 93 | Can also be used to manage inventory. | ||
| 94 | |||
| 95 | =head1 CONSTRUCTOR | ||
| 96 | |||
| 97 | =over 4 | ||
| 98 | |||
| 99 | =item B<new>( %ARG ) | ||
| 100 | |||
| 101 | Creates a new L<Net::API::Stripe::Order::SKU> object. | ||
| 102 | It may also take an hash like arguments, that also are method of the same name. | ||
| 103 | |||
| 104 | =back | ||
| 105 | |||
| 106 | =head1 METHODS | ||
| 107 | |||
| 108 | =over 4 | ||
| 109 | |||
| 110 | =item B<id> string | ||
| 111 | |||
| 112 | Unique identifier for the object. | ||
| 113 | |||
| 114 | =item B<object> string, value is "sku" | ||
| 115 | |||
| 116 | String representing the object’s type. Objects of the same type share the same value. | ||
| 117 | |||
| 118 | =item B<active> boolean | ||
| 119 | |||
| 120 | Whether the SKU is available for purchase. | ||
| 121 | |||
| 122 | =item B<attributes> hash | ||
| 123 | |||
| 124 | 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"}. | ||
| 125 | |||
| 126 | =item B<created> timestamp | ||
| 127 | |||
| 128 | Time at which the object was created. Measured in seconds since the Unix epoch. | ||
| 129 | |||
| 130 | =item B<currency> currency | ||
| 131 | |||
| 132 | Three-letter ISO currency code, in lowercase. Must be a supported currency. | ||
| 133 | |||
| 134 | =item B<image> string | ||
| 135 | |||
| 136 | The URL of an image for this SKU, meant to be displayable to the customer. | ||
| 137 | |||
| 138 | This is a L<URI> object. | ||
| 139 | |||
| 140 | =item B<inventory> hash | ||
| 141 | |||
| 142 | Description of the SKU’s inventory. | ||
| 143 | |||
| 144 | This is a L<Net::API::Stripe::Order::SKU::Inventory> object. | ||
| 145 | |||
| 146 | =item B<livemode> boolean | ||
| 147 | |||
| 148 | Has the value true if the object exists in live mode or the value false if the object exists in test mode. | ||
| 149 | |||
| 150 | =item B<metadata> hash | ||
| 151 | |||
| 152 | 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. | ||
| 153 | |||
| 154 | =item B<package_dimensions> hash | ||
| 155 | |||
| 156 | The dimensions of this SKU for shipping purposes. | ||
| 157 | |||
| 158 | This is a L<Net::API::Stripe::Order::SKU::PackageDimensions> object. | ||
| 159 | |||
| 160 | =item B<price> positive integer or zero | ||
| 161 | |||
| 162 | 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). | ||
| 163 | |||
| 164 | =item B<product> string (expandable) | ||
| 165 | |||
| 166 | The ID of the product this SKU is associated with. The product must be currently active. | ||
| 167 | |||
| 168 | When expanded, this is a L<Net::API::Stripe::Product> object. | ||
| 169 | |||
| 170 | =item B<updated> timestamp | ||
| 171 | |||
| 172 | =back | ||
| 173 | |||
| 174 | =head1 API SAMPLE | ||
| 175 | |||
| 176 | { | ||
| 177 | "id": "sku_fake123456789", | ||
| 178 | "object": "sku", | ||
| 179 | "active": true, | ||
| 180 | "attributes": { | ||
| 181 | "size": "Medium", | ||
| 182 | "gender": "Unisex" | ||
| 183 | }, | ||
| 184 | "created": 1571480453, | ||
| 185 | "currency": "jpy", | ||
| 186 | "image": null, | ||
| 187 | "inventory": { | ||
| 188 | "quantity": 50, | ||
| 189 | "type": "finite", | ||
| 190 | "value": null | ||
| 191 | }, | ||
| 192 | "livemode": false, | ||
| 193 | "metadata": {}, | ||
| 194 | "package_dimensions": null, | ||
| 195 | "price": 1500, | ||
| 196 | "product": "prod_fake123456789", | ||
| 197 | "updated": 1571480453 | ||
| 198 | } | ||
| 199 | |||
| 200 | =head1 HISTORY | ||
| 201 | |||
| 202 | =head2 v0.1 | ||
| 203 | |||
| 204 | Initial version | ||
| 205 | |||
| 206 | =head1 AUTHOR | ||
| 207 | |||
| 208 | Jacques Deguest E<lt>F<jack@deguest.jp>E<gt> | ||
| 209 | |||
| 210 | =head1 SEE ALSO | ||
| 211 | |||
| 212 | Stripe API documentation: | ||
| 213 | |||
| 214 | L<https://stripe.com/docs/api/skus>, L<https://stripe.com/docs/orders> | ||
| 215 | |||
| 216 | =head1 COPYRIGHT & LICENSE | ||
| 217 | |||
| 218 | Copyright (c) 2019-2020 DEGUEST Pte. Ltd. | ||
| 219 | |||
| 220 | You can use, copy, modify and redistribute this package and associated | ||
| 221 | files under the same terms as Perl itself. | ||
| 222 | |||
| 223 | =cut | ||