zendesk_api 3.0.5 → 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: 8ecc2ccbe7be3ec6da2b36fdcd7b75004fcecd91a26de63d0bb561dcddff86cc
4
- data.tar.gz: c4b7a7d6baa3246d2835251d03d2a7c0fd69961fd2ca3575a7486f3a7adf06f6
3
+ metadata.gz: df2d68422fdea92cfac956254ddd2b382faf6e028bc7523c7211edcbdd12eb6e
4
+ data.tar.gz: a3fb793d37568e24dc458b4a015687f4d6b885547624736e83245c4cdb4073ec
5
5
  SHA512:
6
- metadata.gz: 9183c973ac61c198dd69d975c5bc9eb27cc424b47e50027d32c2a462f651b08681925b00fd4686d248b615a80445c34b59273861a164917ea6738b54d04c1a4b
7
- data.tar.gz: 980637e5be8ba003774a6fe5fe53dc2a4003ba6e58b933d21aaba66cb9c66eb0dd3f706ac6b2e69740f1c22cfe2a3d4c7301a7cfd313c0753ef3cff7cbc2683b
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
@@ -1,3 +1,3 @@
1
1
  module ZendeskAPI
2
- VERSION = "3.0.5"
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.5
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-09-06 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.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.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