zendesk_api 3.0.5 → 3.1.1

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: 8ecc2ccbe7be3ec6da2b36fdcd7b75004fcecd91a26de63d0bb561dcddff86cc
4
- data.tar.gz: c4b7a7d6baa3246d2835251d03d2a7c0fd69961fd2ca3575a7486f3a7adf06f6
3
+ metadata.gz: 138f1dab58b3b37d450c4b1dd9200b1c878944b19571f53888b2c4d17a307276
4
+ data.tar.gz: 24459eda2e613e21be9924ad6bb571e53861f949d6be291f2bec3516cd1e9ad2
5
5
  SHA512:
6
- metadata.gz: 9183c973ac61c198dd69d975c5bc9eb27cc424b47e50027d32c2a462f651b08681925b00fd4686d248b615a80445c34b59273861a164917ea6738b54d04c1a4b
7
- data.tar.gz: 980637e5be8ba003774a6fe5fe53dc2a4003ba6e58b933d21aaba66cb9c66eb0dd3f706ac6b2e69740f1c22cfe2a3d4c7301a7cfd313c0753ef3cff7cbc2683b
6
+ metadata.gz: 55f26e4b66e457d5e9e634eefa44fc8b50da170ab2d5a5f97d2460daa423da04d7c607bfa626b1ecd7ce56117a1ee410e7213df6717d84a8e4a109392e1611a5
7
+ data.tar.gz: 0bab4d20e8989a0e1a4f8be708f76ccd462fddec1b880fb360591f9f048d74c5bbd17d20b678290fb6891dcb0fa6755139e5165fb7c7ea28055643abe583efbb
@@ -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
@@ -411,7 +463,7 @@ module ZendeskAPI
411
463
  extend DestroyMany
412
464
 
413
465
  def self.cbp_path_regexes
414
- [/^tickets$/, %r{organizations/\d+/tickets}]
466
+ [/^tickets$/, %r{organizations/\d+/tickets}, %r{users/\d+/tickets/requested}]
415
467
  end
416
468
 
417
469
  # Unlike other attributes, "comment" is not a property of the ticket,
@@ -1,3 +1,3 @@
1
1
  module ZendeskAPI
2
- VERSION = "3.0.5"
2
+ VERSION = "3.1.1"
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.5
4
+ version: 3.1.1
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-09-06 00:00:00.000000000 Z
12
+ date: 2024-09-04 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.5/CHANGELOG.md
157
- documentation_uri: https://www.rubydoc.info/gems/zendesk_api/3.0.5
158
- source_code_uri: https://github.com/zendesk/zendesk_api_client_rb/tree/v3.0.5
156
+ changelog_uri: https://github.com/zendesk/zendesk_api_client_rb/blob/v3.1.1/CHANGELOG.md
157
+ documentation_uri: https://www.rubydoc.info/gems/zendesk_api/3.1.1
158
+ source_code_uri: https://github.com/zendesk/zendesk_api_client_rb/tree/v3.1.1
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.16
176
176
  signing_key:
177
177
  specification_version: 4
178
178
  summary: Zendesk REST API Client