Skip to content

Commit 57aeea2

Browse files
Manuel HUEZManuel HUEZ
authored andcommitted
Initial stable version
1 parent d0144a8 commit 57aeea2

37 files changed

+880
-2391
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,3 +98,4 @@ target/
9898
.env
9999

100100
deploy.sh
101+
*.pyc

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,4 @@ pip install processOut
1919
```
2020

2121
If you don't want to use pip to install this package, you may simply do a git clone
22-
of this repository.
22+
of this repository.

processout/__init__.py

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
# Import client file
2+
from processout.client import ProcessOut
3+
4+
# Import resources
5+
from processout.activity import Activity
6+
from processout.authorizationrequest import AuthorizationRequest
7+
from processout.card import Card
8+
from processout.coupon import Coupon
9+
from processout.customer import Customer
10+
from processout.token import Token
11+
from processout.discount import Discount
12+
from processout.event import Event
13+
from processout.gateway import Gateway
14+
from processout.gatewayconfiguration import GatewayConfiguration
15+
from processout.invoice import Invoice
16+
from processout.customeraction import CustomerAction
17+
from processout.plan import Plan
18+
from processout.product import Product
19+
from processout.project import Project
20+
from processout.refund import Refund
21+
from processout.subscription import Subscription
22+
from processout.transaction import Transaction
23+
from processout.webhook import Webhook
24+
25+
from processout.gatewayrequest import GatewayRequest
26+
27+
# Import errors
28+
from processout.errors.authenticationerror import AuthenticationError
29+
from processout.errors.genericerror import GenericError
30+
from processout.errors.internalerror import InternalError
31+
from processout.errors.notfounderror import NotFoundError
32+
from processout.errors.validationerror import ValidationError

processout/activity.py

Lines changed: 20 additions & 115 deletions
Original file line numberDiff line numberDiff line change
@@ -3,120 +3,27 @@
33
except ImportError:
44
from urllib import quote_plus
55

6-
from .processout import ProcessOut
7-
from .networking.response import Response
8-
9-
try:
10-
from .authorizationrequest import AuthorizationRequest
11-
except ImportError:
12-
import sys
13-
AuthorizationRequest = sys.modules[__package__ + '.authorizationrequest']
14-
try:
15-
from .card import Card
16-
except ImportError:
17-
import sys
18-
Card = sys.modules[__package__ + '.card']
19-
try:
20-
from .coupon import Coupon
21-
except ImportError:
22-
import sys
23-
Coupon = sys.modules[__package__ + '.coupon']
24-
try:
25-
from .customer import Customer
26-
except ImportError:
27-
import sys
28-
Customer = sys.modules[__package__ + '.customer']
29-
try:
30-
from .token import Token
31-
except ImportError:
32-
import sys
33-
Token = sys.modules[__package__ + '.token']
34-
try:
35-
from .discount import Discount
36-
except ImportError:
37-
import sys
38-
Discount = sys.modules[__package__ + '.discount']
39-
try:
40-
from .event import Event
41-
except ImportError:
42-
import sys
43-
Event = sys.modules[__package__ + '.event']
44-
try:
45-
from .gateway import Gateway
46-
except ImportError:
47-
import sys
48-
Gateway = sys.modules[__package__ + '.gateway']
49-
try:
50-
from .gatewayconfiguration import GatewayConfiguration
51-
except ImportError:
52-
import sys
53-
GatewayConfiguration = sys.modules[__package__ + '.gatewayconfiguration']
54-
try:
55-
from .invoice import Invoice
56-
except ImportError:
57-
import sys
58-
Invoice = sys.modules[__package__ + '.invoice']
59-
try:
60-
from .customeraction import CustomerAction
61-
except ImportError:
62-
import sys
63-
CustomerAction = sys.modules[__package__ + '.customeraction']
64-
try:
65-
from .plan import Plan
66-
except ImportError:
67-
import sys
68-
Plan = sys.modules[__package__ + '.plan']
69-
try:
70-
from .product import Product
71-
except ImportError:
72-
import sys
73-
Product = sys.modules[__package__ + '.product']
74-
try:
75-
from .project import Project
76-
except ImportError:
77-
import sys
78-
Project = sys.modules[__package__ + '.project']
79-
try:
80-
from .refund import Refund
81-
except ImportError:
82-
import sys
83-
Refund = sys.modules[__package__ + '.refund']
84-
try:
85-
from .subscription import Subscription
86-
except ImportError:
87-
import sys
88-
Subscription = sys.modules[__package__ + '.subscription']
89-
try:
90-
from .transaction import Transaction
91-
except ImportError:
92-
import sys
93-
Transaction = sys.modules[__package__ + '.transaction']
94-
try:
95-
from .webhook import Webhook
96-
except ImportError:
97-
import sys
98-
Webhook = sys.modules[__package__ + '.webhook']
99-
100-
from .networking.requestprocessoutprivate import RequestProcessoutPrivate
6+
import processout
1017

8+
from processout.networking.request import Request
9+
from processout.networking.response import Response
10210

10311
# The content of this file was automatically generated
10412

10513
class Activity:
106-
107-
def __init__(self, instance = None):
108-
if instance == None:
109-
instance = ProcessOut.getDefault()
110-
111-
self._instance = instance
14+
def __init__(self, client, prefill = None):
15+
self._client = client
11216

11317
self._id = ""
11418
self._project = None
11519
self._title = ""
11620
self._content = ""
11721
self._level = 0
11822
self._createdAt = ""
119-
23+
if prefill != None:
24+
self.fillWithData(prefill)
25+
26+
12027
@property
12128
def id(self):
12229
"""Get id"""
@@ -143,7 +50,7 @@ def project(self, val):
14350
if isinstance(val, Project):
14451
self._project = val
14552
else:
146-
obj = Project(self._instance)
53+
obj = processout.Project(self._client)
14754
obj.fillWithData(val)
14855
self._project = obj
14956
return self
@@ -220,14 +127,12 @@ def fillWithData(self, data):
220127

221128
return self
222129

223-
@staticmethod
224-
def all(options = None):
130+
def all(self, options = None):
225131
"""Get all the project activities.
226132
Keyword argument:
227133
228134
options -- Options for the request"""
229-
instance = ProcessOut.getDefault()
230-
request = RequestProcessoutPrivate(instance)
135+
request = Request(self._client)
231136
path = "/activities"
232137
data = {
233138

@@ -239,23 +144,22 @@ def all(options = None):
239144
a = []
240145
body = response.body
241146
for v in body['activities']:
242-
tmp = Activity(instance)
147+
tmp = Activity(self._client)
243148
tmp.fillWithData(v)
244149
a.append(tmp)
245150

246151
returnValues.append(a)
247152

248153

249-
return tuple(returnValues)
154+
155+
return returnValues[0];
250156

251-
@staticmethod
252-
def find(activityId, options = None):
157+
def find(self, activityId, options = None):
253158
"""Find a specific activity and fetch its data.
254159
Keyword argument:
255160
activityId -- ID of the activity
256161
options -- Options for the request"""
257-
instance = ProcessOut.getDefault()
258-
request = RequestProcessoutPrivate(instance)
162+
request = Request(self._client)
259163
path = "/activities/" + quote_plus(activityId) + ""
260164
data = {
261165

@@ -268,10 +172,11 @@ def find(activityId, options = None):
268172
body = body["activity"]
269173

270174

271-
obj = Activity()
175+
obj = processout.Activity(self._client)
272176
returnValues.append(obj.fillWithData(body))
273177

274178

275-
return tuple(returnValues)
179+
180+
return returnValues[0];
276181

277182

0 commit comments

Comments
 (0)