qbwc 0.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,198 @@
1
+ require 'xsd/qname'
2
+
3
+ # {http://developer.intuit.com/}ArrayOfString
4
+ class ArrayOfString < ::Array
5
+ end
6
+
7
+ # {http://developer.intuit.com/}authenticate
8
+ # strUserName - SOAP::SOAPString
9
+ # strPassword - SOAP::SOAPString
10
+ class QBWC::Authenticate
11
+ attr_accessor :strUserName
12
+ attr_accessor :strPassword
13
+
14
+ def initialize(strUserName = nil, strPassword = nil)
15
+ @strUserName = strUserName
16
+ @strPassword = strPassword
17
+ end
18
+ end
19
+
20
+ # {http://developer.intuit.com/}authenticateResponse
21
+ # authenticateResult - ArrayOfString
22
+ class QBWC::AuthenticateResponse
23
+ attr_accessor :authenticateResult
24
+
25
+ def initialize(authenticateResult = nil)
26
+ @authenticateResult = authenticateResult
27
+ end
28
+ end
29
+
30
+ # {http://developer.intuit.com/}serverVersion
31
+ # strVersion - SOAP::SOAPString
32
+ class QBWC::ServerVersion
33
+ attr_accessor :strVersion
34
+
35
+ def initialize(strVersion = nil)
36
+ @strVersion = strVersion
37
+ end
38
+ end
39
+
40
+ # {http://developer.intuit.com/}serverVersionResponse
41
+ # serverVersionResult - SOAP::SOAPString
42
+ class QBWC::ServerVersionResponse
43
+ attr_accessor :serverVersionResult
44
+
45
+ def initialize(serverVersionResult = nil)
46
+ @serverVersionResult = serverVersionResult
47
+ end
48
+ end
49
+
50
+ # {http://developer.intuit.com/}clientVersion
51
+ # strVersion - SOAP::SOAPString
52
+ class QBWC::ClientVersion
53
+ attr_accessor :strVersion
54
+
55
+ def initialize(strVersion = nil)
56
+ @strVersion = strVersion
57
+ end
58
+ end
59
+
60
+ # {http://developer.intuit.com/}clientVersionResponse
61
+ # clientVersionResult - SOAP::SOAPString
62
+ class QBWC::ClientVersionResponse
63
+ attr_accessor :clientVersionResult
64
+
65
+ def initialize(clientVersionResult = nil)
66
+ @clientVersionResult = clientVersionResult
67
+ end
68
+ end
69
+
70
+ # {http://developer.intuit.com/}sendRequestXML
71
+ # ticket - SOAP::SOAPString
72
+ # strHCPResponse - SOAP::SOAPString
73
+ # strCompanyFileName - SOAP::SOAPString
74
+ # qbXMLCountry - SOAP::SOAPString
75
+ # qbXMLMajorVers - SOAP::SOAPInt
76
+ # qbXMLMinorVers - SOAP::SOAPInt
77
+ class QBWC::SendRequestXML
78
+ attr_accessor :ticket
79
+ attr_accessor :strHCPResponse
80
+ attr_accessor :strCompanyFileName
81
+ attr_accessor :qbXMLCountry
82
+ attr_accessor :qbXMLMajorVers
83
+ attr_accessor :qbXMLMinorVers
84
+
85
+ def initialize(ticket = nil, strHCPResponse = nil, strCompanyFileName = nil, qbXMLCountry = nil, qbXMLMajorVers = nil, qbXMLMinorVers = nil)
86
+ @ticket = ticket
87
+ @strHCPResponse = strHCPResponse
88
+ @strCompanyFileName = strCompanyFileName
89
+ @qbXMLCountry = qbXMLCountry
90
+ @qbXMLMajorVers = qbXMLMajorVers
91
+ @qbXMLMinorVers = qbXMLMinorVers
92
+ end
93
+ end
94
+
95
+ # {http://developer.intuit.com/}sendRequestXMLResponse
96
+ # sendRequestXMLResult - SOAP::SOAPString
97
+ class QBWC::SendRequestXMLResponse
98
+ attr_accessor :sendRequestXMLResult
99
+
100
+ def initialize(sendRequestXMLResult = nil)
101
+ @sendRequestXMLResult = sendRequestXMLResult
102
+ end
103
+ end
104
+
105
+ # {http://developer.intuit.com/}receiveResponseXML
106
+ # ticket - SOAP::SOAPString
107
+ # response - SOAP::SOAPString
108
+ # hresult - SOAP::SOAPString
109
+ # message - SOAP::SOAPString
110
+ class QBWC::ReceiveResponseXML
111
+ attr_accessor :ticket
112
+ attr_accessor :response
113
+ attr_accessor :hresult
114
+ attr_accessor :message
115
+
116
+ def initialize(ticket = nil, response = nil, hresult = nil, message = nil)
117
+ @ticket = ticket
118
+ @response = response
119
+ @hresult = hresult
120
+ @message = message
121
+ end
122
+ end
123
+
124
+ # {http://developer.intuit.com/}receiveResponseXMLResponse
125
+ # receiveResponseXMLResult - SOAP::SOAPInt
126
+ class QBWC::ReceiveResponseXMLResponse
127
+ attr_accessor :receiveResponseXMLResult
128
+
129
+ def initialize(receiveResponseXMLResult = nil)
130
+ @receiveResponseXMLResult = receiveResponseXMLResult
131
+ end
132
+ end
133
+
134
+ # {http://developer.intuit.com/}connectionError
135
+ # ticket - SOAP::SOAPString
136
+ # hresult - SOAP::SOAPString
137
+ # message - SOAP::SOAPString
138
+ class QBWC::ConnectionError
139
+ attr_accessor :ticket
140
+ attr_accessor :hresult
141
+ attr_accessor :message
142
+
143
+ def initialize(ticket = nil, hresult = nil, message = nil)
144
+ @ticket = ticket
145
+ @hresult = hresult
146
+ @message = message
147
+ end
148
+ end
149
+
150
+ # {http://developer.intuit.com/}connectionErrorResponse
151
+ # connectionErrorResult - SOAP::SOAPString
152
+ class QBWC::ConnectionErrorResponse
153
+ attr_accessor :connectionErrorResult
154
+
155
+ def initialize(connectionErrorResult = nil)
156
+ @connectionErrorResult = connectionErrorResult
157
+ end
158
+ end
159
+
160
+ # {http://developer.intuit.com/}getLastError
161
+ # ticket - SOAP::SOAPString
162
+ class QBWC::GetLastError
163
+ attr_accessor :ticket
164
+
165
+ def initialize(ticket = nil)
166
+ @ticket = ticket
167
+ end
168
+ end
169
+
170
+ # {http://developer.intuit.com/}getLastErrorResponse
171
+ # getLastErrorResult - SOAP::SOAPString
172
+ class QBWC::GetLastErrorResponse
173
+ attr_accessor :getLastErrorResult
174
+
175
+ def initialize(getLastErrorResult = nil)
176
+ @getLastErrorResult = getLastErrorResult
177
+ end
178
+ end
179
+
180
+ # {http://developer.intuit.com/}closeConnection
181
+ # ticket - SOAP::SOAPString
182
+ class QBWC::CloseConnection
183
+ attr_accessor :ticket
184
+
185
+ def initialize(ticket = nil)
186
+ @ticket = ticket
187
+ end
188
+ end
189
+
190
+ # {http://developer.intuit.com/}closeConnectionResponse
191
+ # closeConnectionResult - SOAP::SOAPString
192
+ class QBWC::CloseConnectionResponse
193
+ attr_accessor :closeConnectionResult
194
+
195
+ def initialize(closeConnectionResult = nil)
196
+ @closeConnectionResult = closeConnectionResult
197
+ end
198
+ end
@@ -0,0 +1,163 @@
1
+ require 'soap/mapping'
2
+
3
+ module QBWC::DefaultMappingRegistry
4
+ include QBWC
5
+ EncodedRegistry = ::SOAP::Mapping::EncodedRegistry.new
6
+ LiteralRegistry = ::SOAP::Mapping::LiteralRegistry.new
7
+ NsDeveloperIntuitCom = "http://developer.intuit.com/"
8
+
9
+ EncodedRegistry.register(
10
+ :class => ArrayOfString,
11
+ :schema_type => XSD::QName.new(NsDeveloperIntuitCom, "ArrayOfString"),
12
+ :schema_element => [
13
+ ["string", "SOAP::SOAPString[]", [0, nil]]
14
+ ]
15
+ )
16
+
17
+ LiteralRegistry.register(
18
+ :class => ArrayOfString,
19
+ :schema_type => XSD::QName.new(NsDeveloperIntuitCom, "ArrayOfString"),
20
+ :schema_element => [
21
+ ["string", "SOAP::SOAPString[]", [0, nil]]
22
+ ]
23
+ )
24
+
25
+ LiteralRegistry.register(
26
+ :class => Authenticate,
27
+ :schema_name => XSD::QName.new(NsDeveloperIntuitCom, "authenticate"),
28
+ :schema_element => [
29
+ ["strUserName", "SOAP::SOAPString", [0, 1]],
30
+ ["strPassword", "SOAP::SOAPString", [0, 1]]
31
+ ]
32
+ )
33
+
34
+ LiteralRegistry.register(
35
+ :class => AuthenticateResponse,
36
+ :schema_name => XSD::QName.new(NsDeveloperIntuitCom, "authenticateResponse"),
37
+ :schema_element => [
38
+ ["authenticateResult", "ArrayOfString", [0, 1]]
39
+ ]
40
+ )
41
+
42
+ LiteralRegistry.register(
43
+ :class => ServerVersion,
44
+ :schema_name => XSD::QName.new(NsDeveloperIntuitCom, "serverVersion"),
45
+ :schema_element => [
46
+ ["strVersion", "SOAP::SOAPString", [0, 1]]
47
+ ]
48
+ )
49
+
50
+ LiteralRegistry.register(
51
+ :class => ServerVersionResponse,
52
+ :schema_name => XSD::QName.new(NsDeveloperIntuitCom, "serverVersionResponse"),
53
+ :schema_element => [
54
+ ["serverVersionResult", "SOAP::SOAPString", [0, 1]]
55
+ ]
56
+ )
57
+
58
+ LiteralRegistry.register(
59
+ :class => ClientVersion,
60
+ :schema_name => XSD::QName.new(NsDeveloperIntuitCom, "clientVersion"),
61
+ :schema_element => [
62
+ ["strVersion", "SOAP::SOAPString", [0, 1]]
63
+ ]
64
+ )
65
+
66
+ LiteralRegistry.register(
67
+ :class => ClientVersionResponse,
68
+ :schema_name => XSD::QName.new(NsDeveloperIntuitCom, "clientVersionResponse"),
69
+ :schema_element => [
70
+ ["clientVersionResult", "SOAP::SOAPString", [0, 1]]
71
+ ]
72
+ )
73
+
74
+ LiteralRegistry.register(
75
+ :class => SendRequestXML,
76
+ :schema_name => XSD::QName.new(NsDeveloperIntuitCom, "sendRequestXML"),
77
+ :schema_element => [
78
+ ["ticket", "SOAP::SOAPString", [0, 1]],
79
+ ["strHCPResponse", "SOAP::SOAPString", [0, 1]],
80
+ ["strCompanyFileName", "SOAP::SOAPString", [0, 1]],
81
+ ["qbXMLCountry", "SOAP::SOAPString", [0, 1]],
82
+ ["qbXMLMajorVers", "SOAP::SOAPInt"],
83
+ ["qbXMLMinorVers", "SOAP::SOAPInt"]
84
+ ]
85
+ )
86
+
87
+ LiteralRegistry.register(
88
+ :class => SendRequestXMLResponse,
89
+ :schema_name => XSD::QName.new(NsDeveloperIntuitCom, "sendRequestXMLResponse"),
90
+ :schema_element => [
91
+ ["sendRequestXMLResult", "SOAP::SOAPString", [0, 1]]
92
+ ]
93
+ )
94
+
95
+ LiteralRegistry.register(
96
+ :class => ReceiveResponseXML,
97
+ :schema_name => XSD::QName.new(NsDeveloperIntuitCom, "receiveResponseXML"),
98
+ :schema_element => [
99
+ ["ticket", "SOAP::SOAPString", [0, 1]],
100
+ ["response", "SOAP::SOAPString", [0, 1]],
101
+ ["hresult", "SOAP::SOAPString", [0, 1]],
102
+ ["message", "SOAP::SOAPString", [0, 1]]
103
+ ]
104
+ )
105
+
106
+ LiteralRegistry.register(
107
+ :class => ReceiveResponseXMLResponse,
108
+ :schema_name => XSD::QName.new(NsDeveloperIntuitCom, "receiveResponseXMLResponse"),
109
+ :schema_element => [
110
+ ["receiveResponseXMLResult", "SOAP::SOAPInt"]
111
+ ]
112
+ )
113
+
114
+ LiteralRegistry.register(
115
+ :class => ConnectionError,
116
+ :schema_name => XSD::QName.new(NsDeveloperIntuitCom, "connectionError"),
117
+ :schema_element => [
118
+ ["ticket", "SOAP::SOAPString", [0, 1]],
119
+ ["hresult", "SOAP::SOAPString", [0, 1]],
120
+ ["message", "SOAP::SOAPString", [0, 1]]
121
+ ]
122
+ )
123
+
124
+ LiteralRegistry.register(
125
+ :class => ConnectionErrorResponse,
126
+ :schema_name => XSD::QName.new(NsDeveloperIntuitCom, "connectionErrorResponse"),
127
+ :schema_element => [
128
+ ["connectionErrorResult", "SOAP::SOAPString", [0, 1]]
129
+ ]
130
+ )
131
+
132
+ LiteralRegistry.register(
133
+ :class => GetLastError,
134
+ :schema_name => XSD::QName.new(NsDeveloperIntuitCom, "getLastError"),
135
+ :schema_element => [
136
+ ["ticket", "SOAP::SOAPString", [0, 1]]
137
+ ]
138
+ )
139
+
140
+ LiteralRegistry.register(
141
+ :class => GetLastErrorResponse,
142
+ :schema_name => XSD::QName.new(NsDeveloperIntuitCom, "getLastErrorResponse"),
143
+ :schema_element => [
144
+ ["getLastErrorResult", "SOAP::SOAPString", [0, 1]]
145
+ ]
146
+ )
147
+
148
+ LiteralRegistry.register(
149
+ :class => CloseConnection,
150
+ :schema_name => XSD::QName.new(NsDeveloperIntuitCom, "closeConnection"),
151
+ :schema_element => [
152
+ ["ticket", "SOAP::SOAPString", [0, 1]]
153
+ ]
154
+ )
155
+
156
+ LiteralRegistry.register(
157
+ :class => CloseConnectionResponse,
158
+ :schema_name => XSD::QName.new(NsDeveloperIntuitCom, "closeConnectionResponse"),
159
+ :schema_element => [
160
+ ["closeConnectionResult", "SOAP::SOAPString", [0, 1]]
161
+ ]
162
+ )
163
+ end
@@ -0,0 +1,133 @@
1
+
2
+ class QBWC::QBWebConnectorSvcSoap
3
+ # SYNOPSIS
4
+ # serverVersion(parameters)
5
+ #
6
+ # ARGS
7
+ # parameters ServerVersion - {http://developer.intuit.com/}serverVersion
8
+ #
9
+ # RETURNS
10
+ # parameters ServerVersionResponse - {http://developer.intuit.com/}serverVersionResponse
11
+ #
12
+ def serverVersion(parameters)
13
+ #p parameters
14
+ QBWC::ServerVersionResponse.new(nil)
15
+ end
16
+
17
+ # SYNOPSIS
18
+ # clientVersion(parameters)
19
+ #
20
+ # ARGS
21
+ # parameters ClientVersion - {http://developer.intuit.com/}clientVersion
22
+ #
23
+ # RETURNS
24
+ # parameters ClientVersionResponse - {http://developer.intuit.com/}clientVersionResponse
25
+ #
26
+ def clientVersion(parameters)
27
+ #p parameters
28
+ QBWC::ClientVersionResponse.new(nil)
29
+ end
30
+
31
+ # SYNOPSIS
32
+ # authenticate(parameters)
33
+ #
34
+ # ARGS
35
+ # parameters Authenticate - {http://developer.intuit.com/}authenticate
36
+ #
37
+ # RETURNS
38
+ # parameters AuthenticateResponse - {http://developer.intuit.com/}authenticateResponse
39
+ #
40
+ def authenticate(parameters)
41
+ #p parameters
42
+ QBWC::AuthenticateResponse.new([QBWC.username, QBWC.company_file_path]) #path to company file
43
+ end
44
+
45
+ # SYNOPSIS
46
+ # sendRequestXML(parameters)
47
+ #
48
+ # ARGS
49
+ # parameters SendRequestXML - {http://developer.intuit.com/}sendRequestXML
50
+ #
51
+ # RETURNS
52
+ # parameters SendRequestXMLResponse - {http://developer.intuit.com/}sendRequestXMLResponse
53
+ #
54
+ def sendRequestXML(parameters)
55
+ qbwc_session = QBWC::Session.new_or_unfinished
56
+ next_request = qbwc_session.next
57
+ return if next_request.blank?
58
+ QBWC::SendRequestXMLResponse.new(wrap_in_version(next_request.request)) unless next_request.request.blank?
59
+ end
60
+
61
+ # SYNOPSIS
62
+ # receiveResponseXML(parameters)
63
+ #
64
+ # ARGS
65
+ # parameters ReceiveResponseXML - {http://developer.intuit.com/}receiveResponseXML
66
+ #
67
+ # RETURNS
68
+ # parameters ReceiveResponseXMLResponse - {http://developer.intuit.com/}receiveResponseXMLResponse
69
+ #
70
+ def receiveResponseXML(response)
71
+ qbwc_session = QBWC::Session.new_or_unfinished
72
+ qbwc_session.response = response.response
73
+ QBWC::ReceiveResponseXMLResponse.new(qbwc_session.progress)
74
+ end
75
+
76
+ # SYNOPSIS
77
+ # connectionError(parameters)
78
+ #
79
+ # ARGS
80
+ # parameters ConnectionError - {http://developer.intuit.com/}connectionError
81
+ #
82
+ # RETURNS
83
+ # parameters ConnectionErrorResponse - {http://developer.intuit.com/}connectionErrorResponse
84
+ #
85
+ def connectionError(parameters)
86
+ #p [parameters]
87
+ raise NotImplementedError.new
88
+ end
89
+
90
+ # SYNOPSIS
91
+ # getLastError(parameters)
92
+ #
93
+ # ARGS
94
+ # parameters GetLastError - {http://developer.intuit.com/}getLastError
95
+ #
96
+ # RETURNS
97
+ # parameters GetLastErrorResponse - {http://developer.intuit.com/}getLastErrorResponse
98
+ #
99
+ def getLastError(parameters)
100
+ #p [parameters]
101
+ QBWC::GetLastErrorResponse.new(nil)
102
+ end
103
+
104
+ # SYNOPSIS
105
+ # closeConnection(parameters)
106
+ #
107
+ # ARGS
108
+ # parameters CloseConnection - {http://developer.intuit.com/}closeConnection
109
+ #
110
+ # RETURNS
111
+ # parameters CloseConnectionResponse - {http://developer.intuit.com/}closeConnectionResponse
112
+ #
113
+ def closeConnection(parameters)
114
+ #p [parameters]
115
+ qbwc_session = QBWC::Session.session
116
+ if qbwc_session && qbwc_session.finished?
117
+ qbwc_session.current_request.process_response unless qbwc_session.current_request.blank?
118
+ end
119
+ QBWC::CloseConnectionResponse.new('OK')
120
+ end
121
+
122
+ private
123
+
124
+ # wraps xml in version header
125
+ def wrap_in_version(xml_rq)
126
+ if QBWC.api == :qbpos
127
+ %Q( <?qbposxml version="#{QBWC.min_version}"?> ) + xml_rq
128
+ else
129
+ %Q( <?qbxml version="#{QBWC.min_version}"?> ) + xml_rq
130
+ end
131
+ end
132
+
133
+ end