zendesk_api 3.0.2 → 3.0.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/zendesk_api/collection.rb +3 -3
- data/lib/zendesk_api/resource.rb +15 -10
- data/lib/zendesk_api/resources.rb +51 -7
- data/lib/zendesk_api/version.rb +1 -1
- metadata +5 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8b226059359e4f834ccada53be52fbe72e0d73c26aa045fcfd011bd8afe3c1c2
|
4
|
+
data.tar.gz: c006d69a0b16716c7f093cd5a14454652661d4234f9a515a6a7724f977145c89
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9080f2d1cb5c4fae6145c37dfe2fa4e3e81c1bd3afa1d565cd41e350e36b97dff9247c9a5028f3e78e27c1516fe406df80980a21c60b3f716898bcaddb026b0e
|
7
|
+
data.tar.gz: e616e3ee6b1ba647952265b5dad953181eaeb5940d6954d37cfe1934232df7abb4547d8de7cbc22dc9dcceda1d849c6c103fc87f85514cba42e64e2cf48f6c50
|
@@ -225,7 +225,7 @@ module ZendeskAPI
|
|
225
225
|
clear_cache
|
226
226
|
@options["page"] = @options["page"].to_i + 1
|
227
227
|
elsif (@query = @next_page)
|
228
|
-
# Send _only_ url param "?after=token" to get the next page
|
228
|
+
# Send _only_ url param "?page[after]=token" to get the next page
|
229
229
|
@options.page&.delete("before")
|
230
230
|
fetch(true)
|
231
231
|
else
|
@@ -243,7 +243,7 @@ module ZendeskAPI
|
|
243
243
|
clear_cache
|
244
244
|
@options["page"] -= 1
|
245
245
|
elsif (@query = @prev_page)
|
246
|
-
# Send _only_ url param "?before=token" to get the prev page
|
246
|
+
# Send _only_ url param "?page[before]=token" to get the prev page
|
247
247
|
@options.page&.delete("after")
|
248
248
|
fetch(true)
|
249
249
|
else
|
@@ -465,7 +465,7 @@ module ZendeskAPI
|
|
465
465
|
def next_collection(name, *args, &block)
|
466
466
|
opts = args.last.is_a?(Hash) ? args.last : {}
|
467
467
|
opts.merge!(collection_path: [*@collection_path, name], page: nil)
|
468
|
-
#
|
468
|
+
# Why `page: nil`?
|
469
469
|
# when you do client.tickets.fetch followed by client.tickets.foos => the request to /tickets/foos will
|
470
470
|
# have the options page set to whatever the last options were for the tickets collection
|
471
471
|
self.class.new(@client, @resource_class, @options.merge(opts))
|
data/lib/zendesk_api/resource.rb
CHANGED
@@ -39,6 +39,14 @@ module ZendeskAPI
|
|
39
39
|
def namespace(namespace)
|
40
40
|
@namespace = namespace
|
41
41
|
end
|
42
|
+
|
43
|
+
def new_from_response(client, response, includes = nil)
|
44
|
+
new(client).tap do |resource|
|
45
|
+
resource.handle_response(response)
|
46
|
+
resource.set_includes(resource, includes, response.body) if includes
|
47
|
+
resource.attributes.clear_changes
|
48
|
+
end
|
49
|
+
end
|
42
50
|
end
|
43
51
|
|
44
52
|
# @return [Hash] The resource's attributes
|
@@ -123,19 +131,16 @@ module ZendeskAPI
|
|
123
131
|
|
124
132
|
# Compares resources by class and id. If id is nil, then by object_id
|
125
133
|
def ==(other)
|
134
|
+
return false unless other
|
135
|
+
|
126
136
|
return true if other.object_id == object_id
|
127
137
|
|
128
|
-
|
129
|
-
warn "Trying to compare #{other.class} to a Resource from #{caller.first}"
|
130
|
-
end
|
138
|
+
return other.id && (other.id == id) if other.is_a?(Data)
|
131
139
|
|
132
|
-
if other.is_a?(
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
else
|
137
|
-
false
|
138
|
-
end
|
140
|
+
return id == other if other.is_a?(Integer)
|
141
|
+
|
142
|
+
warn "Trying to compare #{other.class} to a Resource
|
143
|
+
from #{caller.first}"
|
139
144
|
end
|
140
145
|
alias :eql :==
|
141
146
|
|
@@ -24,6 +24,10 @@ module ZendeskAPI
|
|
24
24
|
|
25
25
|
class Topic < Resource
|
26
26
|
class << self
|
27
|
+
def cbp_path_regexes
|
28
|
+
[%r{^community/topics$}]
|
29
|
+
end
|
30
|
+
|
27
31
|
def resource_path
|
28
32
|
"community/topics"
|
29
33
|
end
|
@@ -83,6 +87,10 @@ module ZendeskAPI
|
|
83
87
|
def attributes_for_save
|
84
88
|
{ self.class.resource_name => [id] }
|
85
89
|
end
|
90
|
+
|
91
|
+
def self.cbp_path_regexes
|
92
|
+
[/^tags$/]
|
93
|
+
end
|
86
94
|
end
|
87
95
|
|
88
96
|
class Attachment < ReadResource
|
@@ -154,7 +162,7 @@ module ZendeskAPI
|
|
154
162
|
end
|
155
163
|
|
156
164
|
def self.cbp_path_regexes
|
157
|
-
[
|
165
|
+
[/^organizations$/]
|
158
166
|
end
|
159
167
|
end
|
160
168
|
|
@@ -186,7 +194,7 @@ module ZendeskAPI
|
|
186
194
|
has Organization
|
187
195
|
|
188
196
|
def self.cbp_path_regexes
|
189
|
-
[%r{organizations/\d+/subscriptions$}]
|
197
|
+
[%r{^organizations/\d+/subscriptions$}]
|
190
198
|
end
|
191
199
|
end
|
192
200
|
|
@@ -275,6 +283,10 @@ module ZendeskAPI
|
|
275
283
|
class Activity < Resource
|
276
284
|
has User
|
277
285
|
has :actor, :class => User
|
286
|
+
|
287
|
+
def self.cbp_path_regexes
|
288
|
+
[/^activities$/]
|
289
|
+
end
|
278
290
|
end
|
279
291
|
|
280
292
|
class Setting < UpdateResource
|
@@ -357,10 +369,18 @@ module ZendeskAPI
|
|
357
369
|
namespace 'portal'
|
358
370
|
end
|
359
371
|
|
360
|
-
class TicketField < Resource
|
372
|
+
class TicketField < Resource
|
373
|
+
def self.cbp_path_regexes
|
374
|
+
[/^ticket_fields$/]
|
375
|
+
end
|
376
|
+
end
|
361
377
|
|
362
378
|
class TicketMetric < DataResource
|
363
379
|
include Read
|
380
|
+
|
381
|
+
def self.cbp_path_regexes
|
382
|
+
[/^ticket_metrics$/]
|
383
|
+
end
|
364
384
|
end
|
365
385
|
|
366
386
|
class TicketRelated < DataResource; end
|
@@ -387,7 +407,7 @@ module ZendeskAPI
|
|
387
407
|
extend DestroyMany
|
388
408
|
|
389
409
|
def self.cbp_path_regexes
|
390
|
-
[
|
410
|
+
[/^tickets$/]
|
391
411
|
end
|
392
412
|
|
393
413
|
# Unlike other attributes, "comment" is not a property of the ticket,
|
@@ -498,6 +518,10 @@ module ZendeskAPI
|
|
498
518
|
|
499
519
|
# Recovers this suspended ticket to an actual ticket
|
500
520
|
put :recover
|
521
|
+
|
522
|
+
def self.cbp_path_regexes
|
523
|
+
[/^suspended_tickets$/]
|
524
|
+
end
|
501
525
|
end
|
502
526
|
|
503
527
|
class DeletedTicket < ReadResource
|
@@ -507,6 +531,10 @@ module ZendeskAPI
|
|
507
531
|
# Restores this previously deleted ticket to an actual ticket
|
508
532
|
put :restore
|
509
533
|
put :restore_many
|
534
|
+
|
535
|
+
def self.cbp_path_regexes
|
536
|
+
[/^deleted_tickets$/]
|
537
|
+
end
|
510
538
|
end
|
511
539
|
|
512
540
|
class UserViewRow < DataResource
|
@@ -604,6 +632,10 @@ module ZendeskAPI
|
|
604
632
|
def self.preview(client, options = {})
|
605
633
|
Collection.new(client, ViewRow, options.merge(:path => "views/preview", :verb => :post))
|
606
634
|
end
|
635
|
+
|
636
|
+
def self.cbp_path_regexes
|
637
|
+
[/^views$/]
|
638
|
+
end
|
607
639
|
end
|
608
640
|
|
609
641
|
class Trigger < Rule
|
@@ -613,7 +645,7 @@ module ZendeskAPI
|
|
613
645
|
has :execution, :class => RuleExecution
|
614
646
|
|
615
647
|
def self.cbp_path_regexes
|
616
|
-
[
|
648
|
+
[/^triggers$/, %r{^triggers/active$}]
|
617
649
|
end
|
618
650
|
end
|
619
651
|
|
@@ -622,6 +654,10 @@ module ZendeskAPI
|
|
622
654
|
include Actions
|
623
655
|
|
624
656
|
has :execution, :class => RuleExecution
|
657
|
+
|
658
|
+
def self.cbp_path_regexes
|
659
|
+
[/^automations$/]
|
660
|
+
end
|
625
661
|
end
|
626
662
|
|
627
663
|
class Macro < Rule
|
@@ -629,6 +665,10 @@ module ZendeskAPI
|
|
629
665
|
|
630
666
|
has :execution, :class => RuleExecution
|
631
667
|
|
668
|
+
def self.cbp_path_regexes
|
669
|
+
[/^macros$/]
|
670
|
+
end
|
671
|
+
|
632
672
|
# Returns the update to a ticket that happens when a macro will be applied.
|
633
673
|
# @param [Ticket] ticket Optional {Ticket} to apply this macro to.
|
634
674
|
# @raise [Faraday::ClientError] Raised for any non-200 response.
|
@@ -666,7 +706,7 @@ module ZendeskAPI
|
|
666
706
|
has Group
|
667
707
|
|
668
708
|
def self.cbp_path_regexes
|
669
|
-
[%r{groups/\d+/memberships$}]
|
709
|
+
[%r{^groups/\d+/memberships$}]
|
670
710
|
end
|
671
711
|
end
|
672
712
|
|
@@ -674,7 +714,7 @@ module ZendeskAPI
|
|
674
714
|
has_many :memberships, class: GroupMembership, path: "memberships"
|
675
715
|
|
676
716
|
def self.cbp_path_regexes
|
677
|
-
[
|
717
|
+
[/^groups$/, %r{^groups/assignable$}]
|
678
718
|
end
|
679
719
|
end
|
680
720
|
|
@@ -817,6 +857,10 @@ module ZendeskAPI
|
|
817
857
|
def self.singular_resource_name
|
818
858
|
"client"
|
819
859
|
end
|
860
|
+
|
861
|
+
def self.cbp_path_regexes
|
862
|
+
[%r{^oauth/clients$}]
|
863
|
+
end
|
820
864
|
end
|
821
865
|
|
822
866
|
class OauthToken < ReadResource
|
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: 3.0.
|
4
|
+
version: 3.0.4
|
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-
|
12
|
+
date: 2023-08-25 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.
|
157
|
-
documentation_uri: https://www.rubydoc.info/gems/zendesk_api/3.0.
|
158
|
-
source_code_uri: https://github.com/zendesk/zendesk_api_client_rb/tree/v3.0.
|
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
|
159
159
|
wiki_uri: https://github.com/zendesk/zendesk_api_client_rb/wiki
|
160
160
|
post_install_message:
|
161
161
|
rdoc_options: []
|