This repository was archived by the owner on Apr 13, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 15
Expand file tree
/
Copy pathstorage.cfc
More file actions
207 lines (171 loc) · 8.85 KB
/
Copy pathstorage.cfc
File metadata and controls
207 lines (171 loc) · 8.85 KB
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
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
<cfcomponent displayname="Storage" output="false" hint="I am the Storage Class.">
<!--- PROPERTIES --->
<cfproperty name="request_oauth_token" type="String" default="" />
<cfproperty name="request_oauth_token_secret" type="String" default="" />
<cfproperty name="oauth_token" type="String" default="" />
<cfproperty name="oauth_token_secret" type="String" default="" />
<cfproperty name="oauth_verifier" type="String" default="" />
<cfproperty name="timestamp" type="String" default="" />
<cfproperty name="oauth_session_handle" type="String" default="" />
<cfproperty name="oauth_expires_in" type="String" default="" />
<cfset variables.xero = "">
<!--- INIT --->
<cffunction name="init" access="public" output="false" returntype="storage" hint="I am the constructor method for the Storage Class.">
<cfargument name="xero" type="any">
<cfset variables.xero = arguments.xero>
<cfreturn this />
</cffunction>
<cffunction name="getRequestOAuthToken" access="public" returntype="string">
<cfset variables.request_oauth_token = "">
<cfif variables.xero.config["AppType"] NEQ "Private" AND StructKeyExists(session, "stToken")>
<cfset variables.request_oauth_token = session.stToken["request_oauth_token"]>
</cfif>
<cfreturn variables.request_oauth_token>
</cffunction>
<cffunction name="setRequestOAuthToken" access="public" >
<cfargument name="request_oauth_token" required="true" type="String" default="" hint="I am a string of this object." />
<cfif variables.xero.config["AppType"] NEQ "Private">
<cfset session.stToken["request_oauth_token"] = arguments.request_oauth_token>
</cfif>
</cffunction>
<cffunction name="getRequestOAuthTokenSecret" access="public" returntype="string">
<cfset variables.request_oauth_token_secret = "">
<cfif variables.xero.config["AppType"] NEQ "Private" AND StructKeyExists(session, "stToken")>
<cfset variables.request_oauth_token_secret = session.stToken["request_oauth_token_secret"]>
</cfif>
<cfreturn variables.request_oauth_token_secret>
</cffunction>
<cffunction name="setRequestOAuthTokenSecret" access="public" >
<cfargument name="request_oauth_token_secret" required="true" type="String" default="" hint="I am a string of this object." />
<cfif variables.xero.config["AppType"] NEQ "Private">
<cfset session.stToken["request_oauth_token_secret"] = arguments.request_oauth_token_secret>
</cfif>
</cffunction>
<cffunction name="getOAuthToken" access="public" returntype="string">
<cfset variables.oauth_token = "">
<cfif variables.xero.config["AppType"] NEQ "Private" AND StructKeyExists(session, "stToken")>
<cfset variables.oauth_token = session.stToken["oauth_token"]>
</cfif>
<cfreturn variables.oauth_token>
</cffunction>
<cffunction name="setOAuthToken" access="public" >
<cfargument name="oauth_token" required="true" type="String" default="" hint="I am a string of this object." />
<cfif variables.xero.config["AppType"] NEQ "Private" AND StructKeyExists(session, "stToken")>
<cfset session.stToken["oauth_token"] = arguments.oauth_token>
</cfif>
</cffunction>
<cffunction name="getOAuthTokenSecret" access="public" returntype="string">
<cfset variables.oauth_token_secret = "">
<cfif variables.xero.config["AppType"] NEQ "Private" AND StructKeyExists(session, "stToken")>
<cfset variables.oauth_token_secret = session.stToken["oauth_token_secret"]>
</cfif>
<cfreturn variables.oauth_token_secret>
</cffunction>
<cffunction name="setOAuthTokenSecret" access="public" >
<cfargument name="oauth_token_secret" required="true" type="String" default="" hint="I am a string of this object." />
<cfif variables.xero.config["AppType"] NEQ "Private" AND StructKeyExists(session, "stToken")>
<cfset session.stToken["oauth_token_secret"] = arguments.oauth_token_secret>
</cfif>
</cffunction>
<cffunction name="getTimestamp" access="public" returntype="string">
<cfset variables.timestamp = "">
<cfif variables.xero.config["AppType"] NEQ "Private" AND StructKeyExists(session, "stToken")>
<cfset variables.timestamp = session.stToken["timestamp"]>
</cfif>
<cfreturn variables.timestamp>
</cffunction>
<cffunction name="setTimestamp" access="public" >
<cfargument name="timestamp" required="true" type="String" default="" hint="I am a string of this object." />
<cfif variables.xero.config["AppType"] NEQ "Private" AND StructKeyExists(session, "stToken")>
<cfset session.stToken["timestamp"] = arguments.timestamp>
</cfif>
</cffunction>
<cffunction name="getOAuthExpiresIn" access="public" returntype="string">
<cfset variables.oauth_expires_in = "">
<cfif variables.xero.config["AppType"] NEQ "Private" AND StructKeyExists(session, "stToken")>
<cfset variables.oauth_expires_in = session.stToken["oauth_expires_in"]>
</cfif>
<cfreturn variables.oauth_expires_in>
</cffunction>
<cffunction name="setOAuthExpiresIn" access="public" >
<cfargument name="oauth_expires_in" required="true" type="String" default="" hint="I am a string of this object." />
<cfif variables.xero.config["AppType"] NEQ "Private" AND StructKeyExists(session, "stToken")>
<cfset session.stToken["oauth_expires_in"] = arguments.oauth_expires_in>
</cfif>
</cffunction>
<cffunction name="getOAuthSessionHandle" access="public" returntype="string">
<cfset variables.oauth_session_handle = "">
<cfif variables.xero.config["AppType"] NEQ "Private" AND StructKeyExists(session, "stToken")>
<cfset variables.oauth_session_handle = session.stToken["oauth_session_handle"]>
</cfif>
<cfreturn variables.oauth_session_handle>
</cffunction>
<cffunction name="setOAuthSessionHandle" access="public" >
<cfargument name="oauth_session_handle" required="true" type="String" default="" hint="I am a string of this object." />
<cfif variables.xero.config["AppType"] NEQ "Private" AND StructKeyExists(session, "stToken")>
<cfset session.stToken["oauth_session_handle"] = arguments.oauth_session_handle>
</cfif>
</cffunction>
<cffunction name="getVerifier" access="public" returntype="string">
<cfset variables.oauth_verifier = "">
<cfif variables.xero.config["AppType"] NEQ "Private" AND StructKeyExists(session, "stToken")>
<cfset variables.oauth_verifier = session.stToken["oauth_verifier"]>
</cfif>
<cfreturn variables.oauth_verifier>
</cffunction>
<cffunction name="setVerifier" access="public" >
<cfargument name="oauth_verifier" required="true" type="String" default="" hint="I am a string of this object." />
<cfif variables.xero.config["AppType"] NEQ "Private" AND StructKeyExists(session, "stToken")>
<cfset session.stToken["oauth_verifier"] = arguments.oauth_verifier>
</cfif>
</cffunction>
<cffunction name="saveRequestToken" access="public" >
<cfargument name="response" required="true" type="String" default="" hint="I am a string of this object." />
<cfloop list="#arguments.response#" index="local.elem" delimiters="&">
<cfif #listFirst(local.elem,"=")# EQ "oauth_token">
<cfset this.setRequestOAuthToken(listLast(local.elem,"="))>
</cfif>
<cfif #listFirst(local.elem,"=")# EQ "oauth_token_secret">
<cfset this.setRequestOAuthTokenSecret(listLast(local.elem,"="))>
</cfif>
</cfloop>
</cffunction>
<cffunction name="saveCallback" access="public" >
<cfargument name="response" required="true" type="String" default="" hint="I am a string of this object." />
<cfloop list="#arguments.response#" index="local.elem" delimiters="&">
<cfif #listFirst(local.elem,"=")# EQ "oauth_token">
<cfset this.setOAuthToken(listLast(local.elem,"="))>
</cfif>
<cfif #listFirst(local.elem,"=")# EQ "oauth_token_secret">
<cfset this.setOAuthTokenSecret(listLast(local.elem,"="))>
</cfif>
<cfif #listFirst(local.elem,"=")# EQ "oauth_verifier">
<cfset this.setVerifier(listLast(local.elem,"="))>
</cfif>
</cfloop>
</cffunction>
<cffunction name="saveAccessToken" access="public" >
<cfargument name="response" required="true" type="String" default="" hint="I am a string of this object." />
<cfloop list="#arguments.response#" index="local.elem" delimiters="&">
<cfif #listFirst(local.elem,"=")# EQ "oauth_token">
<cfset this.setOAuthToken(listLast(local.elem,"="))>
</cfif>
<cfif #listFirst(local.elem,"=")# EQ "oauth_token_secret">
<cfset this.setOAuthTokenSecret(listLast(local.elem,"="))>
</cfif>
<cfif #listFirst(local.elem,"=")# EQ "oauth_verifier">
<cfset this.setVerifier(listLast(local.elem,"="))>
</cfif>
<cfif #listFirst(local.elem,"=")# EQ "oauth_session_handle">
<cfset this.setOAuthSessionHandle(listLast(local.elem,"="))>
</cfif>
<cfif #listFirst(local.elem,"=")# EQ "oauth_expires_in">
<cfset this.setOAuthExpiresIn(listLast(local.elem,"="))>
</cfif>
</cfloop>
</cffunction>
<cffunction name="clear" access="public" >
<cfset session.stToken = structNew()>
<cfset session.stCallbackResult = structNew()>
</cffunction>
</cfcomponent>