forked from interchange/Dancer-Plugin-Nitesi
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathREADME
164 lines (113 loc) · 4.21 KB
/
README
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
NAME
Dancer::Plugin::Nitesi - Nitesi Shop Machine plugin for Dancer
VERSION
Version 0.0032
SYNOPSIS
use Dancer::Plugin::Nitesi;
cart->add({sku => 'ABC', name => 'Foobar', quantity => 1, price => 42});
cart->items();
cart->clear();
account->login(username => '[email protected]', password => 'nevairbe');
account->acl(check => 'view_prices');
account->logout();
CARTS
The cart keyword returns a Nitesi::Cart object with the corresponding
methods.
You can use multiple carts like that:
cart('wishlist')->add({sku => 'ABC', name => 'Foobar', quantity => 1, price => 42});
cart('wishlist')->total;
The DBI backend (Dancer::Plugin::Nitesi::Cart::DBI) allows you to load
carts of arbitrary users.
cart('', 123)->items;
ACCOUNTS
The account keyword returns a Nitesi::Account::Manager object with the
corresponding methods.
Login to an account:
account->login(username => '[email protected]', password => 'nevairbe');
Logout:
account->logout();
Check permissions:
account->acl(check => 'view_prices');
Change password for current account:
account->password('nevairbe');
Change password for other account:
account->password(username => '[email protected]', password => 'nevairbe');
HOOKS
This plugin installs the following hooks:
before_cart_add
Triggered before item is added to the cart.
after_cart_add
Triggered after item is added to the cart. Used by DBI backend to
save item to the database.
before_cart_remove
Triggered before item is removed from the cart.
after_cart_remove
Triggered after item is removed from the cart. Used by DBI backend
to delete item from the database.
before_cart_clear
Triggered before cart is cleared.
after_cart_clear
Triggered after cart is cleared.
before_cart_rename
Triggered before cart is renamed.
after cart_rename
Triggered after cart is renamed.
CONFIGURATION
The default configuration is as follows:
plugins:
Nitesi:
Account:
Session:
Key: account
Provider: DBI
Cart:
Backend: Session
ACCOUNT
Connection
The connection used by Dancer::Plugin::Database can be set as follows:
plugins:
Nitesi:
Account:
Provider: DBI
Connection: shop
Fields
Extra fields can be retrieved from the account provider and put into the
session after a successful login:
plugins:
Nitesi:
Account:
Provider: DBI
Fields: first_name,last_name,city
CAVEATS
Please anticipate API changes in this early state of development.
AUTHOR
Stefan Hornburg (Racke), `[email protected]'
BUGS
Please report any bugs or feature requests to `bug-nitesi at
rt.cpan.org', or through the web interface at
http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Dancer-Plugin-Nitesi. I
will be notified, and then you'll automatically be notified of progress
on your bug as I make changes.
SUPPORT
You can find documentation for this module with the perldoc command.
perldoc Dancer-Plugin-Nitesi
You can also look for information at:
* RT: CPAN's request tracker (report bugs here)
http://rt.cpan.org/NoAuth/Bugs.html?Dist=Dancer-Plugin-Nitesi
* AnnoCPAN: Annotated CPAN documentation
http://annocpan.org/dist/Dancer-Plugin-Nitesi
* CPAN Ratings
http://cpanratings.perl.org/d/Dancer-Plugin-Nitesi
* Search CPAN
http://search.cpan.org/dist/Dancer-Plugin-Nitesi/
ACKNOWLEDGEMENTS
The Dancer developers and community for their great application
framework and for their quick and competent support.
LICENSE AND COPYRIGHT
Copyright 2010-2011 Stefan Hornburg (Racke).
This program is free software; you can redistribute it and/or modify it
under the terms of either: the GNU General Public License as published
by the Free Software Foundation; or the Artistic License.
See http://dev.perl.org/licenses/ for more information.
SEE ALSO
Nitesi