autotask_api 0.3.1 → 1.0.0

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e427f40e2db7c86ec2a477a1490470c8ae1074852786ca673dbd3c558ece0871
4
- data.tar.gz: ca2dbdb03f97414a7bb19ba256b34c71ecb4f4f08315cd52283996c43d5cdbac
3
+ metadata.gz: 83cff0902c46a46c023986107cc0c16f87c8fa4709a509b66eea8659edb08d19
4
+ data.tar.gz: 0e7422299809da56bad9fc0676db78d528dbd38ae40fa4cfabfcd8e29809d3e0
5
5
  SHA512:
6
- metadata.gz: f3f2b54e96213ff50185ebc6c19e961d328079425223e174c2d89c3677eb6256a006dcaeb611e7fd504eed979fa526101bc88d06f7b3023c7e1a60b45a8d3483
7
- data.tar.gz: 5c74c3cac33ace42779913072af09312ca25d2f478a46c1c641e2788b803220f7a18009a5b47d370671679f40d77d007fbbb61ff74d0364f78330895883163b3
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:
@@ -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
- wsdl: config.wsdl,
25
- logger: Rails.logger,
26
- log_level: :debug,
27
- log: config.debug,
28
- basic_auth: [config.username, config.password]
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(operation, message: message, attributes: { xmlns: NAMESPACE })
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
@@ -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.5/atws.wsdl'
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
@@ -23,14 +23,16 @@ module AutotaskApi
23
23
  def query_string
24
24
  Nokogiri::XML::Builder.new do
25
25
  sXML do
26
- cdata(Nokogiri::XML::Builder.new do |xml|
27
- xml.queryxml do
28
- xml.entity entity
29
- xml.query do
30
- condition.to_xml(xml)
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
- end.doc.root)
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 operator: operator do
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
@@ -1,3 +1,3 @@
1
1
  module AutotaskApi
2
- VERSION = '0.3.1'
2
+ VERSION = '1.0.0'
3
3
  end
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.3.1
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: 2018-08-29 00:00:00.000000000 Z
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
- rubyforge_project:
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