zendesk_api 3.0.2 → 3.0.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: bb7a7899050cd837be40995be562bb7c95a04e7d631a34cdddaa671c1eeca9b3
4
- data.tar.gz: c042f01365e91e868c54e7aa5fc1318fc490efa2440093e24df86df6800feaba
3
+ metadata.gz: 8ecc2ccbe7be3ec6da2b36fdcd7b75004fcecd91a26de63d0bb561dcddff86cc
4
+ data.tar.gz: c4b7a7d6baa3246d2835251d03d2a7c0fd69961fd2ca3575a7486f3a7adf06f6
5
5
  SHA512:
6
- metadata.gz: efafbaa0881befe0fd827e9fa465a3f7be19ec566199dd1640f5bba68ec101a6a0eb8b30efe850a08ca5f2adc2004ab809e74ba96eb52b3f8ac2e63f75c07e72
7
- data.tar.gz: 6c81354976ef9ce6adf2f6ae084d7a60ae04fd49e10033e5025e5697a1f7adaac9385834f1c22a671e08cb94c3132d5c365a2e2a969b42f3035e301e94ed0a68
6
+ metadata.gz: 9183c973ac61c198dd69d975c5bc9eb27cc424b47e50027d32c2a462f651b08681925b00fd4686d248b615a80445c34b59273861a164917ea6738b54d04c1a4b
7
+ data.tar.gz: 980637e5be8ba003774a6fe5fe53dc2a4003ba6e58b933d21aaba66cb9c66eb0dd3f706ac6b2e69740f1c22cfe2a3d4c7301a7cfd313c0753ef3cff7cbc2683b
@@ -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
- # why page: nil ?
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))
@@ -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
- if other && !(other.is_a?(Data) || other.is_a?(Integer))
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?(Data)
133
- other.id && other.id == id
134
- elsif other.is_a?(Integer)
135
- id == other
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,11 +162,15 @@ module ZendeskAPI
154
162
  end
155
163
 
156
164
  def self.cbp_path_regexes
157
- [/organizations$/]
165
+ [/^organizations$/]
158
166
  end
159
167
  end
160
168
 
161
169
  class Brand < Resource
170
+ def self.cbp_path_regexes
171
+ [/^brands$/]
172
+ end
173
+
162
174
  def destroy!
163
175
  self.active = false
164
176
  save!
@@ -186,7 +198,7 @@ module ZendeskAPI
186
198
  has Organization
187
199
 
188
200
  def self.cbp_path_regexes
189
- [%r{organizations/\d+/subscriptions$}]
201
+ [%r{^organizations/\d+/subscriptions$}]
190
202
  end
191
203
  end
192
204
 
@@ -275,6 +287,10 @@ module ZendeskAPI
275
287
  class Activity < Resource
276
288
  has User
277
289
  has :actor, :class => User
290
+
291
+ def self.cbp_path_regexes
292
+ [/^activities$/]
293
+ end
278
294
  end
279
295
 
280
296
  class Setting < UpdateResource
@@ -357,10 +373,18 @@ module ZendeskAPI
357
373
  namespace 'portal'
358
374
  end
359
375
 
360
- class TicketField < Resource; end
376
+ class TicketField < Resource
377
+ def self.cbp_path_regexes
378
+ [/^ticket_fields$/]
379
+ end
380
+ end
361
381
 
362
382
  class TicketMetric < DataResource
363
383
  include Read
384
+
385
+ def self.cbp_path_regexes
386
+ [/^ticket_metrics$/]
387
+ end
364
388
  end
365
389
 
366
390
  class TicketRelated < DataResource; end
@@ -387,7 +411,7 @@ module ZendeskAPI
387
411
  extend DestroyMany
388
412
 
389
413
  def self.cbp_path_regexes
390
- [/tickets$/]
414
+ [/^tickets$/, %r{organizations/\d+/tickets}]
391
415
  end
392
416
 
393
417
  # Unlike other attributes, "comment" is not a property of the ticket,
@@ -408,6 +432,10 @@ module ZendeskAPI
408
432
  has :author, :class => User
409
433
 
410
434
  has_many Event
435
+
436
+ def self.cbp_path_regexes
437
+ [%r{^tickets/\d+/audits$}]
438
+ end
411
439
  end
412
440
 
413
441
  class Comment < DataResource
@@ -498,6 +526,10 @@ module ZendeskAPI
498
526
 
499
527
  # Recovers this suspended ticket to an actual ticket
500
528
  put :recover
529
+
530
+ def self.cbp_path_regexes
531
+ [/^suspended_tickets$/]
532
+ end
501
533
  end
502
534
 
503
535
  class DeletedTicket < ReadResource
@@ -507,6 +539,10 @@ module ZendeskAPI
507
539
  # Restores this previously deleted ticket to an actual ticket
508
540
  put :restore
509
541
  put :restore_many
542
+
543
+ def self.cbp_path_regexes
544
+ [/^deleted_tickets$/]
545
+ end
510
546
  end
511
547
 
512
548
  class UserViewRow < DataResource
@@ -604,6 +640,10 @@ module ZendeskAPI
604
640
  def self.preview(client, options = {})
605
641
  Collection.new(client, ViewRow, options.merge(:path => "views/preview", :verb => :post))
606
642
  end
643
+
644
+ def self.cbp_path_regexes
645
+ [/^views$/]
646
+ end
607
647
  end
608
648
 
609
649
  class Trigger < Rule
@@ -613,7 +653,7 @@ module ZendeskAPI
613
653
  has :execution, :class => RuleExecution
614
654
 
615
655
  def self.cbp_path_regexes
616
- [/triggers$/, %r{triggers/active$}]
656
+ [/^triggers$/, %r{^triggers/active$}]
617
657
  end
618
658
  end
619
659
 
@@ -622,6 +662,10 @@ module ZendeskAPI
622
662
  include Actions
623
663
 
624
664
  has :execution, :class => RuleExecution
665
+
666
+ def self.cbp_path_regexes
667
+ [/^automations$/]
668
+ end
625
669
  end
626
670
 
627
671
  class Macro < Rule
@@ -629,6 +673,10 @@ module ZendeskAPI
629
673
 
630
674
  has :execution, :class => RuleExecution
631
675
 
676
+ def self.cbp_path_regexes
677
+ [/^macros$/]
678
+ end
679
+
632
680
  # Returns the update to a ticket that happens when a macro will be applied.
633
681
  # @param [Ticket] ticket Optional {Ticket} to apply this macro to.
634
682
  # @raise [Faraday::ClientError] Raised for any non-200 response.
@@ -666,7 +714,7 @@ module ZendeskAPI
666
714
  has Group
667
715
 
668
716
  def self.cbp_path_regexes
669
- [%r{groups/\d+/memberships$}]
717
+ [%r{^groups/\d+/memberships$}]
670
718
  end
671
719
  end
672
720
 
@@ -674,7 +722,7 @@ module ZendeskAPI
674
722
  has_many :memberships, class: GroupMembership, path: "memberships"
675
723
 
676
724
  def self.cbp_path_regexes
677
- [/groups$/, %r{groups/assignable$}]
725
+ [/^groups$/, %r{^groups/assignable$}]
678
726
  end
679
727
  end
680
728
 
@@ -700,6 +748,10 @@ module ZendeskAPI
700
748
  put :request_verification
701
749
  end
702
750
 
751
+ def self.cbp_path_regexes
752
+ [/^users$/, %r{^organizations/\d+/users$}]
753
+ end
754
+
703
755
  any :password
704
756
 
705
757
  # Set a user's password
@@ -817,6 +869,10 @@ module ZendeskAPI
817
869
  def self.singular_resource_name
818
870
  "client"
819
871
  end
872
+
873
+ def self.cbp_path_regexes
874
+ [%r{^oauth/clients$}]
875
+ end
820
876
  end
821
877
 
822
878
  class OauthToken < ReadResource
@@ -1,3 +1,3 @@
1
1
  module ZendeskAPI
2
- VERSION = "3.0.2"
2
+ VERSION = "3.0.5"
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.2
4
+ version: 3.0.5
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-01 00:00:00.000000000 Z
12
+ date: 2023-09-06 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.2/CHANGELOG.md
157
- documentation_uri: https://www.rubydoc.info/gems/zendesk_api/3.0.2
158
- source_code_uri: https://github.com/zendesk/zendesk_api_client_rb/tree/v3.0.2
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
159
159
  wiki_uri: https://github.com/zendesk/zendesk_api_client_rb/wiki
160
160
  post_install_message:
161
161
  rdoc_options: []