autotask_api 0.3.1 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +2 -0
- data/lib/autotask_api/client.rb +23 -8
- data/lib/autotask_api/config.rb +2 -2
- data/lib/autotask_api/query.rb +11 -9
- data/lib/autotask_api/version.rb +1 -1
- metadata +3 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 83cff0902c46a46c023986107cc0c16f87c8fa4709a509b66eea8659edb08d19
|
4
|
+
data.tar.gz: 0e7422299809da56bad9fc0676db78d528dbd38ae40fa4cfabfcd8e29809d3e0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 79204d2fbec5782765b55b5b8c3e56d01943809ce27bb0337aa9258e18613827a28e6c437992e248cc48af2f032ee47eb3b5b602657596e11f6deb5876197e60
|
7
|
+
data.tar.gz: 1d72a4b425dcf5320f4c101bd5e0ad0f7095a1f1c6b569b5bf76f88a03861979dfdf4981e28a90e070cc674491d9beab9b6188bb6f02cd1410fdca90e8d01984
|
data/README.md
CHANGED
@@ -23,6 +23,8 @@ $ gem install autotask_api
|
|
23
23
|
|
24
24
|
## Query
|
25
25
|
|
26
|
+
See the "Query XML elements and attributes" section of the [Autotask API Users Guide](https://ww4.autotask.net/help/Content/LinkedDOCUMENTS/WSAPI/T_WebServicesAPIv1_5.pdf) for more information.
|
27
|
+
|
26
28
|
### Simple field test
|
27
29
|
|
28
30
|
SQL:
|
data/lib/autotask_api/client.rb
CHANGED
@@ -9,8 +9,7 @@ module AutotaskApi
|
|
9
9
|
end
|
10
10
|
|
11
11
|
class Client
|
12
|
-
|
13
|
-
NAMESPACE = 'http://autotask.net/ATWS/v1_5/'
|
12
|
+
NAMESPACE = 'http://autotask.net/ATWS/v1_6/'
|
14
13
|
|
15
14
|
attr_reader :config
|
16
15
|
|
@@ -21,17 +20,33 @@ module AutotaskApi
|
|
21
20
|
|
22
21
|
def savon_client
|
23
22
|
@savon_client ||= Savon.client(
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
23
|
+
wsdl: config.wsdl,
|
24
|
+
logger: Rails.logger,
|
25
|
+
log_level: :debug,
|
26
|
+
log: config.debug,
|
27
|
+
basic_auth: [config.username, config.password],
|
28
|
+
soap_header: soap_header
|
29
29
|
)
|
30
30
|
end
|
31
31
|
|
32
32
|
def call(operation, message = {})
|
33
|
-
savon_client.call(
|
33
|
+
savon_client.call(
|
34
|
+
operation,
|
35
|
+
message: message,
|
36
|
+
attributes: { xmlns: NAMESPACE }
|
37
|
+
)
|
34
38
|
end
|
35
39
|
|
40
|
+
def soap_header
|
41
|
+
return nil unless config.integration_code
|
42
|
+
|
43
|
+
xml = Nokogiri::XML::Builder.new do |xml|
|
44
|
+
xml.AutotaskIntegrations xmlns: NAMESPACE do
|
45
|
+
xml.IntegrationCode config.integration_code
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
xml.doc.root.to_s
|
50
|
+
end
|
36
51
|
end
|
37
52
|
end
|
data/lib/autotask_api/config.rb
CHANGED
@@ -13,10 +13,10 @@ module AutotaskApi
|
|
13
13
|
end
|
14
14
|
|
15
15
|
class Configuration
|
16
|
-
attr_accessor :wsdl, :username, :password, :read_timeout, :open_timeout, :debug
|
16
|
+
attr_accessor :wsdl, :username, :password, :read_timeout, :open_timeout, :debug, :integration_code
|
17
17
|
|
18
18
|
def initialize
|
19
|
-
@wsdl = 'https://webservices.autotask.net/atservices/1.
|
19
|
+
@wsdl = 'https://webservices.autotask.net/atservices/1.6/atws.wsdl'
|
20
20
|
@read_timeout = 30
|
21
21
|
@open_timeout = 30
|
22
22
|
@debug = false
|
data/lib/autotask_api/query.rb
CHANGED
@@ -23,14 +23,16 @@ module AutotaskApi
|
|
23
23
|
def query_string
|
24
24
|
Nokogiri::XML::Builder.new do
|
25
25
|
sXML do
|
26
|
-
cdata(
|
27
|
-
|
28
|
-
xml.
|
29
|
-
|
30
|
-
|
26
|
+
cdata(
|
27
|
+
Nokogiri::XML::Builder.new do |xml|
|
28
|
+
xml.queryxml do
|
29
|
+
xml.entity entity
|
30
|
+
xml.query do
|
31
|
+
condition.to_xml(xml)
|
32
|
+
end
|
31
33
|
end
|
32
|
-
end
|
33
|
-
|
34
|
+
end.doc.root
|
35
|
+
)
|
34
36
|
end
|
35
37
|
end.doc.root.to_s
|
36
38
|
end
|
@@ -47,7 +49,7 @@ module AutotaskApi
|
|
47
49
|
end
|
48
50
|
|
49
51
|
def to_xml(xml)
|
50
|
-
xml.condition
|
52
|
+
xml.condition do
|
51
53
|
expressions.each { |expression| expression.to_xml(xml) }
|
52
54
|
end
|
53
55
|
end
|
@@ -65,7 +67,7 @@ module AutotaskApi
|
|
65
67
|
expression.is_a?(Condition) ? expression.remove_expression_by_field(field) : expression.field == field
|
66
68
|
end
|
67
69
|
end
|
68
|
-
|
70
|
+
|
69
71
|
end
|
70
72
|
|
71
73
|
class Expression
|
data/lib/autotask_api/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: autotask_api
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 1.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kevin Pheasey
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2020-02-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: nokogiri
|
@@ -87,8 +87,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
87
87
|
- !ruby/object:Gem::Version
|
88
88
|
version: '0'
|
89
89
|
requirements: []
|
90
|
-
|
91
|
-
rubygems_version: 2.7.6
|
90
|
+
rubygems_version: 3.0.6
|
92
91
|
signing_key:
|
93
92
|
specification_version: 4
|
94
93
|
summary: Autotask API wrapper
|