zendesk_api 1.17.0 → 1.18.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: f809ed03e4d7a4ffd14d1963e9e77b54a6e769337784eb3491c8a52e5b2e4358
4
- data.tar.gz: 816dbb0310089ace43b266571e65cdfa7077e20427603d5fc64f33d4aebc662b
3
+ metadata.gz: 6245981abb291dac06ffeb8de8a5b15616ae662af15fa98bbd0602868bee842f
4
+ data.tar.gz: 07635336cd0ad32a96a936f35b5190fd61bfb21c8ed7a1e49195f5565d0f5126
5
5
  SHA512:
6
- metadata.gz: fae6bb741cd9dc9b7c8ed4cb9b6d82df0f6a5ff7815e0504789a870f3b206dd12c93ac9cf23ce42241f6acd6a3622fa2c3615f8be4365ffbebae81fa1527697e
7
- data.tar.gz: da116bc6980c980d6278eb17abf3c48fd1256fe550d785496c8a8116184433f243c013827bb41af52cddf847e9e1e80f6aa445b3df363fb22f153e2e21b238af
6
+ metadata.gz: eb77d9d24bcd8749b128d9f99a58f69bb611538b1e1b6b28580599db900aed3db309a4efda05e2edfeafb57de8fa498f3c938db0531e8efe0aaa34566e8fa683
7
+ data.tar.gz: 3f90c014afafe35b5ca52e7374e97590f245114212c305aff4de5e080c0cb14be754f13e9a7109162c75a50397bd6354c9ea26085bd4170d57f5aef7de244ef2
@@ -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)
@@ -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 => "exports/tickets?start_time=#{start_time.to_i}")
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 UpdateMany
652
+ extend CreateOrUpdate
653
+ extend CreateOrUpdateMany
653
654
  extend DestroyMany
654
655
 
655
656
  class TopicComment < TopicComment
@@ -1,3 +1,3 @@
1
1
  module ZendeskAPI
2
- VERSION = "1.17.0"
2
+ VERSION = "1.18.0"
3
3
  end
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.17.0
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-03-14 00:00:00.000000000 Z
12
+ date: 2019-05-02 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: faraday