Avatax_AddressService 1.0.1
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.
- data/Avatax Ruby SDK Guide.docx +0 -0
- data/Avatax_AddressService.gemspec +19 -0
- data/LICENSE.txt +21 -0
- data/lib/address_log.txt +1 -0
- data/lib/addressservice_dev.wsdl +290 -0
- data/lib/addressservice_prd.wsdl +290 -0
- data/lib/avatax_addressservice.rb +178 -0
- data/lib/template_isauthorized.erb +22 -0
- data/lib/template_ping.erb +22 -0
- data/lib/template_validate.erb +40 -0
- data/lib/xpath_isauthorized.txt +4 -0
- data/lib/xpath_ping.txt +9 -0
- data/lib/xpath_validate.txt +29 -0
- data/test/test_address.rb +105 -0
- metadata +97 -0
Binary file
|
@@ -0,0 +1,19 @@
|
|
1
|
+
Gem::Specification.new do |s|
|
2
|
+
s.name = "Avatax_AddressService"
|
3
|
+
s.version = "1.0.1"
|
4
|
+
s.date = "2012-10-28"
|
5
|
+
s.author = "Graham S Wilson"
|
6
|
+
s.email = "support@Avalara.com"
|
7
|
+
s.summary = "Ruby SDK for Avatax Address Web Services"
|
8
|
+
s.homepage = "http://www.avalara.com/"
|
9
|
+
s.description = "Ruby SDK provides means of communication with Avatax Web Services."
|
10
|
+
s.files = ["lib/address_log.txt", "lib/addressservice_dev.wsdl", "lib/addressservice_prd.wsdl", "lib/avatax_addressservice.rb",
|
11
|
+
"lib/template_validate.erb","lib/template_ping.erb","lib/template_isauthorized.erb",
|
12
|
+
"lib/xpath_validate.txt", "lib/xpath_ping.txt","lib/xpath_isauthorized.txt","test/test_address.rb",
|
13
|
+
"Avatax_AddressService.gemspec", "Avatax Ruby SDK Guide.docx", "LICENSE.txt"]
|
14
|
+
s.add_dependency "nokogiri", ">= 1.4.0", "< 1.6"
|
15
|
+
s.add_dependency "savon", ">= 2.3.0"
|
16
|
+
s.required_ruby_version = '>=1.9.3'
|
17
|
+
s.post_install_message = 'Thanks for installing the Avalara AddressService Ruby SDK. Refer to "Avatax Ruby SDK User Guide.docx" to get started.'
|
18
|
+
end
|
19
|
+
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
Ruby SDK for AvaTax [License]
|
2
|
+
Copyright (c) 2013 Avalara Inc.
|
3
|
+
|
4
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
5
|
+
a copy of this software and associated documentation files (the
|
6
|
+
"Software"), to deal in the Software without restriction, including
|
7
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
8
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
9
|
+
permit persons to whom the Software is furnished to do so, subject to
|
10
|
+
the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be
|
13
|
+
included in all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
16
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
17
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
18
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
19
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
20
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
21
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/lib/address_log.txt
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
|
@@ -0,0 +1,290 @@
|
|
1
|
+
<wsdl:definitions xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tm="http://microsoft.com/wsdl/mime/textMatching/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/" xmlns:tns="http://avatax.avalara.com/services" xmlns:s="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" xmlns:http="http://schemas.xmlsoap.org/wsdl/http/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" targetNamespace="http://avatax.avalara.com/services">
|
2
|
+
<wsdl:types>
|
3
|
+
<s:schema elementFormDefault="qualified" targetNamespace="http://avatax.avalara.com/services">
|
4
|
+
<s:element name="Validate">
|
5
|
+
<s:complexType>
|
6
|
+
<s:sequence>
|
7
|
+
<s:element minOccurs="0" maxOccurs="1" name="ValidateRequest" type="tns:ValidateRequest"/>
|
8
|
+
</s:sequence>
|
9
|
+
</s:complexType>
|
10
|
+
</s:element>
|
11
|
+
<s:complexType name="ValidateRequest">
|
12
|
+
<s:sequence>
|
13
|
+
<s:element minOccurs="0" maxOccurs="1" name="Address" type="tns:BaseAddress"/>
|
14
|
+
<s:element minOccurs="1" maxOccurs="1" name="TextCase" type="tns:TextCase"/>
|
15
|
+
<s:element minOccurs="1" maxOccurs="1" name="Coordinates" type="s:boolean"/>
|
16
|
+
<s:element minOccurs="1" maxOccurs="1" name="Taxability" type="s:boolean"/>
|
17
|
+
<s:element minOccurs="1" maxOccurs="1" name="Date" type="s:date"/>
|
18
|
+
</s:sequence>
|
19
|
+
</s:complexType>
|
20
|
+
<s:complexType name="BaseAddress">
|
21
|
+
<s:sequence>
|
22
|
+
<s:element minOccurs="0" maxOccurs="1" name="AddressCode" type="s:string"/>
|
23
|
+
<s:element minOccurs="0" maxOccurs="1" name="Line1" type="s:string"/>
|
24
|
+
<s:element minOccurs="0" maxOccurs="1" name="Line2" type="s:string"/>
|
25
|
+
<s:element minOccurs="0" maxOccurs="1" name="Line3" type="s:string"/>
|
26
|
+
<s:element minOccurs="0" maxOccurs="1" name="City" type="s:string"/>
|
27
|
+
<s:element minOccurs="0" maxOccurs="1" name="Region" type="s:string"/>
|
28
|
+
<s:element minOccurs="0" maxOccurs="1" name="PostalCode" type="s:string"/>
|
29
|
+
<s:element minOccurs="0" maxOccurs="1" name="Country" type="s:string"/>
|
30
|
+
<s:element minOccurs="1" maxOccurs="1" name="TaxRegionId" type="s:int"/>
|
31
|
+
<s:element minOccurs="0" maxOccurs="1" name="Latitude" type="s:string"/>
|
32
|
+
<s:element minOccurs="0" maxOccurs="1" name="Longitude" type="s:string"/>
|
33
|
+
</s:sequence>
|
34
|
+
</s:complexType>
|
35
|
+
<s:complexType name="ValidAddress">
|
36
|
+
<s:complexContent mixed="false">
|
37
|
+
<s:extension base="tns:BaseAddress">
|
38
|
+
<s:sequence>
|
39
|
+
<s:element minOccurs="0" maxOccurs="1" name="Line4" type="s:string"/>
|
40
|
+
<s:element minOccurs="0" maxOccurs="1" name="County" type="s:string"/>
|
41
|
+
<s:element minOccurs="0" maxOccurs="1" name="FipsCode" type="s:string"/>
|
42
|
+
<s:element minOccurs="0" maxOccurs="1" name="CarrierRoute" type="s:string"/>
|
43
|
+
<s:element minOccurs="0" maxOccurs="1" name="PostNet" type="s:string"/>
|
44
|
+
<s:element minOccurs="0" maxOccurs="1" name="AddressType" type="s:string"/>
|
45
|
+
<s:element minOccurs="0" maxOccurs="1" name="ValidateStatus" type="s:string"/>
|
46
|
+
<s:element minOccurs="0" maxOccurs="1" name="GeocodeType" type="s:string"/>
|
47
|
+
</s:sequence>
|
48
|
+
</s:extension>
|
49
|
+
</s:complexContent>
|
50
|
+
</s:complexType>
|
51
|
+
<s:simpleType name="TextCase">
|
52
|
+
<s:restriction base="s:string">
|
53
|
+
<s:enumeration value="Default"/>
|
54
|
+
<s:enumeration value="Upper"/>
|
55
|
+
<s:enumeration value="Mixed"/>
|
56
|
+
</s:restriction>
|
57
|
+
</s:simpleType>
|
58
|
+
<s:element name="ValidateResponse">
|
59
|
+
<s:complexType>
|
60
|
+
<s:sequence>
|
61
|
+
<s:element minOccurs="0" maxOccurs="1" name="ValidateResult" type="tns:ValidateResult"/>
|
62
|
+
</s:sequence>
|
63
|
+
</s:complexType>
|
64
|
+
</s:element>
|
65
|
+
<s:complexType name="ValidateResult">
|
66
|
+
<s:complexContent mixed="false">
|
67
|
+
<s:extension base="tns:BaseResult">
|
68
|
+
<s:sequence>
|
69
|
+
<s:element minOccurs="0" maxOccurs="1" name="ValidAddresses" type="tns:ArrayOfValidAddress"/>
|
70
|
+
<s:element minOccurs="1" maxOccurs="1" name="Taxable" type="s:boolean"/>
|
71
|
+
</s:sequence>
|
72
|
+
</s:extension>
|
73
|
+
</s:complexContent>
|
74
|
+
</s:complexType>
|
75
|
+
<s:complexType name="BaseResult">
|
76
|
+
<s:sequence>
|
77
|
+
<s:element minOccurs="0" maxOccurs="1" name="TransactionId" type="s:string"/>
|
78
|
+
<s:element minOccurs="1" maxOccurs="1" name="ResultCode" type="tns:SeverityLevel"/>
|
79
|
+
<s:element minOccurs="0" maxOccurs="1" name="Messages" type="tns:ArrayOfMessage"/>
|
80
|
+
</s:sequence>
|
81
|
+
</s:complexType>
|
82
|
+
<s:simpleType name="SeverityLevel">
|
83
|
+
<s:restriction base="s:string">
|
84
|
+
<s:enumeration value="Success"/>
|
85
|
+
<s:enumeration value="Warning"/>
|
86
|
+
<s:enumeration value="Error"/>
|
87
|
+
<s:enumeration value="Exception"/>
|
88
|
+
</s:restriction>
|
89
|
+
</s:simpleType>
|
90
|
+
<s:complexType name="ArrayOfMessage">
|
91
|
+
<s:sequence>
|
92
|
+
<s:element minOccurs="0" maxOccurs="unbounded" name="Message" nillable="true" type="tns:Message"/>
|
93
|
+
</s:sequence>
|
94
|
+
</s:complexType>
|
95
|
+
<s:complexType name="Message">
|
96
|
+
<s:sequence>
|
97
|
+
<s:element minOccurs="0" maxOccurs="1" name="Summary" type="s:string"/>
|
98
|
+
<s:element minOccurs="0" maxOccurs="1" name="Details" type="s:string"/>
|
99
|
+
<s:element minOccurs="0" maxOccurs="1" name="HelpLink" type="s:string"/>
|
100
|
+
<s:element minOccurs="0" maxOccurs="1" name="RefersTo" type="s:string"/>
|
101
|
+
<s:element minOccurs="1" maxOccurs="1" name="Severity" type="tns:SeverityLevel"/>
|
102
|
+
<s:element minOccurs="0" maxOccurs="1" name="Source" type="s:string"/>
|
103
|
+
</s:sequence>
|
104
|
+
<s:attribute name="Name" type="s:string"/>
|
105
|
+
</s:complexType>
|
106
|
+
<s:complexType name="ArrayOfValidAddress">
|
107
|
+
<s:sequence>
|
108
|
+
<s:element minOccurs="0" maxOccurs="unbounded" name="ValidAddress" nillable="true" type="tns:ValidAddress"/>
|
109
|
+
</s:sequence>
|
110
|
+
</s:complexType>
|
111
|
+
<s:element name="Profile" type="tns:Profile"/>
|
112
|
+
<s:complexType name="Profile">
|
113
|
+
<s:sequence>
|
114
|
+
<s:element minOccurs="0" maxOccurs="1" name="Name" type="s:string"/>
|
115
|
+
<s:element minOccurs="0" maxOccurs="1" name="Client" type="s:string"/>
|
116
|
+
<s:element minOccurs="0" maxOccurs="1" name="Adapter" type="s:string"/>
|
117
|
+
<s:element minOccurs="0" maxOccurs="1" name="Machine" type="s:string"/>
|
118
|
+
</s:sequence>
|
119
|
+
<s:anyAttribute/>
|
120
|
+
</s:complexType>
|
121
|
+
<s:element name="Ping">
|
122
|
+
<s:complexType>
|
123
|
+
<s:sequence>
|
124
|
+
<s:element minOccurs="0" maxOccurs="1" name="Message" type="s:string"/>
|
125
|
+
</s:sequence>
|
126
|
+
</s:complexType>
|
127
|
+
</s:element>
|
128
|
+
<s:element name="PingResponse">
|
129
|
+
<s:complexType>
|
130
|
+
<s:sequence>
|
131
|
+
<s:element minOccurs="0" maxOccurs="1" name="PingResult" type="tns:PingResult"/>
|
132
|
+
</s:sequence>
|
133
|
+
</s:complexType>
|
134
|
+
</s:element>
|
135
|
+
<s:complexType name="PingResult">
|
136
|
+
<s:complexContent mixed="false">
|
137
|
+
<s:extension base="tns:BaseResult">
|
138
|
+
<s:sequence>
|
139
|
+
<s:element minOccurs="0" maxOccurs="1" name="Version" type="s:string"/>
|
140
|
+
</s:sequence>
|
141
|
+
</s:extension>
|
142
|
+
</s:complexContent>
|
143
|
+
</s:complexType>
|
144
|
+
<s:element name="IsAuthorized">
|
145
|
+
<s:complexType>
|
146
|
+
<s:sequence>
|
147
|
+
<s:element minOccurs="0" maxOccurs="1" name="Operations" type="s:string"/>
|
148
|
+
</s:sequence>
|
149
|
+
</s:complexType>
|
150
|
+
</s:element>
|
151
|
+
<s:element name="IsAuthorizedResponse">
|
152
|
+
<s:complexType>
|
153
|
+
<s:sequence>
|
154
|
+
<s:element minOccurs="0" maxOccurs="1" name="IsAuthorizedResult" type="tns:IsAuthorizedResult"/>
|
155
|
+
</s:sequence>
|
156
|
+
</s:complexType>
|
157
|
+
</s:element>
|
158
|
+
<s:complexType name="IsAuthorizedResult">
|
159
|
+
<s:complexContent mixed="false">
|
160
|
+
<s:extension base="tns:BaseResult">
|
161
|
+
<s:sequence>
|
162
|
+
<s:element minOccurs="0" maxOccurs="1" name="Operations" type="s:string"/>
|
163
|
+
<s:element minOccurs="1" maxOccurs="1" name="Expires" type="s:dateTime"/>
|
164
|
+
</s:sequence>
|
165
|
+
</s:extension>
|
166
|
+
</s:complexContent>
|
167
|
+
</s:complexType>
|
168
|
+
</s:schema>
|
169
|
+
</wsdl:types>
|
170
|
+
<wsdl:message name="ValidateSoapIn">
|
171
|
+
<wsdl:part name="parameters" element="tns:Validate"/>
|
172
|
+
</wsdl:message>
|
173
|
+
<wsdl:message name="ValidateSoapOut">
|
174
|
+
<wsdl:part name="parameters" element="tns:ValidateResponse"/>
|
175
|
+
</wsdl:message>
|
176
|
+
<wsdl:message name="ValidateProfile">
|
177
|
+
<wsdl:part name="Profile" element="tns:Profile"/>
|
178
|
+
</wsdl:message>
|
179
|
+
<wsdl:message name="PingSoapIn">
|
180
|
+
<wsdl:part name="parameters" element="tns:Ping"/>
|
181
|
+
</wsdl:message>
|
182
|
+
<wsdl:message name="PingSoapOut">
|
183
|
+
<wsdl:part name="parameters" element="tns:PingResponse"/>
|
184
|
+
</wsdl:message>
|
185
|
+
<wsdl:message name="PingProfile">
|
186
|
+
<wsdl:part name="Profile" element="tns:Profile"/>
|
187
|
+
</wsdl:message>
|
188
|
+
<wsdl:message name="IsAuthorizedSoapIn">
|
189
|
+
<wsdl:part name="parameters" element="tns:IsAuthorized"/>
|
190
|
+
</wsdl:message>
|
191
|
+
<wsdl:message name="IsAuthorizedSoapOut">
|
192
|
+
<wsdl:part name="parameters" element="tns:IsAuthorizedResponse"/>
|
193
|
+
</wsdl:message>
|
194
|
+
<wsdl:message name="IsAuthorizedProfile">
|
195
|
+
<wsdl:part name="Profile" element="tns:Profile"/>
|
196
|
+
</wsdl:message>
|
197
|
+
<wsdl:portType name="AddressSvcSoap">
|
198
|
+
<wsdl:operation name="Validate">
|
199
|
+
<wsdl:documentation xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">Validate an Address</wsdl:documentation>
|
200
|
+
<wsdl:input message="tns:ValidateSoapIn"/>
|
201
|
+
<wsdl:output message="tns:ValidateSoapOut"/>
|
202
|
+
</wsdl:operation>
|
203
|
+
<wsdl:operation name="Ping">
|
204
|
+
<wsdl:documentation xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">Tests connectivity and version of the service</wsdl:documentation>
|
205
|
+
<wsdl:input message="tns:PingSoapIn"/>
|
206
|
+
<wsdl:output message="tns:PingSoapOut"/>
|
207
|
+
</wsdl:operation>
|
208
|
+
<wsdl:operation name="IsAuthorized">
|
209
|
+
<wsdl:documentation xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
|
210
|
+
Checks authentication and authorization to one or more operations on the service.
|
211
|
+
</wsdl:documentation>
|
212
|
+
<wsdl:input message="tns:IsAuthorizedSoapIn"/>
|
213
|
+
<wsdl:output message="tns:IsAuthorizedSoapOut"/>
|
214
|
+
</wsdl:operation>
|
215
|
+
</wsdl:portType>
|
216
|
+
<wsdl:binding name="AddressSvcSoap" type="tns:AddressSvcSoap">
|
217
|
+
<soap:binding transport="http://schemas.xmlsoap.org/soap/http"/>
|
218
|
+
<wsdl:operation name="Validate">
|
219
|
+
<soap:operation soapAction="http://avatax.avalara.com/services/Validate" style="document"/>
|
220
|
+
<wsdl:input>
|
221
|
+
<soap:body use="literal"/>
|
222
|
+
<soap:header message="tns:ValidateProfile" part="Profile" use="literal"/>
|
223
|
+
</wsdl:input>
|
224
|
+
<wsdl:output>
|
225
|
+
<soap:body use="literal"/>
|
226
|
+
</wsdl:output>
|
227
|
+
</wsdl:operation>
|
228
|
+
<wsdl:operation name="Ping">
|
229
|
+
<soap:operation soapAction="http://avatax.avalara.com/services/Ping" style="document"/>
|
230
|
+
<wsdl:input>
|
231
|
+
<soap:body use="literal"/>
|
232
|
+
<soap:header message="tns:PingProfile" part="Profile" use="literal"/>
|
233
|
+
</wsdl:input>
|
234
|
+
<wsdl:output>
|
235
|
+
<soap:body use="literal"/>
|
236
|
+
</wsdl:output>
|
237
|
+
</wsdl:operation>
|
238
|
+
<wsdl:operation name="IsAuthorized">
|
239
|
+
<soap:operation soapAction="http://avatax.avalara.com/services/IsAuthorized" style="document"/>
|
240
|
+
<wsdl:input>
|
241
|
+
<soap:body use="literal"/>
|
242
|
+
<soap:header message="tns:IsAuthorizedProfile" part="Profile" use="literal"/>
|
243
|
+
</wsdl:input>
|
244
|
+
<wsdl:output>
|
245
|
+
<soap:body use="literal"/>
|
246
|
+
</wsdl:output>
|
247
|
+
</wsdl:operation>
|
248
|
+
</wsdl:binding>
|
249
|
+
<wsdl:binding name="AddressSvcSoap12" type="tns:AddressSvcSoap">
|
250
|
+
<soap12:binding transport="http://schemas.xmlsoap.org/soap/http"/>
|
251
|
+
<wsdl:operation name="Validate">
|
252
|
+
<soap12:operation soapAction="http://avatax.avalara.com/services/Validate" style="document"/>
|
253
|
+
<wsdl:input>
|
254
|
+
<soap12:body use="literal"/>
|
255
|
+
<soap12:header message="tns:ValidateProfile" part="Profile" use="literal"/>
|
256
|
+
</wsdl:input>
|
257
|
+
<wsdl:output>
|
258
|
+
<soap12:body use="literal"/>
|
259
|
+
</wsdl:output>
|
260
|
+
</wsdl:operation>
|
261
|
+
<wsdl:operation name="Ping">
|
262
|
+
<soap12:operation soapAction="http://avatax.avalara.com/services/Ping" style="document"/>
|
263
|
+
<wsdl:input>
|
264
|
+
<soap12:body use="literal"/>
|
265
|
+
<soap12:header message="tns:PingProfile" part="Profile" use="literal"/>
|
266
|
+
</wsdl:input>
|
267
|
+
<wsdl:output>
|
268
|
+
<soap12:body use="literal"/>
|
269
|
+
</wsdl:output>
|
270
|
+
</wsdl:operation>
|
271
|
+
<wsdl:operation name="IsAuthorized">
|
272
|
+
<soap12:operation soapAction="http://avatax.avalara.com/services/IsAuthorized" style="document"/>
|
273
|
+
<wsdl:input>
|
274
|
+
<soap12:body use="literal"/>
|
275
|
+
<soap12:header message="tns:IsAuthorizedProfile" part="Profile" use="literal"/>
|
276
|
+
</wsdl:input>
|
277
|
+
<wsdl:output>
|
278
|
+
<soap12:body use="literal"/>
|
279
|
+
</wsdl:output>
|
280
|
+
</wsdl:operation>
|
281
|
+
</wsdl:binding>
|
282
|
+
<wsdl:service name="AddressSvc">
|
283
|
+
<wsdl:port name="AddressSvcSoap" binding="tns:AddressSvcSoap">
|
284
|
+
<soap:address location="https://development.avalara.net/Address/AddressSvc.asmx"/>
|
285
|
+
</wsdl:port>
|
286
|
+
<wsdl:port name="AddressSvcSoap12" binding="tns:AddressSvcSoap12">
|
287
|
+
<soap12:address location="https://development.avalara.net/Address/AddressSvc.asmx"/>
|
288
|
+
</wsdl:port>
|
289
|
+
</wsdl:service>
|
290
|
+
</wsdl:definitions>
|
@@ -0,0 +1,290 @@
|
|
1
|
+
<wsdl:definitions xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tm="http://microsoft.com/wsdl/mime/textMatching/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/" xmlns:tns="http://avatax.avalara.com/services" xmlns:s="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" xmlns:http="http://schemas.xmlsoap.org/wsdl/http/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" targetNamespace="http://avatax.avalara.com/services">
|
2
|
+
<wsdl:types>
|
3
|
+
<s:schema elementFormDefault="qualified" targetNamespace="http://avatax.avalara.com/services">
|
4
|
+
<s:element name="Validate">
|
5
|
+
<s:complexType>
|
6
|
+
<s:sequence>
|
7
|
+
<s:element minOccurs="0" maxOccurs="1" name="ValidateRequest" type="tns:ValidateRequest"/>
|
8
|
+
</s:sequence>
|
9
|
+
</s:complexType>
|
10
|
+
</s:element>
|
11
|
+
<s:complexType name="ValidateRequest">
|
12
|
+
<s:sequence>
|
13
|
+
<s:element minOccurs="0" maxOccurs="1" name="Address" type="tns:BaseAddress"/>
|
14
|
+
<s:element minOccurs="1" maxOccurs="1" name="TextCase" type="tns:TextCase"/>
|
15
|
+
<s:element minOccurs="1" maxOccurs="1" name="Coordinates" type="s:boolean"/>
|
16
|
+
<s:element minOccurs="1" maxOccurs="1" name="Taxability" type="s:boolean"/>
|
17
|
+
<s:element minOccurs="1" maxOccurs="1" name="Date" type="s:date"/>
|
18
|
+
</s:sequence>
|
19
|
+
</s:complexType>
|
20
|
+
<s:complexType name="BaseAddress">
|
21
|
+
<s:sequence>
|
22
|
+
<s:element minOccurs="0" maxOccurs="1" name="AddressCode" type="s:string"/>
|
23
|
+
<s:element minOccurs="0" maxOccurs="1" name="Line1" type="s:string"/>
|
24
|
+
<s:element minOccurs="0" maxOccurs="1" name="Line2" type="s:string"/>
|
25
|
+
<s:element minOccurs="0" maxOccurs="1" name="Line3" type="s:string"/>
|
26
|
+
<s:element minOccurs="0" maxOccurs="1" name="City" type="s:string"/>
|
27
|
+
<s:element minOccurs="0" maxOccurs="1" name="Region" type="s:string"/>
|
28
|
+
<s:element minOccurs="0" maxOccurs="1" name="PostalCode" type="s:string"/>
|
29
|
+
<s:element minOccurs="0" maxOccurs="1" name="Country" type="s:string"/>
|
30
|
+
<s:element minOccurs="1" maxOccurs="1" name="TaxRegionId" type="s:int"/>
|
31
|
+
<s:element minOccurs="0" maxOccurs="1" name="Latitude" type="s:string"/>
|
32
|
+
<s:element minOccurs="0" maxOccurs="1" name="Longitude" type="s:string"/>
|
33
|
+
</s:sequence>
|
34
|
+
</s:complexType>
|
35
|
+
<s:complexType name="ValidAddress">
|
36
|
+
<s:complexContent mixed="false">
|
37
|
+
<s:extension base="tns:BaseAddress">
|
38
|
+
<s:sequence>
|
39
|
+
<s:element minOccurs="0" maxOccurs="1" name="Line4" type="s:string"/>
|
40
|
+
<s:element minOccurs="0" maxOccurs="1" name="County" type="s:string"/>
|
41
|
+
<s:element minOccurs="0" maxOccurs="1" name="FipsCode" type="s:string"/>
|
42
|
+
<s:element minOccurs="0" maxOccurs="1" name="CarrierRoute" type="s:string"/>
|
43
|
+
<s:element minOccurs="0" maxOccurs="1" name="PostNet" type="s:string"/>
|
44
|
+
<s:element minOccurs="0" maxOccurs="1" name="AddressType" type="s:string"/>
|
45
|
+
<s:element minOccurs="0" maxOccurs="1" name="ValidateStatus" type="s:string"/>
|
46
|
+
<s:element minOccurs="0" maxOccurs="1" name="GeocodeType" type="s:string"/>
|
47
|
+
</s:sequence>
|
48
|
+
</s:extension>
|
49
|
+
</s:complexContent>
|
50
|
+
</s:complexType>
|
51
|
+
<s:simpleType name="TextCase">
|
52
|
+
<s:restriction base="s:string">
|
53
|
+
<s:enumeration value="Default"/>
|
54
|
+
<s:enumeration value="Upper"/>
|
55
|
+
<s:enumeration value="Mixed"/>
|
56
|
+
</s:restriction>
|
57
|
+
</s:simpleType>
|
58
|
+
<s:element name="ValidateResponse">
|
59
|
+
<s:complexType>
|
60
|
+
<s:sequence>
|
61
|
+
<s:element minOccurs="0" maxOccurs="1" name="ValidateResult" type="tns:ValidateResult"/>
|
62
|
+
</s:sequence>
|
63
|
+
</s:complexType>
|
64
|
+
</s:element>
|
65
|
+
<s:complexType name="ValidateResult">
|
66
|
+
<s:complexContent mixed="false">
|
67
|
+
<s:extension base="tns:BaseResult">
|
68
|
+
<s:sequence>
|
69
|
+
<s:element minOccurs="0" maxOccurs="1" name="ValidAddresses" type="tns:ArrayOfValidAddress"/>
|
70
|
+
<s:element minOccurs="1" maxOccurs="1" name="Taxable" type="s:boolean"/>
|
71
|
+
</s:sequence>
|
72
|
+
</s:extension>
|
73
|
+
</s:complexContent>
|
74
|
+
</s:complexType>
|
75
|
+
<s:complexType name="BaseResult">
|
76
|
+
<s:sequence>
|
77
|
+
<s:element minOccurs="0" maxOccurs="1" name="TransactionId" type="s:string"/>
|
78
|
+
<s:element minOccurs="1" maxOccurs="1" name="ResultCode" type="tns:SeverityLevel"/>
|
79
|
+
<s:element minOccurs="0" maxOccurs="1" name="Messages" type="tns:ArrayOfMessage"/>
|
80
|
+
</s:sequence>
|
81
|
+
</s:complexType>
|
82
|
+
<s:simpleType name="SeverityLevel">
|
83
|
+
<s:restriction base="s:string">
|
84
|
+
<s:enumeration value="Success"/>
|
85
|
+
<s:enumeration value="Warning"/>
|
86
|
+
<s:enumeration value="Error"/>
|
87
|
+
<s:enumeration value="Exception"/>
|
88
|
+
</s:restriction>
|
89
|
+
</s:simpleType>
|
90
|
+
<s:complexType name="ArrayOfMessage">
|
91
|
+
<s:sequence>
|
92
|
+
<s:element minOccurs="0" maxOccurs="unbounded" name="Message" nillable="true" type="tns:Message"/>
|
93
|
+
</s:sequence>
|
94
|
+
</s:complexType>
|
95
|
+
<s:complexType name="Message">
|
96
|
+
<s:sequence>
|
97
|
+
<s:element minOccurs="0" maxOccurs="1" name="Summary" type="s:string"/>
|
98
|
+
<s:element minOccurs="0" maxOccurs="1" name="Details" type="s:string"/>
|
99
|
+
<s:element minOccurs="0" maxOccurs="1" name="HelpLink" type="s:string"/>
|
100
|
+
<s:element minOccurs="0" maxOccurs="1" name="RefersTo" type="s:string"/>
|
101
|
+
<s:element minOccurs="1" maxOccurs="1" name="Severity" type="tns:SeverityLevel"/>
|
102
|
+
<s:element minOccurs="0" maxOccurs="1" name="Source" type="s:string"/>
|
103
|
+
</s:sequence>
|
104
|
+
<s:attribute name="Name" type="s:string"/>
|
105
|
+
</s:complexType>
|
106
|
+
<s:complexType name="ArrayOfValidAddress">
|
107
|
+
<s:sequence>
|
108
|
+
<s:element minOccurs="0" maxOccurs="unbounded" name="ValidAddress" nillable="true" type="tns:ValidAddress"/>
|
109
|
+
</s:sequence>
|
110
|
+
</s:complexType>
|
111
|
+
<s:element name="Profile" type="tns:Profile"/>
|
112
|
+
<s:complexType name="Profile">
|
113
|
+
<s:sequence>
|
114
|
+
<s:element minOccurs="0" maxOccurs="1" name="Name" type="s:string"/>
|
115
|
+
<s:element minOccurs="0" maxOccurs="1" name="Client" type="s:string"/>
|
116
|
+
<s:element minOccurs="0" maxOccurs="1" name="Adapter" type="s:string"/>
|
117
|
+
<s:element minOccurs="0" maxOccurs="1" name="Machine" type="s:string"/>
|
118
|
+
</s:sequence>
|
119
|
+
<s:anyAttribute/>
|
120
|
+
</s:complexType>
|
121
|
+
<s:element name="Ping">
|
122
|
+
<s:complexType>
|
123
|
+
<s:sequence>
|
124
|
+
<s:element minOccurs="0" maxOccurs="1" name="Message" type="s:string"/>
|
125
|
+
</s:sequence>
|
126
|
+
</s:complexType>
|
127
|
+
</s:element>
|
128
|
+
<s:element name="PingResponse">
|
129
|
+
<s:complexType>
|
130
|
+
<s:sequence>
|
131
|
+
<s:element minOccurs="0" maxOccurs="1" name="PingResult" type="tns:PingResult"/>
|
132
|
+
</s:sequence>
|
133
|
+
</s:complexType>
|
134
|
+
</s:element>
|
135
|
+
<s:complexType name="PingResult">
|
136
|
+
<s:complexContent mixed="false">
|
137
|
+
<s:extension base="tns:BaseResult">
|
138
|
+
<s:sequence>
|
139
|
+
<s:element minOccurs="0" maxOccurs="1" name="Version" type="s:string"/>
|
140
|
+
</s:sequence>
|
141
|
+
</s:extension>
|
142
|
+
</s:complexContent>
|
143
|
+
</s:complexType>
|
144
|
+
<s:element name="IsAuthorized">
|
145
|
+
<s:complexType>
|
146
|
+
<s:sequence>
|
147
|
+
<s:element minOccurs="0" maxOccurs="1" name="Operations" type="s:string"/>
|
148
|
+
</s:sequence>
|
149
|
+
</s:complexType>
|
150
|
+
</s:element>
|
151
|
+
<s:element name="IsAuthorizedResponse">
|
152
|
+
<s:complexType>
|
153
|
+
<s:sequence>
|
154
|
+
<s:element minOccurs="0" maxOccurs="1" name="IsAuthorizedResult" type="tns:IsAuthorizedResult"/>
|
155
|
+
</s:sequence>
|
156
|
+
</s:complexType>
|
157
|
+
</s:element>
|
158
|
+
<s:complexType name="IsAuthorizedResult">
|
159
|
+
<s:complexContent mixed="false">
|
160
|
+
<s:extension base="tns:BaseResult">
|
161
|
+
<s:sequence>
|
162
|
+
<s:element minOccurs="0" maxOccurs="1" name="Operations" type="s:string"/>
|
163
|
+
<s:element minOccurs="1" maxOccurs="1" name="Expires" type="s:dateTime"/>
|
164
|
+
</s:sequence>
|
165
|
+
</s:extension>
|
166
|
+
</s:complexContent>
|
167
|
+
</s:complexType>
|
168
|
+
</s:schema>
|
169
|
+
</wsdl:types>
|
170
|
+
<wsdl:message name="ValidateSoapIn">
|
171
|
+
<wsdl:part name="parameters" element="tns:Validate"/>
|
172
|
+
</wsdl:message>
|
173
|
+
<wsdl:message name="ValidateSoapOut">
|
174
|
+
<wsdl:part name="parameters" element="tns:ValidateResponse"/>
|
175
|
+
</wsdl:message>
|
176
|
+
<wsdl:message name="ValidateProfile">
|
177
|
+
<wsdl:part name="Profile" element="tns:Profile"/>
|
178
|
+
</wsdl:message>
|
179
|
+
<wsdl:message name="PingSoapIn">
|
180
|
+
<wsdl:part name="parameters" element="tns:Ping"/>
|
181
|
+
</wsdl:message>
|
182
|
+
<wsdl:message name="PingSoapOut">
|
183
|
+
<wsdl:part name="parameters" element="tns:PingResponse"/>
|
184
|
+
</wsdl:message>
|
185
|
+
<wsdl:message name="PingProfile">
|
186
|
+
<wsdl:part name="Profile" element="tns:Profile"/>
|
187
|
+
</wsdl:message>
|
188
|
+
<wsdl:message name="IsAuthorizedSoapIn">
|
189
|
+
<wsdl:part name="parameters" element="tns:IsAuthorized"/>
|
190
|
+
</wsdl:message>
|
191
|
+
<wsdl:message name="IsAuthorizedSoapOut">
|
192
|
+
<wsdl:part name="parameters" element="tns:IsAuthorizedResponse"/>
|
193
|
+
</wsdl:message>
|
194
|
+
<wsdl:message name="IsAuthorizedProfile">
|
195
|
+
<wsdl:part name="Profile" element="tns:Profile"/>
|
196
|
+
</wsdl:message>
|
197
|
+
<wsdl:portType name="AddressSvcSoap">
|
198
|
+
<wsdl:operation name="Validate">
|
199
|
+
<wsdl:documentation xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">Validate an Address</wsdl:documentation>
|
200
|
+
<wsdl:input message="tns:ValidateSoapIn"/>
|
201
|
+
<wsdl:output message="tns:ValidateSoapOut"/>
|
202
|
+
</wsdl:operation>
|
203
|
+
<wsdl:operation name="Ping">
|
204
|
+
<wsdl:documentation xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">Tests connectivity and version of the service</wsdl:documentation>
|
205
|
+
<wsdl:input message="tns:PingSoapIn"/>
|
206
|
+
<wsdl:output message="tns:PingSoapOut"/>
|
207
|
+
</wsdl:operation>
|
208
|
+
<wsdl:operation name="IsAuthorized">
|
209
|
+
<wsdl:documentation xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
|
210
|
+
Checks authentication and authorization to one or more operations on the service.
|
211
|
+
</wsdl:documentation>
|
212
|
+
<wsdl:input message="tns:IsAuthorizedSoapIn"/>
|
213
|
+
<wsdl:output message="tns:IsAuthorizedSoapOut"/>
|
214
|
+
</wsdl:operation>
|
215
|
+
</wsdl:portType>
|
216
|
+
<wsdl:binding name="AddressSvcSoap" type="tns:AddressSvcSoap">
|
217
|
+
<soap:binding transport="http://schemas.xmlsoap.org/soap/http"/>
|
218
|
+
<wsdl:operation name="Validate">
|
219
|
+
<soap:operation soapAction="http://avatax.avalara.com/services/Validate" style="document"/>
|
220
|
+
<wsdl:input>
|
221
|
+
<soap:body use="literal"/>
|
222
|
+
<soap:header message="tns:ValidateProfile" part="Profile" use="literal"/>
|
223
|
+
</wsdl:input>
|
224
|
+
<wsdl:output>
|
225
|
+
<soap:body use="literal"/>
|
226
|
+
</wsdl:output>
|
227
|
+
</wsdl:operation>
|
228
|
+
<wsdl:operation name="Ping">
|
229
|
+
<soap:operation soapAction="http://avatax.avalara.com/services/Ping" style="document"/>
|
230
|
+
<wsdl:input>
|
231
|
+
<soap:body use="literal"/>
|
232
|
+
<soap:header message="tns:PingProfile" part="Profile" use="literal"/>
|
233
|
+
</wsdl:input>
|
234
|
+
<wsdl:output>
|
235
|
+
<soap:body use="literal"/>
|
236
|
+
</wsdl:output>
|
237
|
+
</wsdl:operation>
|
238
|
+
<wsdl:operation name="IsAuthorized">
|
239
|
+
<soap:operation soapAction="http://avatax.avalara.com/services/IsAuthorized" style="document"/>
|
240
|
+
<wsdl:input>
|
241
|
+
<soap:body use="literal"/>
|
242
|
+
<soap:header message="tns:IsAuthorizedProfile" part="Profile" use="literal"/>
|
243
|
+
</wsdl:input>
|
244
|
+
<wsdl:output>
|
245
|
+
<soap:body use="literal"/>
|
246
|
+
</wsdl:output>
|
247
|
+
</wsdl:operation>
|
248
|
+
</wsdl:binding>
|
249
|
+
<wsdl:binding name="AddressSvcSoap12" type="tns:AddressSvcSoap">
|
250
|
+
<soap12:binding transport="http://schemas.xmlsoap.org/soap/http"/>
|
251
|
+
<wsdl:operation name="Validate">
|
252
|
+
<soap12:operation soapAction="http://avatax.avalara.com/services/Validate" style="document"/>
|
253
|
+
<wsdl:input>
|
254
|
+
<soap12:body use="literal"/>
|
255
|
+
<soap12:header message="tns:ValidateProfile" part="Profile" use="literal"/>
|
256
|
+
</wsdl:input>
|
257
|
+
<wsdl:output>
|
258
|
+
<soap12:body use="literal"/>
|
259
|
+
</wsdl:output>
|
260
|
+
</wsdl:operation>
|
261
|
+
<wsdl:operation name="Ping">
|
262
|
+
<soap12:operation soapAction="http://avatax.avalara.com/services/Ping" style="document"/>
|
263
|
+
<wsdl:input>
|
264
|
+
<soap12:body use="literal"/>
|
265
|
+
<soap12:header message="tns:PingProfile" part="Profile" use="literal"/>
|
266
|
+
</wsdl:input>
|
267
|
+
<wsdl:output>
|
268
|
+
<soap12:body use="literal"/>
|
269
|
+
</wsdl:output>
|
270
|
+
</wsdl:operation>
|
271
|
+
<wsdl:operation name="IsAuthorized">
|
272
|
+
<soap12:operation soapAction="http://avatax.avalara.com/services/IsAuthorized" style="document"/>
|
273
|
+
<wsdl:input>
|
274
|
+
<soap12:body use="literal"/>
|
275
|
+
<soap12:header message="tns:IsAuthorizedProfile" part="Profile" use="literal"/>
|
276
|
+
</wsdl:input>
|
277
|
+
<wsdl:output>
|
278
|
+
<soap12:body use="literal"/>
|
279
|
+
</wsdl:output>
|
280
|
+
</wsdl:operation>
|
281
|
+
</wsdl:binding>
|
282
|
+
<wsdl:service name="AddressSvc">
|
283
|
+
<wsdl:port name="AddressSvcSoap" binding="tns:AddressSvcSoap">
|
284
|
+
<soap:address location="https://avatax.avalara.net/Address/AddressSvc.asmx"/>
|
285
|
+
</wsdl:port>
|
286
|
+
<wsdl:port name="AddressSvcSoap12" binding="tns:AddressSvcSoap12">
|
287
|
+
<soap12:address location="https://avatax.avalara.net/Address/AddressSvc.asmx"/>
|
288
|
+
</wsdl:port>
|
289
|
+
</wsdl:service>
|
290
|
+
</wsdl:definitions>
|
@@ -0,0 +1,178 @@
|
|
1
|
+
require 'savon'
|
2
|
+
require 'erb'
|
3
|
+
require 'nokogiri'
|
4
|
+
|
5
|
+
module AvaTax
|
6
|
+
|
7
|
+
#Avalara address class
|
8
|
+
class AddressService
|
9
|
+
|
10
|
+
def initialize(username,password,name,clientname,adapter,machine)
|
11
|
+
|
12
|
+
#Set credentials and Profile information
|
13
|
+
@username = username == nil ? "" : username
|
14
|
+
@password = password == nil ? "" : password
|
15
|
+
@name = name == nil ? "" : name
|
16
|
+
@clientname = clientname == nil ? "" : clientname
|
17
|
+
@adapter = adapter == nil ? "" : adapter
|
18
|
+
@machine = machine == nil ? "" : machine
|
19
|
+
|
20
|
+
#Set @def_locn to the Avatax-x.x.x gem install library. This enables the ruby programs to
|
21
|
+
#find other objects that it needs.
|
22
|
+
@def_locn = 'C:\Ruby193\lib\ruby\gems\1.9.1\gems\Avatax_AddressService-1.0.0\lib'
|
23
|
+
|
24
|
+
#Open Avatax Error Log
|
25
|
+
@log = File.new(@def_locn + '\address_log.txt', "w")
|
26
|
+
@log.puts "#{Time.now}: Address service started"
|
27
|
+
|
28
|
+
#log :false turns off HTTP logging
|
29
|
+
@client = Savon.client(wsdl: @def_locn + '/addressservice_dev.wsdl', log: false)
|
30
|
+
|
31
|
+
begin
|
32
|
+
#Read in the SOAP template for Ping
|
33
|
+
@template_ping = ERB.new(File.read(@def_locn + '\template_ping.erb'))
|
34
|
+
rescue
|
35
|
+
@log.puts "#{Time.now}: Error loading the Ping template"
|
36
|
+
end
|
37
|
+
|
38
|
+
begin
|
39
|
+
#Read in the SOAP template for Validate
|
40
|
+
@template_validate = ERB.new(File.read(@def_locn + '\template_validate.erb'))
|
41
|
+
rescue
|
42
|
+
@log.puts "#{Time.now}: Error loading the Validate template"
|
43
|
+
end
|
44
|
+
|
45
|
+
begin
|
46
|
+
#Read in the SOAP template for IsAuthorized
|
47
|
+
@template_isauthorized = ERB.new(File.read(@def_locn + '\template_isauthorized.erb'))
|
48
|
+
rescue
|
49
|
+
@log.puts "#{Time.now}: Error loading the IsAuthorized template"
|
50
|
+
end
|
51
|
+
# Create hash for validate result
|
52
|
+
@return_data = Hash.new
|
53
|
+
end
|
54
|
+
|
55
|
+
############################################################################################################
|
56
|
+
# ping - Verifies connectivity to the web service and returns version information
|
57
|
+
############################################################################################################
|
58
|
+
def ping(message = nil)
|
59
|
+
#Read in the SOAP template
|
60
|
+
@message = message == nil ? "?" : message
|
61
|
+
|
62
|
+
# Subsitute real vales for template place holders
|
63
|
+
@soap = @template_ping.result(binding)
|
64
|
+
|
65
|
+
#Clear return hash
|
66
|
+
@return_data.clear
|
67
|
+
|
68
|
+
# Make the call to the Avalara Ping service
|
69
|
+
begin
|
70
|
+
@response = @client.call(:ping, xml: @soap).to_s
|
71
|
+
rescue
|
72
|
+
@log.puts "#{Time.now}: Error calling Ping service ... check username and password"
|
73
|
+
end
|
74
|
+
# Load the response into a Nokogiri object and remove namespaces
|
75
|
+
@doc = Nokogiri::XML(@response).remove_namespaces!
|
76
|
+
|
77
|
+
#Read in an array of XPATH pointers
|
78
|
+
@ping_xpath = File.readlines(@def_locn + '\xpath_ping.txt')
|
79
|
+
|
80
|
+
#Read each array element, extract the result returned by the service and place in a the @return_data hash
|
81
|
+
@ping_xpath.each{|xpath| @return_data[xpath[2...xpath.length].chomp.to_sym] = @doc.xpath(xpath).text}
|
82
|
+
|
83
|
+
return @return_data
|
84
|
+
end
|
85
|
+
|
86
|
+
############################################################################################################
|
87
|
+
# validate - call the adddress validation service
|
88
|
+
############################################################################################################
|
89
|
+
def validate(addresscode = nil,
|
90
|
+
line1 = nil,
|
91
|
+
line2 = nil,
|
92
|
+
line3 = nil,
|
93
|
+
city = nil,
|
94
|
+
region = nil,
|
95
|
+
postalcode = nil,
|
96
|
+
country = nil,
|
97
|
+
taxregionid = nil,
|
98
|
+
latitude = nil,
|
99
|
+
longitude = nil,
|
100
|
+
textcase = nil,
|
101
|
+
coordinates = nil,
|
102
|
+
taxability = nil)
|
103
|
+
|
104
|
+
#Set parms passed by user - If Nil then default else use passed value
|
105
|
+
@addresscode = addresscode == nil ? "123" : addresscode
|
106
|
+
@line1 = line1 == nil ? "" : line1
|
107
|
+
@line2 = line2 == nil ? "" : line2
|
108
|
+
@line3 = line3 == nil ? "" : line3
|
109
|
+
@city = city == nil ? "" : city
|
110
|
+
@region = region == nil ? "" : region
|
111
|
+
@postalcode = postalcode == nil ? "" : postalcode
|
112
|
+
@country = country == nil ? "" : country
|
113
|
+
@taxregionid = taxregionid == nil ? "0" : taxregionid
|
114
|
+
@latitude = latitude == nil ? "" : latitude
|
115
|
+
@longitude = longitude == nil ? "" : longitude
|
116
|
+
@textcase = textcase == nil ? "Default" : textcase
|
117
|
+
@coordinates = coordinates == nil ? "true" : coordinates
|
118
|
+
@taxability = taxability == nil ? "false" : taxability
|
119
|
+
|
120
|
+
# Subsitute real vales for template place holders
|
121
|
+
@soap = @template_validate.result(binding)
|
122
|
+
|
123
|
+
#Clear return hash
|
124
|
+
@return_data.clear
|
125
|
+
|
126
|
+
# Make the call to the Avalara Validate service
|
127
|
+
begin
|
128
|
+
@response = @client.call(:validate, xml: @soap).to_s
|
129
|
+
|
130
|
+
rescue
|
131
|
+
@log.puts "#{Time.now}: Error calling Validate service ... check username and password"
|
132
|
+
end
|
133
|
+
|
134
|
+
# Load the response into a Nokogiri object and remove namespaces
|
135
|
+
@doc = Nokogiri::XML(@response).remove_namespaces!
|
136
|
+
|
137
|
+
#Read in an array of XPATH pointers
|
138
|
+
@validate_xpath = File.readlines(@def_locn + '\xpath_validate.txt')
|
139
|
+
|
140
|
+
#Read each array element, extract the result returned by the service and place in a the @return_data hash
|
141
|
+
@validate_xpath.each{|xpath| @return_data[xpath[2...xpath.length].chomp.to_sym] = @doc.xpath(xpath).text}
|
142
|
+
|
143
|
+
return @return_data
|
144
|
+
end
|
145
|
+
|
146
|
+
############################################################################################################
|
147
|
+
#Verifies connectivity to the web service and returns version information about the service.
|
148
|
+
############################################################################################################
|
149
|
+
def isauthorized(operation = nil)
|
150
|
+
#Read in the SOAP template
|
151
|
+
@operation = operation == nil ? "?" : operation
|
152
|
+
|
153
|
+
# Subsitute real vales for template place holders
|
154
|
+
@soap = @template_isauthorized.result(binding)
|
155
|
+
|
156
|
+
#Clear return hash
|
157
|
+
@return_data.clear
|
158
|
+
|
159
|
+
# Make the call to the Avalara Ping service
|
160
|
+
begin
|
161
|
+
@response = @client.call(:is_authorized, xml: @soap).to_s
|
162
|
+
rescue
|
163
|
+
@log.puts "#{Time.now}: Error calling IsAuthorized service ... check username and password"
|
164
|
+
end
|
165
|
+
|
166
|
+
# Load the response into a Nokogiri object and remove namespaces
|
167
|
+
@doc = Nokogiri::XML(@response).remove_namespaces!
|
168
|
+
|
169
|
+
#Read in an array of XPATH pointers
|
170
|
+
@isauthorized_xpath = File.readlines(@def_locn + '\xpath_isauthorized.txt')
|
171
|
+
|
172
|
+
#Read each array element, extract the result returned by the service and place in a the @return_data hash
|
173
|
+
@isauthorized_xpath.each{|xpath| @return_data[xpath[2...xpath.length].chomp.to_sym] = @doc.xpath(xpath).text}
|
174
|
+
|
175
|
+
return @return_data
|
176
|
+
end
|
177
|
+
end
|
178
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ser="http://avatax.avalara.com/services">
|
2
|
+
<soapenv:Header>
|
3
|
+
<wsse:Security xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd">
|
4
|
+
<wsse:UsernameToken wsu:Id="UsernameToken-7" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
|
5
|
+
<wsse:Username><%= @username %></wsse:Username>
|
6
|
+
<wsse:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText"><%= @password %></wsse:Password>
|
7
|
+
<wsu:Created>2012-03-02T23:41:44.511Z</wsu:Created>
|
8
|
+
</wsse:UsernameToken>
|
9
|
+
</wsse:Security>
|
10
|
+
<ser:Profile>
|
11
|
+
<ser:Name><%= @name %></ser:Name>
|
12
|
+
<ser:Client><%= @clientname %></ser:Client>
|
13
|
+
<ser:Adapter><%= @adapter %></ser:Adapter>
|
14
|
+
<ser:Machine><%= @machine %></ser:Machine>
|
15
|
+
</ser:Profile>
|
16
|
+
</soapenv:Header>
|
17
|
+
<soapenv:Body>
|
18
|
+
<ser:IsAuthorized>
|
19
|
+
<ser:Operations><%= @operation %></ser:Operations>
|
20
|
+
</ser:IsAuthorized>
|
21
|
+
</soapenv:Body>
|
22
|
+
</soapenv:Envelope>
|
@@ -0,0 +1,22 @@
|
|
1
|
+
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ser="http://avatax.avalara.com/services">
|
2
|
+
<soapenv:Header>
|
3
|
+
<wsse:Security xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd">
|
4
|
+
<wsse:UsernameToken wsu:Id="UsernameToken-7" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
|
5
|
+
<wsse:Username><%= @username %></wsse:Username>
|
6
|
+
<wsse:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText"><%= @password %></wsse:Password>
|
7
|
+
<wsu:Created>2012-03-02T23:41:44.511Z</wsu:Created>
|
8
|
+
</wsse:UsernameToken>
|
9
|
+
</wsse:Security>
|
10
|
+
<ser:Profile>
|
11
|
+
<ser:Name><%= @name %></ser:Name>
|
12
|
+
<ser:Client><%= @clientname %></ser:Client>
|
13
|
+
<ser:Adapter><%= @adapter %></ser:Adapter>
|
14
|
+
<ser:Machine><%= @machine %></ser:Machine>
|
15
|
+
</ser:Profile>
|
16
|
+
</soapenv:Header>
|
17
|
+
<soapenv:Body>
|
18
|
+
<ser:Ping>
|
19
|
+
<ser:Message><%= @ping_message %></ser:Message>
|
20
|
+
</ser:Ping>
|
21
|
+
</soapenv:Body>
|
22
|
+
</soapenv:Envelope>
|
@@ -0,0 +1,40 @@
|
|
1
|
+
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ser="http://avatax.avalara.com/services">
|
2
|
+
<soapenv:Header>
|
3
|
+
<wsse:Security xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd">
|
4
|
+
<wsse:UsernameToken wsu:Id="UsernameToken-7" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
|
5
|
+
<wsse:Username><%= @username %></wsse:Username>
|
6
|
+
<wsse:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText"><%= @password %></wsse:Password>
|
7
|
+
<wsu:Created>2012-03-02T23:41:44.511Z</wsu:Created>
|
8
|
+
</wsse:UsernameToken>
|
9
|
+
</wsse:Security>
|
10
|
+
<ser:Profile>
|
11
|
+
<ser:Name><%= @name %></ser:Name>
|
12
|
+
<ser:Client><%= @clientname %></ser:Client>
|
13
|
+
<ser:Adapter><%= @adapter %></ser:Adapter>
|
14
|
+
<ser:Machine><%= @machine %></ser:Machine>
|
15
|
+
</ser:Profile>
|
16
|
+
</soapenv:Header>
|
17
|
+
<soapenv:Body>
|
18
|
+
<ser:Validate>
|
19
|
+
<ser:ValidateRequest>
|
20
|
+
<ser:Address>
|
21
|
+
<ser:AddressCode><%= @addresscode %></ser:AddressCode>
|
22
|
+
<ser:Line1><%= @line1 %></ser:Line1>
|
23
|
+
<ser:Line2><%= @line2 %></ser:Line2>
|
24
|
+
<ser:Line3><%= @line3 %></ser:Line3>
|
25
|
+
<ser:City><%= @city %></ser:City>
|
26
|
+
<ser:Region><%= @region %></ser:Region>
|
27
|
+
<ser:PostalCode><%= @postalcode %></ser:PostalCode>
|
28
|
+
<ser:Country><%= @country %></ser:Country>
|
29
|
+
<ser:TaxRegionId><%= @taxregionid %></ser:TaxRegionId>
|
30
|
+
<ser:Latitude><%= @latitude %></ser:Latitude>
|
31
|
+
<ser:Longitude><%= @longitude %></ser:Longitude>
|
32
|
+
</ser:Address>
|
33
|
+
<ser:TextCase><%= @textcase %></ser:TextCase>
|
34
|
+
<ser:Coordinates><%= @coordinates %></ser:Coordinates>
|
35
|
+
<ser:Taxability><%= @taxability %></ser:Taxability>
|
36
|
+
<ser:Date>1900-01-01</ser:Date>
|
37
|
+
</ser:ValidateRequest>
|
38
|
+
</ser:Validate>
|
39
|
+
</soapenv:Body>
|
40
|
+
</soapenv:Envelope>
|
data/lib/xpath_ping.txt
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
//TransactionId
|
2
|
+
//ResultCode
|
3
|
+
//Summary
|
4
|
+
//Details
|
5
|
+
//Helplink
|
6
|
+
//RefersTo
|
7
|
+
//Severity
|
8
|
+
//Source
|
9
|
+
//AddressCode
|
10
|
+
//Line1
|
11
|
+
//Line2
|
12
|
+
//Line3
|
13
|
+
//Line4
|
14
|
+
//City
|
15
|
+
//Region
|
16
|
+
//PostalCode
|
17
|
+
//Country
|
18
|
+
//TaxRegionId
|
19
|
+
//Latitude
|
20
|
+
//Longitude
|
21
|
+
//County
|
22
|
+
//FipsCode
|
23
|
+
//CarrierRoute
|
24
|
+
//PostNet
|
25
|
+
//AddressType
|
26
|
+
//Longitude
|
27
|
+
//ValidateStatus
|
28
|
+
//Geocode
|
29
|
+
//Taxable
|
@@ -0,0 +1,105 @@
|
|
1
|
+
#Load the Avalara Address Service module
|
2
|
+
require 'avatax_addressservice'
|
3
|
+
#require green_shoes for the GUI
|
4
|
+
require 'green_shoes'
|
5
|
+
|
6
|
+
#Create an address service instance
|
7
|
+
#Call the gettax service
|
8
|
+
username = 'USERNAME
|
9
|
+
password = 'PASSWORD'
|
10
|
+
name = 'Avalara Inc.'
|
11
|
+
clientname = 'MyShoppingCart'
|
12
|
+
adapter = 'Avatax SDK for Ruby 1.0.1'
|
13
|
+
machine = 'Lenovo W520 Windows 7'
|
14
|
+
AddrService = AvaTax::AddressService.new(username,password,name,clientname,adapter,machine)
|
15
|
+
|
16
|
+
#Open a window to get the address to validate
|
17
|
+
Shoes.app :width => 400, :height => 700, :title => "Avalara - Address Validation Tester" do
|
18
|
+
|
19
|
+
#Set window characteristics
|
20
|
+
background green..orange
|
21
|
+
|
22
|
+
#Get the address to validate from the user
|
23
|
+
stack :margin => 10 do
|
24
|
+
#Get user input
|
25
|
+
para "Line 1:"
|
26
|
+
@line1 = edit_line text: "100 rav"
|
27
|
+
para "Line 2:"
|
28
|
+
@line2 = edit_line
|
29
|
+
para "Line 3:"
|
30
|
+
@line3 = edit_line
|
31
|
+
para "City"
|
32
|
+
@city = edit_line width: 100, text: "bainbridge"
|
33
|
+
para "State"
|
34
|
+
@state = edit_line width: 40, text: 'WA'
|
35
|
+
para "Zip"
|
36
|
+
@zip = edit_line width: 60, text: "98110"
|
37
|
+
para "Country"
|
38
|
+
@country = edit_line width: 30, text: "US"
|
39
|
+
para "Textcase"
|
40
|
+
@textcase = "Default"
|
41
|
+
list_box items: ["Default", "Upper", "Mixed"],
|
42
|
+
width: 120, choose: @textcase do |list|
|
43
|
+
@textcase = list.text
|
44
|
+
end
|
45
|
+
@validate = button "Validate"
|
46
|
+
end
|
47
|
+
|
48
|
+
|
49
|
+
#When the user clicks the Validate button then call the Validate service
|
50
|
+
@validate.click {
|
51
|
+
|
52
|
+
#Call the validate service
|
53
|
+
val_addr = AddrService.validate(nil, @line1.text, nil, nil, @city.text, @state.text, @zip.text, 'US', nil, nil, nil, @textcase, nil, nil)
|
54
|
+
|
55
|
+
if val_addr[:ResultCode] == "Success"
|
56
|
+
#Display validated result in a new window
|
57
|
+
Shoes.app :width => 400, :height => 700, :left => 1000, :title => "Avalara - Address Validation Result" do
|
58
|
+
|
59
|
+
background orange..blue
|
60
|
+
|
61
|
+
stack :margin => 10 do
|
62
|
+
#Display result
|
63
|
+
para "Line 1:"
|
64
|
+
edit_line :text => val_addr[:Line1]
|
65
|
+
para "Line 2:"
|
66
|
+
edit_line :text => val_addr[:Line2]
|
67
|
+
para "Line 3:"
|
68
|
+
edit_line :text => val_addr[:Line3]
|
69
|
+
para "City"
|
70
|
+
edit_line :text => val_addr[:City]
|
71
|
+
para "State"
|
72
|
+
edit_line :text => val_addr[:Region]
|
73
|
+
para "Zip"
|
74
|
+
edit_line :text => val_addr[:PostalCode]
|
75
|
+
para "Country"
|
76
|
+
edit_line :text => val_addr[:Country]
|
77
|
+
end
|
78
|
+
end
|
79
|
+
else
|
80
|
+
#Display error message in a new window
|
81
|
+
Shoes.app :width => 400, :height => 500, :title => "Address Validation Error" do
|
82
|
+
|
83
|
+
background orange..red
|
84
|
+
|
85
|
+
if val_addr[:ResultCode] == "Error"
|
86
|
+
stack :margin => 10 do
|
87
|
+
#Dispay error details
|
88
|
+
para "RESULT: #{val_addr[:ResultCode]}"
|
89
|
+
para "SUMMARY: #{val_addr[:Summary]}"
|
90
|
+
para "DETAILS: #{val_addr[:Details]}"
|
91
|
+
para "HELP LINK: #{val_addr[:Helplink]}"
|
92
|
+
para "REFERS TO: #{val_addr[:RefersTo]}"
|
93
|
+
para "SEVERITY: #{val_addr[:Severity]}"
|
94
|
+
para "SOURCE #{val_addr[:Source]}"
|
95
|
+
end
|
96
|
+
else
|
97
|
+
#Dispay error details
|
98
|
+
para "RESULT: Error"
|
99
|
+
para "SUMMARY: Unexpected error"
|
100
|
+
para "DETAILS: An unexpected error has occurred ... please check avalog.txt for details"
|
101
|
+
end
|
102
|
+
end
|
103
|
+
end}
|
104
|
+
end
|
105
|
+
|
metadata
ADDED
@@ -0,0 +1,97 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: Avatax_AddressService
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.0.1
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Graham S Wilson
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2012-10-28 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: nokogiri
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
18
|
+
requirements:
|
19
|
+
- - ! '>='
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: 1.4.0
|
22
|
+
- - <
|
23
|
+
- !ruby/object:Gem::Version
|
24
|
+
version: '1.6'
|
25
|
+
type: :runtime
|
26
|
+
prerelease: false
|
27
|
+
version_requirements: !ruby/object:Gem::Requirement
|
28
|
+
none: false
|
29
|
+
requirements:
|
30
|
+
- - ! '>='
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: 1.4.0
|
33
|
+
- - <
|
34
|
+
- !ruby/object:Gem::Version
|
35
|
+
version: '1.6'
|
36
|
+
- !ruby/object:Gem::Dependency
|
37
|
+
name: savon
|
38
|
+
requirement: !ruby/object:Gem::Requirement
|
39
|
+
none: false
|
40
|
+
requirements:
|
41
|
+
- - ! '>='
|
42
|
+
- !ruby/object:Gem::Version
|
43
|
+
version: 2.3.0
|
44
|
+
type: :runtime
|
45
|
+
prerelease: false
|
46
|
+
version_requirements: !ruby/object:Gem::Requirement
|
47
|
+
none: false
|
48
|
+
requirements:
|
49
|
+
- - ! '>='
|
50
|
+
- !ruby/object:Gem::Version
|
51
|
+
version: 2.3.0
|
52
|
+
description: Ruby SDK provides means of communication with Avatax Web Services.
|
53
|
+
email: support@Avalara.com
|
54
|
+
executables: []
|
55
|
+
extensions: []
|
56
|
+
extra_rdoc_files: []
|
57
|
+
files:
|
58
|
+
- lib/address_log.txt
|
59
|
+
- lib/addressservice_dev.wsdl
|
60
|
+
- lib/addressservice_prd.wsdl
|
61
|
+
- lib/avatax_addressservice.rb
|
62
|
+
- lib/template_validate.erb
|
63
|
+
- lib/template_ping.erb
|
64
|
+
- lib/template_isauthorized.erb
|
65
|
+
- lib/xpath_validate.txt
|
66
|
+
- lib/xpath_ping.txt
|
67
|
+
- lib/xpath_isauthorized.txt
|
68
|
+
- test/test_address.rb
|
69
|
+
- Avatax_AddressService.gemspec
|
70
|
+
- Avatax Ruby SDK Guide.docx
|
71
|
+
- LICENSE.txt
|
72
|
+
homepage: http://www.avalara.com/
|
73
|
+
licenses: []
|
74
|
+
post_install_message: Thanks for installing the Avalara AddressService Ruby SDK. Refer
|
75
|
+
to "Avatax Ruby SDK User Guide.docx" to get started.
|
76
|
+
rdoc_options: []
|
77
|
+
require_paths:
|
78
|
+
- lib
|
79
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
80
|
+
none: false
|
81
|
+
requirements:
|
82
|
+
- - ! '>='
|
83
|
+
- !ruby/object:Gem::Version
|
84
|
+
version: 1.9.3
|
85
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
86
|
+
none: false
|
87
|
+
requirements:
|
88
|
+
- - ! '>='
|
89
|
+
- !ruby/object:Gem::Version
|
90
|
+
version: '0'
|
91
|
+
requirements: []
|
92
|
+
rubyforge_project:
|
93
|
+
rubygems_version: 1.8.24
|
94
|
+
signing_key:
|
95
|
+
specification_version: 3
|
96
|
+
summary: Ruby SDK for Avatax Address Web Services
|
97
|
+
test_files: []
|