zendesk_api 1.17.0 → 1.18.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 +4 -4
- data/lib/zendesk_api/actions.rb +35 -0
- data/lib/zendesk_api/resource.rb +4 -0
- data/lib/zendesk_api/resources.rb +3 -2
- data/lib/zendesk_api/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6245981abb291dac06ffeb8de8a5b15616ae662af15fa98bbd0602868bee842f
|
4
|
+
data.tar.gz: 07635336cd0ad32a96a936f35b5190fd61bfb21c8ed7a1e49195f5565d0f5126
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: eb77d9d24bcd8749b128d9f99a58f69bb611538b1e1b6b28580599db900aed3db309a4efda05e2edfeafb57de8fa498f3c938db0531e8efe0aaa34566e8fa683
|
7
|
+
data.tar.gz: 3f90c014afafe35b5ca52e7374e97590f245114212c305aff4de5e080c0cb14be754f13e9a7109162c75a50397bd6354c9ea26085bd4170d57f5aef7de244ef2
|
data/lib/zendesk_api/actions.rb
CHANGED
@@ -181,6 +181,41 @@ module ZendeskAPI
|
|
181
181
|
end
|
182
182
|
end
|
183
183
|
|
184
|
+
module CreateOrUpdate
|
185
|
+
# Creates or updates resource using the create_or_update endpoint.
|
186
|
+
# @param [Client] client The {Client} object to be used
|
187
|
+
# @param [Hash] attributes The attributes to create.
|
188
|
+
def create_or_update!(client, attributes, association = Association.new(:class => self))
|
189
|
+
response = client.connection.post("#{association.generate_path}/create_or_update") do |req|
|
190
|
+
req.body = { resource_name => attributes }
|
191
|
+
|
192
|
+
yield req if block_given?
|
193
|
+
end
|
194
|
+
|
195
|
+
new_from_response(client, response, Array(association.options[:include]))
|
196
|
+
end
|
197
|
+
end
|
198
|
+
|
199
|
+
module CreateOrUpdateMany
|
200
|
+
# Creates or updates multiple resources using the create_or_update_many endpoint.
|
201
|
+
#
|
202
|
+
# @param [Client] client The {Client} object to be used
|
203
|
+
# @param [Array<Hash>] attributes The attributes to update resources with
|
204
|
+
#
|
205
|
+
# @return [JobStatus] the {JobStatus} instance for this destroy job
|
206
|
+
def create_or_update_many!(client, attributes)
|
207
|
+
association = Association.new(:class => self)
|
208
|
+
|
209
|
+
response = client.connection.post("#{association.generate_path}/create_or_update_many") do |req|
|
210
|
+
req.body = { resource_name => attributes }
|
211
|
+
|
212
|
+
yield req if block_given?
|
213
|
+
end
|
214
|
+
|
215
|
+
JobStatus.new_from_response(client, response)
|
216
|
+
end
|
217
|
+
end
|
218
|
+
|
184
219
|
module Destroy
|
185
220
|
def self.included(klass)
|
186
221
|
klass.extend(ClassMethod)
|
data/lib/zendesk_api/resource.rb
CHANGED
@@ -81,6 +81,10 @@ module ZendeskAPI
|
|
81
81
|
@attributes.send(*args, &block)
|
82
82
|
end
|
83
83
|
|
84
|
+
def respond_to_missing?(method, include_private = false)
|
85
|
+
@attributes.respond_to?(method) || super
|
86
|
+
end
|
87
|
+
|
84
88
|
# Returns the resource id of the object or nil
|
85
89
|
def id
|
86
90
|
key?(:id) ? method_missing(:id) : nil
|
@@ -465,7 +465,7 @@ module ZendeskAPI
|
|
465
465
|
# @param [Integer] start_time The start_time parameter
|
466
466
|
# @return [Collection] Collection of {Ticket}
|
467
467
|
def self.incremental_export(client, start_time)
|
468
|
-
ZendeskAPI::Collection.new(client, self, :path => "
|
468
|
+
ZendeskAPI::Collection.new(client, self, :path => "incremental/tickets?start_time=#{start_time.to_i}")
|
469
469
|
end
|
470
470
|
|
471
471
|
# Imports a ticket through the imports/tickets endpoint using save!
|
@@ -649,7 +649,8 @@ module ZendeskAPI
|
|
649
649
|
|
650
650
|
class User < Resource
|
651
651
|
extend CreateMany
|
652
|
-
extend
|
652
|
+
extend CreateOrUpdate
|
653
|
+
extend CreateOrUpdateMany
|
653
654
|
extend DestroyMany
|
654
655
|
|
655
656
|
class TopicComment < TopicComment
|
data/lib/zendesk_api/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: zendesk_api
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.18.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Steven Davidovitz
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2019-
|
12
|
+
date: 2019-05-02 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: faraday
|