zendesk_api 3.0.4 → 3.1.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: 8b226059359e4f834ccada53be52fbe72e0d73c26aa045fcfd011bd8afe3c1c2
4
- data.tar.gz: c006d69a0b16716c7f093cd5a14454652661d4234f9a515a6a7724f977145c89
3
+ metadata.gz: df2d68422fdea92cfac956254ddd2b382faf6e028bc7523c7211edcbdd12eb6e
4
+ data.tar.gz: a3fb793d37568e24dc458b4a015687f4d6b885547624736e83245c4cdb4073ec
5
5
  SHA512:
6
- metadata.gz: 9080f2d1cb5c4fae6145c37dfe2fa4e3e81c1bd3afa1d565cd41e350e36b97dff9247c9a5028f3e78e27c1516fe406df80980a21c60b3f716898bcaddb026b0e
7
- data.tar.gz: e616e3ee6b1ba647952265b5dad953181eaeb5940d6954d37cfe1934232df7abb4547d8de7cbc22dc9dcceda1d849c6c103fc87f85514cba42e64e2cf48f6c50
6
+ metadata.gz: 0f54c0063c888c850a1fd8531499f1a18d1b34e659735c331b43a9e5996f1719fbc3326d6203ef26cb82b8d1143a15a109bdba238cf5d4c8dd4b33ff9c39eaff
7
+ data.tar.gz: a01bc6bcfdc1d0c3e7d738102802e4d17958f2c9a98003348491c9c45a18ccea6dced47d355f4c9464fbbc9c57d5df0c2993e54eca05c82c3ab4de6c4abd67d1
@@ -16,6 +16,58 @@ module ZendeskAPI
16
16
 
17
17
  class CustomRole < DataResource; end
18
18
 
19
+ class WorkItem < Resource; end
20
+
21
+ class Channel < Resource
22
+ def work_items
23
+ @work_items ||= attributes.fetch('relationships', {}).fetch('work_items', {}).fetch('data', []).map do |work_item_attributes|
24
+ WorkItem.new(@client, work_item_attributes)
25
+ end
26
+ end
27
+ end
28
+
29
+ # client.agent_availabilities.fetch
30
+ # client.agent_availabilities.find 20401208368
31
+ # both return consistently - ZendeskAPI::AgentAvailability
32
+ class AgentAvailability < DataResource
33
+ def self.model_key
34
+ "data"
35
+ end
36
+
37
+ def initialize(client, attributes = {})
38
+ nested_attributes = attributes.delete('attributes')
39
+ super(client, attributes.merge(nested_attributes))
40
+ end
41
+
42
+ def self.find(client, id)
43
+ attributes = client.connection.get("#{resource_path}/#{id}").body.fetch(model_key, {})
44
+ new(client, attributes)
45
+ end
46
+
47
+ # Examples:
48
+ # ZendeskAPI::AgentAvailability.search(client, { channel_status: 'support:online' })
49
+ # ZendeskAPI::AgentAvailability.search(client, { agent_status_id: 1 })
50
+ # Just pass a hash that includes the key and value you want to search for, it gets turned into a query string
51
+ # on the format of filter[key]=value
52
+ # Returns a collection of AgentAvailability objects
53
+ def self.search(client, args_hash)
54
+ query_string = args_hash.map { |k, v| "filter[#{k}]=#{v}" }.join("&")
55
+ client.connection.get("#{resource_path}?#{query_string}").body.fetch(model_key, []).map do |attributes|
56
+ new(client, attributes)
57
+ end
58
+ end
59
+
60
+ def channels
61
+ @channels ||= begin
62
+ channel_attributes_array = @client.connection.get(attributes['links']['self']).body.fetch('included')
63
+ channel_attributes_array.map do |channel_attributes|
64
+ nested_attributes = channel_attributes.delete('attributes')
65
+ Channel.new(@client, channel_attributes.merge(nested_attributes))
66
+ end
67
+ end
68
+ end
69
+ end
70
+
19
71
  class Role < DataResource
20
72
  def to_param
21
73
  name
@@ -167,6 +219,10 @@ module ZendeskAPI
167
219
  end
168
220
 
169
221
  class Brand < Resource
222
+ def self.cbp_path_regexes
223
+ [/^brands$/]
224
+ end
225
+
170
226
  def destroy!
171
227
  self.active = false
172
228
  save!
@@ -407,7 +463,7 @@ module ZendeskAPI
407
463
  extend DestroyMany
408
464
 
409
465
  def self.cbp_path_regexes
410
- [/^tickets$/]
466
+ [/^tickets$/, %r{organizations/\d+/tickets}]
411
467
  end
412
468
 
413
469
  # Unlike other attributes, "comment" is not a property of the ticket,
@@ -428,6 +484,10 @@ module ZendeskAPI
428
484
  has :author, :class => User
429
485
 
430
486
  has_many Event
487
+
488
+ def self.cbp_path_regexes
489
+ [%r{^tickets/\d+/audits$}]
490
+ end
431
491
  end
432
492
 
433
493
  class Comment < DataResource
@@ -740,6 +800,10 @@ module ZendeskAPI
740
800
  put :request_verification
741
801
  end
742
802
 
803
+ def self.cbp_path_regexes
804
+ [/^users$/, %r{^organizations/\d+/users$}]
805
+ end
806
+
743
807
  any :password
744
808
 
745
809
  # Set a user's password
@@ -1,3 +1,3 @@
1
1
  module ZendeskAPI
2
- VERSION = "3.0.4"
2
+ VERSION = "3.1.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: 3.0.4
4
+ version: 3.1.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: 2023-08-25 00:00:00.000000000 Z
12
+ date: 2024-07-01 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: faraday
@@ -153,9 +153,9 @@ licenses:
153
153
  - Apache-2.0
154
154
  metadata:
155
155
  bug_tracker_uri: https://github.com/zendesk/zendesk_api_client_rb/issues
156
- changelog_uri: https://github.com/zendesk/zendesk_api_client_rb/blob/v3.0.4/CHANGELOG.md
157
- documentation_uri: https://www.rubydoc.info/gems/zendesk_api/3.0.4
158
- source_code_uri: https://github.com/zendesk/zendesk_api_client_rb/tree/v3.0.4
156
+ changelog_uri: https://github.com/zendesk/zendesk_api_client_rb/blob/v3.1.0/CHANGELOG.md
157
+ documentation_uri: https://www.rubydoc.info/gems/zendesk_api/3.1.0
158
+ source_code_uri: https://github.com/zendesk/zendesk_api_client_rb/tree/v3.1.0
159
159
  wiki_uri: https://github.com/zendesk/zendesk_api_client_rb/wiki
160
160
  post_install_message:
161
161
  rdoc_options: []
@@ -172,7 +172,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
172
172
  - !ruby/object:Gem::Version
173
173
  version: 1.3.6
174
174
  requirements: []
175
- rubygems_version: 3.0.3.1
175
+ rubygems_version: 3.5.11
176
176
  signing_key:
177
177
  specification_version: 4
178
178
  summary: Zendesk REST API Client