autotask_ruby 0.1.0 → 2.0.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 3a7ad34429eb41909dc0182250592d4912aa0537099a206b4d59f47d71786784
4
- data.tar.gz: 8d3e4ca3b363e9bf3bb72fb79f51a1693a42f7b10f04a38ca220af62d2178c72
3
+ metadata.gz: 508e05d8468713f8dd50ce98719c0b1ff139a0935459be0cc0ed08fffc14451b
4
+ data.tar.gz: '09592b92714f90db2f070fa5487eed58853418b55ff3df40c8f257508573780f'
5
5
  SHA512:
6
- metadata.gz: a8f742c6bc21caf1e510f472fb7019297e0066cc5e61e914b0d4703e0e1040cff8bd476049c7afee1b533dd4d7744dfbadfa67c1cc49aa463f37f469e6ec9527
7
- data.tar.gz: 34bd4b992cf23590ea7807aa7f667aa4b24267ab345ac55d6f1b5331721e299efe50583e6ca94a2c5a0c1bf76298d1ad501fde651dd01a09bbe774ed78e8e770
6
+ metadata.gz: 41947b77a8ed8f45bdbe1ae1b37ced6da2938180373913fc6ef5c2beb93e523cd4ef18655b431a3deeb4f6a61fe27a488cd9cd75ec7c5d081ec383e552502fbb
7
+ data.tar.gz: 63ce5fe9e0eb34f7fde68233fc4d413fee9b90c40493c9971b5c97e289fcb63fabd45a8f3be87a52e6cdffa31d9186ccf4b1a0f4534340f31729924b69dc5ab2
@@ -1,7 +1,7 @@
1
1
  require: rubocop-rspec
2
2
 
3
3
  Metrics/LineLength:
4
- Max: 160
4
+ Max: 120
5
5
 
6
6
  Layout/IndentationWidth:
7
- Width: 4
7
+ Width: 2
@@ -1 +1,2 @@
1
- ruby-2.5.3
1
+ ruby-2.6.4
2
+
@@ -2,35 +2,36 @@ PATH
2
2
  remote: .
3
3
  specs:
4
4
  autotask_ruby (0.1.0)
5
- activesupport (~> 5.2)
6
- savon (~> 2.12)
5
+ activesupport
6
+ savon
7
7
 
8
8
  GEM
9
9
  remote: https://rubygems.org/
10
10
  specs:
11
- activesupport (5.2.2)
11
+ activesupport (6.0.2.1)
12
12
  concurrent-ruby (~> 1.0, >= 1.0.2)
13
13
  i18n (>= 0.7, < 2)
14
14
  minitest (~> 5.1)
15
15
  tzinfo (~> 1.1)
16
- addressable (2.5.2)
17
- public_suffix (>= 2.0.2, < 4.0)
16
+ zeitwerk (~> 2.2)
17
+ addressable (2.7.0)
18
+ public_suffix (>= 2.0.2, < 5.0)
18
19
  akami (1.3.1)
19
20
  gyoku (>= 0.4.0)
20
21
  nokogiri
21
22
  ast (2.4.0)
22
23
  awesome_print (1.8.0)
23
- builder (3.2.3)
24
- byebug (10.0.2)
24
+ builder (3.2.4)
25
+ byebug (11.1.1)
25
26
  coderay (1.1.2)
26
- concurrent-ruby (1.1.4)
27
+ concurrent-ruby (1.1.5)
27
28
  crack (0.4.3)
28
29
  safe_yaml (~> 1.0.0)
29
30
  diff-lcs (1.3)
30
- dotenv (2.5.0)
31
- ffi (1.9.25)
31
+ dotenv (2.7.5)
32
+ ffi (1.12.2)
32
33
  formatador (0.2.5)
33
- guard (2.15.0)
34
+ guard (2.16.1)
34
35
  formatador (>= 0.2.4)
35
36
  listen (>= 2.7, < 4.0)
36
37
  lumberjack (>= 1.0.12, < 2.0)
@@ -46,68 +47,64 @@ GEM
46
47
  rspec (>= 2.99.0, < 4.0)
47
48
  gyoku (1.3.1)
48
49
  builder (>= 2.1.2)
49
- hashdiff (0.3.8)
50
+ hashdiff (1.0.0)
50
51
  httpi (2.4.4)
51
52
  rack
52
53
  socksify
53
- i18n (1.4.0)
54
+ i18n (1.8.2)
54
55
  concurrent-ruby (~> 1.0)
55
- jaro_winkler (1.5.1)
56
- listen (3.1.5)
57
- rb-fsevent (~> 0.9, >= 0.9.4)
58
- rb-inotify (~> 0.9, >= 0.9.7)
59
- ruby_dep (~> 1.2)
60
- lumberjack (1.0.13)
56
+ jaro_winkler (1.5.4)
57
+ listen (3.2.1)
58
+ rb-fsevent (~> 0.10, >= 0.10.3)
59
+ rb-inotify (~> 0.9, >= 0.9.10)
60
+ lumberjack (1.2.4)
61
61
  method_source (0.9.2)
62
62
  mini_portile2 (2.4.0)
63
- minitest (5.11.3)
63
+ minitest (5.14.0)
64
64
  nenv (0.3.0)
65
- nokogiri (1.9.1)
65
+ nokogiri (1.10.7)
66
66
  mini_portile2 (~> 2.4.0)
67
67
  nori (2.6.0)
68
- notiffany (0.1.1)
68
+ notiffany (0.1.3)
69
69
  nenv (~> 0.1)
70
70
  shellany (~> 0.0)
71
- parallel (1.12.1)
72
- parser (2.5.3.0)
71
+ parallel (1.19.1)
72
+ parser (2.7.0.2)
73
73
  ast (~> 2.4.0)
74
- powerpack (0.1.2)
75
74
  pry (0.12.2)
76
75
  coderay (~> 1.1.0)
77
76
  method_source (~> 0.9.0)
78
- public_suffix (3.0.3)
79
- rack (2.0.6)
77
+ public_suffix (4.0.3)
78
+ rack (2.2.1)
80
79
  rainbow (3.0.0)
81
- rake (12.3.2)
80
+ rake (13.0.1)
82
81
  rb-fsevent (0.10.3)
83
- rb-inotify (0.10.0)
82
+ rb-inotify (0.10.1)
84
83
  ffi (~> 1.0)
85
- rspec (3.8.0)
86
- rspec-core (~> 3.8.0)
87
- rspec-expectations (~> 3.8.0)
88
- rspec-mocks (~> 3.8.0)
89
- rspec-core (3.8.0)
90
- rspec-support (~> 3.8.0)
91
- rspec-expectations (3.8.2)
84
+ rspec (3.9.0)
85
+ rspec-core (~> 3.9.0)
86
+ rspec-expectations (~> 3.9.0)
87
+ rspec-mocks (~> 3.9.0)
88
+ rspec-core (3.9.1)
89
+ rspec-support (~> 3.9.1)
90
+ rspec-expectations (3.9.0)
92
91
  diff-lcs (>= 1.2.0, < 2.0)
93
- rspec-support (~> 3.8.0)
94
- rspec-mocks (3.8.0)
92
+ rspec-support (~> 3.9.0)
93
+ rspec-mocks (3.9.1)
95
94
  diff-lcs (>= 1.2.0, < 2.0)
96
- rspec-support (~> 3.8.0)
97
- rspec-support (3.8.0)
98
- rubocop (0.62.0)
95
+ rspec-support (~> 3.9.0)
96
+ rspec-support (3.9.2)
97
+ rubocop (0.79.0)
99
98
  jaro_winkler (~> 1.5.1)
100
99
  parallel (~> 1.10)
101
- parser (>= 2.5, != 2.5.1.1)
102
- powerpack (~> 0.1)
100
+ parser (>= 2.7.0.1)
103
101
  rainbow (>= 2.2.2, < 4.0)
104
102
  ruby-progressbar (~> 1.7)
105
- unicode-display_width (~> 1.4.0)
106
- rubocop-rspec (1.31.0)
107
- rubocop (>= 0.60.0)
108
- ruby-progressbar (1.10.0)
109
- ruby_dep (1.5.0)
110
- safe_yaml (1.0.4)
103
+ unicode-display_width (>= 1.4.0, < 1.7)
104
+ rubocop-rspec (1.37.1)
105
+ rubocop (>= 0.68.1)
106
+ ruby-progressbar (1.10.1)
107
+ safe_yaml (1.0.5)
111
108
  savon (2.12.0)
112
109
  akami (~> 1.2)
113
110
  builder (>= 2.1.2)
@@ -118,35 +115,36 @@ GEM
118
115
  wasabi (~> 3.4)
119
116
  shellany (0.0.1)
120
117
  socksify (1.7.1)
121
- thor (0.20.3)
118
+ thor (1.0.1)
122
119
  thread_safe (0.3.6)
123
- tzinfo (1.2.5)
120
+ tzinfo (1.2.6)
124
121
  thread_safe (~> 0.1)
125
- unicode-display_width (1.4.1)
122
+ unicode-display_width (1.6.1)
126
123
  wasabi (3.5.0)
127
124
  httpi (~> 2.0)
128
125
  nokogiri (>= 1.4.2)
129
- webmock (3.5.1)
126
+ webmock (3.8.1)
130
127
  addressable (>= 2.3.6)
131
128
  crack (>= 0.3.2)
132
- hashdiff
129
+ hashdiff (>= 0.4.0, < 2.0.0)
130
+ zeitwerk (2.2.2)
133
131
 
134
132
  PLATFORMS
135
133
  ruby
136
134
 
137
135
  DEPENDENCIES
138
136
  autotask_ruby!
139
- awesome_print (~> 1.8)
140
- bundler (~> 1.17)
141
- byebug (~> 10.0)
142
- dotenv (~> 2.5)
143
- guard (~> 2.15)
144
- guard-rspec (~> 4.7)
145
- rake (~> 12.3)
146
- rspec (~> 3.8)
147
- rubocop (~> 0.62)
148
- rubocop-rspec (~> 1.31)
149
- webmock (~> 3.5)
137
+ awesome_print
138
+ bundler
139
+ byebug
140
+ dotenv
141
+ guard
142
+ guard-rspec
143
+ rake
144
+ rspec
145
+ rubocop
146
+ rubocop-rspec
147
+ webmock
150
148
 
151
149
  BUNDLED WITH
152
- 1.17.1
150
+ 2.1.2
@@ -9,11 +9,13 @@ require 'nokogiri'
9
9
  require 'autotask_ruby/configuration'
10
10
  require 'autotask_ruby/constants'
11
11
  require 'autotask_ruby/query'
12
+ require 'autotask_ruby/query_xml'
12
13
  require 'autotask_ruby/association'
13
14
  require 'autotask_ruby/response'
14
15
  require 'autotask_ruby/query_response'
15
16
  require 'autotask_ruby/create_response'
16
17
  require 'autotask_ruby/delete_response'
18
+ require 'autotask_ruby/update_response'
17
19
  require 'autotask_ruby/zone_info'
18
20
  require 'autotask_ruby/entity'
19
21
  require 'autotask_ruby/client'
@@ -22,6 +24,7 @@ require 'autotask_ruby/account'
22
24
  require 'autotask_ruby/contact'
23
25
  require 'autotask_ruby/account_to_do'
24
26
  require 'autotask_ruby/appointment'
27
+ require 'autotask_ruby/action_type'
25
28
  require 'autotask_ruby/task'
26
29
  require 'autotask_ruby/ticket'
27
30
  require 'autotask_ruby/project'
@@ -1,14 +1,13 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module AutotaskRuby
4
- # Represents the Autotask Account Entity
5
- class Account
6
- include Entity
7
-
8
- FIELDS = %i[id Address1 City Country CreateDate AccountName AccountNumber Phone PostalCode State Active].freeze
9
- .each do |field|
10
- self.attr_accessor :"#{field.to_s.underscore}"
11
- end
4
+ # Represents the Autotask Account Entity
5
+ class Account
6
+ include Entity
12
7
 
8
+ FIELDS = %i[id Address1 City Country CreateDate AccountName AccountNumber Phone PostalCode State Active].freeze
9
+ .each do |field|
10
+ attr_accessor :"#{field.to_s.underscore}"
13
11
  end
12
+ end
14
13
  end
@@ -1,20 +1,29 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module AutotaskRuby
4
- # Represents the Autotask AccountToDo entity
5
- class AccountToDo
6
- include AutotaskRuby::Entity
7
- include AutotaskRuby::Query
4
+ # Represents the Autotask AccountToDo entity
5
+ class AccountToDo
6
+ include AutotaskRuby::Entity
7
+ include AutotaskRuby::Query
8
8
 
9
- FIELDS = %i[id AccountID ContactID ActivityDescription StartDateTime EndDateTime
10
- AssignedToResourceID ActionType CreateDateTime LastModifiedDate].freeze
11
- .each do |field|
12
- self.attr_accessor :"#{field.to_s.underscore}"
13
- end
9
+ FIELDS = %i[id AccountID ContactID ActivityDescription StartDateTime EndDateTime
10
+ AssignedToResourceID CreateDateTime LastModifiedDate ActionType].freeze
11
+ .each do |field|
12
+ attr_accessor :"#{field.to_s.underscore}"
13
+ end
14
+
15
+ def post_initialize
16
+ belongs_to :resource
17
+ belongs_to :account
18
+ end
14
19
 
15
- def post_initialize
16
- belongs_to :resource
17
- belongs_to :account
18
- end
20
+ def contact
21
+ find('Contact', contact_id)
19
22
  end
23
+
24
+ def action
25
+ find('ActionType', action_type)
26
+ end
27
+
28
+ end
20
29
  end
@@ -1,13 +1,13 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module AutotaskRuby
4
- # Represents the Autotask Entity Action Type
5
- class ActionType
6
- include Entity
4
+ # Represents the Autotask Entity Action Type
5
+ class ActionType
6
+ include Entity
7
7
 
8
- FIELDS = %i[id Name View Active SystemActionType].freeze
9
- .each do |field|
10
- self.attr_accessor :"#{field.to_s.underscore}"
11
- end
8
+ FIELDS = %i[id Name View Active SystemActionType].freeze
9
+ .each do |field|
10
+ attr_accessor :"#{field.to_s.underscore}"
12
11
  end
12
+ end
13
13
  end
@@ -1,20 +1,17 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module AutotaskRuby
4
+ # Represents an AutoTask Appointment Entity
5
+ class Appointment
6
+ include Entity
4
7
 
5
- # Represents an AutoTask Appointment Entity
6
- class Appointment
7
- include Entity
8
-
9
- FIELDS = %i[id Title Description ResourceID StartDateTime EndDateTime CreateDateTime UpdateDateTime].freeze
10
- .each do |field|
11
- self.attr_accessor :"#{field.to_s.underscore}"
12
- end
13
-
14
- def post_initialize
15
- belongs_to :resource
16
- end
17
-
8
+ FIELDS = %i[id Title Description ResourceID StartDateTime EndDateTime CreateDateTime UpdateDateTime].freeze
9
+ .each do |field|
10
+ attr_accessor :"#{field.to_s.underscore}"
18
11
  end
19
12
 
13
+ def post_initialize
14
+ belongs_to :resource
15
+ end
16
+ end
20
17
  end
@@ -1,38 +1,40 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module AutotaskRuby
2
- # handles loading associated entities.
3
- module Association
4
- # loads parent entity.
5
- # Thanks to scoop for this example.
6
- def belongs_to(name, options = {})
7
- name = name.to_s
8
- klass = "#{(options[:class_name] || name).to_s.classify}"
9
- foreign_key = name.foreign_key
10
- define_singleton_method(name) do
11
- find(klass, send(foreign_key))
12
- end
13
- end
4
+ # handles loading associated entities.
5
+ module Association
6
+ # loads parent entity.
7
+ # Thanks to scoop for this example.
8
+ def belongs_to(name, options = {})
9
+ name = name.to_s
10
+ klass = (options[:class_name] || name).to_s.classify.to_s
11
+ foreign_key = name.foreign_key
12
+ define_singleton_method(name) do
13
+ find(klass, send(foreign_key))
14
+ end
15
+ end
14
16
 
15
- # Example, an appointment can have one contact.
16
- # Thanks to scoop for this example.
17
- def has_one(name, options = {})
18
- name = name.to_s
19
- options.reverse_merge! foreign_key: self.to_s.foreign_key.camelize
20
- klass = "#{(options[:class_name] || name).to_s.classify}"
21
- define_singleton_method(name) do
22
- find(klass, options[:foreign_key], id).first
23
- end
24
- end
17
+ # Example, an appointment can have one contact.
18
+ # Thanks to scoop for this example.
19
+ def has_one(name, options = {})
20
+ name = name.to_s
21
+ options.reverse_merge! foreign_key: to_s.foreign_key.camelize
22
+ klass = (options[:class_name] || name).to_s.classify.to_s
23
+ define_singleton_method(name) do
24
+ find(klass, options[:foreign_key], id).first
25
+ end
26
+ end
25
27
 
26
- # loads child entities.
27
- # Example: A project can have many tasks.
28
- # Thanks to scoop for this example.
29
- def has_many(name, options = {})
30
- name = name.to_s
31
- options.reverse_merge! foreign_key: self.to_s.foreign_key.camelize
32
- klass = "#{(options[:class_name] || name).to_s.classify}"
33
- define_singleton_method(name) do
34
- query(klass, options[:foreign_key], id)
35
- end
36
- end
28
+ # loads child entities.
29
+ # Example: A project can have many tasks.
30
+ # Thanks to scoop for this example.
31
+ def has_many(name, options = {})
32
+ name = name.to_s
33
+ options.reverse_merge! foreign_key: to_s.foreign_key.camelize
34
+ klass = (options[:class_name] || name).to_s.classify.to_s
35
+ define_singleton_method(name) do
36
+ query(klass, options[:foreign_key], id)
37
+ end
37
38
  end
39
+ end
38
40
  end
@@ -4,88 +4,106 @@ require 'autotask_ruby/version'
4
4
  require 'autotask_ruby/resource'
5
5
 
6
6
  module AutotaskRuby
7
+ # the primary client that interfaces with the SOAP Client that will interface with AutoTask.
8
+ class Client
9
+ attr_accessor :soap_client, :headers, :logger
7
10
 
8
- # the primary client that interfaces with the SOAP Client that will interface with AutoTask.
9
- class Client
10
- attr_accessor :soap_client, :headers, :logger
11
-
12
- def initialize(options = {})
13
- @version = options[:version] || AutotaskRuby.configuration.version
14
- integration_code = options[:integration_code] || AutotaskRuby.configuration.integration_code
15
- @headers = {
16
- 'tns:AutotaskIntegrations' =>
17
- {
18
- 'tns:IntegrationCode' => integration_code
19
- }
11
+ def initialize(options = {})
12
+ @version = options[:version] || AutotaskRuby.configuration.version
13
+ integration_code = options[:integration_code] || AutotaskRuby.configuration.integration_code
14
+ @headers = {
15
+ 'tns:AutotaskIntegrations' =>
16
+ {
17
+ 'tns:IntegrationCode' => integration_code
20
18
  }
19
+ }
21
20
 
22
- @ssl_version = options[:ssl_version] || :TLSv1_2
23
-
24
- @host = options[:host] || 'webservices.autotask.net'
25
- @endpoint = options[:endpoint] || "https://#{@host}/ATServices/#{@version}/atws.asmx"
26
-
27
- # Override optional Savon attributes
28
- savon_options = {}
29
- %w[read_timeout open_timeout proxy raise_errors log_level basic_auth log raise_errors].each do |prop|
30
- key = prop.to_sym
31
- savon_options[key] = options[key] if options.key?(key)
32
- end
33
-
34
- @soap_client = Savon.client({
35
- wsdl: './atws.wsdl',
36
- soap_header: @headers,
37
- namespaces: { xmlns: AutotaskRuby.configuration.namespace },
38
- logger: Logger.new($stdout),
39
- raise_errors: false,
40
- log: true,
41
- endpoint: @endpoint,
42
- ssl_version: @ssl_version # Sets ssl_version for HTTPI adapter
43
- }.update(savon_options))
44
- end
45
-
46
- # Public: Get the names of all wsdl operations.
47
- # List all available operations from the atws.wsdl
48
- def operations
49
- @soap_client.operations
50
- end
51
-
52
- # @param entity, id
53
- # pass in the entity_type, I.E. AccountToDo, Resource, etc. and the ID of the entity.
54
- # @return Entity
55
- # Returns a single Entity if a match was found.
56
- # Returns nil if no match is found.
57
- def find(entity, id)
58
- response = query(entity.to_s, id)
59
-
60
- return nil if response.entities.empty?
61
-
62
- response.entities.first
63
- end
64
-
65
- # @param entity_type and value
66
- # Other parameters, are optional.
67
- # full set of parameters include entity_type, field, operation, value.
68
- # Queries the Autotask QUERY API. Returns a QueryResponse result set.
69
- # @return AutotaskRuby::Response.
70
- def query(entity_type, field = 'id', operation = 'equals', value)
71
- result = @soap_client.call(:query, message: "<sXML><![CDATA[<queryxml><entity>#{entity_type}</entity><query><field>#{field}<expression op=\"#{operation}\">#{value}</expression></field></query></queryxml>]]></sXML>")
72
- AutotaskRuby::QueryResponse.new(self, result)
73
- end
74
-
75
- # @param entity_type
76
- # include the entity type. ServiceCall, Appointment, etc.
77
- # @param ids
78
- # One or more entity ID's that should be deleted.
79
- # @return
80
- # AutotaskRuby::DeleteResponse
81
- def delete(entity_type, *ids)
82
- entities = ++''
83
- ids.each do |id|
84
- entities << "<Entity xsi:type=\"#{entity_type}\"><id xsi:type=\"xsd:int\">#{id}</id></Entity>"
85
- end
86
- resp = @soap_client.call(:delete, message: "<Entities>#{entities.to_s}</Entities>")
87
- AutotaskRuby::DeleteResponse.new(@client, resp)
88
- end
21
+ @ssl_version = options[:ssl_version] || :TLSv1_2
89
22
 
23
+ @host = options[:host] || 'webservices.autotask.net'
24
+ @endpoint = options[:endpoint] || "https://#{@host}/ATServices/#{@version}/atws.asmx"
25
+
26
+ # Override optional Savon attributes
27
+ savon_options = {}
28
+ %w[read_timeout open_timeout proxy raise_errors log_level basic_auth log raise_errors].each do |prop|
29
+ key = prop.to_sym
30
+ savon_options[key] = options[key] if options.key?(key)
31
+ end
32
+
33
+ @soap_client = Savon.client({
34
+ wsdl: './atws.wsdl',
35
+ soap_header: @headers,
36
+ namespaces: { xmlns: AutotaskRuby.configuration.namespace },
37
+ logger: Logger.new($stdout),
38
+ raise_errors: false,
39
+ log: true,
40
+ endpoint: @endpoint,
41
+ ssl_version: @ssl_version # Sets ssl_version for HTTPI adapter
42
+ }.update(savon_options))
43
+ end
44
+
45
+ # Public: Get the names of all wsdl operations.
46
+ # List all available operations from the atws.wsdl
47
+ def operations
48
+ @soap_client.operations
49
+ end
50
+
51
+ # @param entity, id
52
+ # pass in the entity_type, I.E. AccountToDo, Resource, etc. and the ID of the entity.
53
+ # @return Entity
54
+ # Returns a single Entity if a match was found.
55
+ # Returns nil if no match is found.
56
+ def find(entity, id)
57
+ response = query(entity.to_s, id)
58
+
59
+ return nil if response.entities.empty?
60
+
61
+ response.entities.first
62
+ end
63
+
64
+ # @param entity_type and value
65
+ # Other parameters, are optional.
66
+ # full set of parameters include entity_type, field, operation, value.
67
+ # Queries the Autotask QUERY API. Returns a QueryResponse result set.
68
+ # @return AutotaskRuby::Response.
69
+ def query(entity_type, field = 'id', operation = 'equals', value)
70
+ result = @soap_client.call(:query, message: "<sXML><![CDATA[<queryxml><entity>#{entity_type}</entity><query><field>#{field}<expression op=\"#{operation}\">#{value}</expression></field></query></queryxml>]]></sXML>")
71
+ AutotaskRuby::QueryResponse.new(self, result)
72
+ end
73
+
74
+ # @param entity_type
75
+ # include the entity type. ServiceCall, Appointment, etc.
76
+ # @param ids
77
+ # One or more entity ID's that should be deleted.
78
+ # @return
79
+ # AutotaskRuby::DeleteResponse
80
+ def delete(entity_type, *ids)
81
+ entities = ++''
82
+ ids.each do |id|
83
+ entities << "<Entity xsi:type=\"#{entity_type}\"><id xsi:type=\"xsd:int\">#{id}</id></Entity>"
84
+ end
85
+ resp = @soap_client.call(:delete, message: "<Entities>#{entities}</Entities>")
86
+ AutotaskRuby::DeleteResponse.new(@client, resp)
87
+ end
88
+
89
+ def query_for(message)
90
+ result = @soap_client.call(:query, message: message)
91
+ AutotaskRuby::QueryResponse.new(self, result)
92
+ end
93
+
94
+ # updates the entity in the AutoTask API.
95
+ # All fields are iterated and this builds the XML message that is sent to AutoTask.
96
+ # Any field that is not filled out will be sent as empty. This means that it will wipe
97
+ # any value that AutoTask has for that field.
98
+ def update(entity_xml)
99
+ result = @soap_client.call(:update, message: "<Entities>#{entity_xml}</Entities>")
100
+ UpdateResponse.new(@client, result)
101
+ end
102
+
103
+ # creates an entity in AutoTask.
104
+ def create(entity_xml)
105
+ result = @soap_client.call(:create, message: "<Entities>#{entity_xml}</Entities>")
106
+ CreateResponse.new(@client, result)
90
107
  end
108
+ end
91
109
  end