diff --git a/lib/zendesk_api/resources.rb b/lib/zendesk_api/resources.rb index abbb6dea..52c0f0de 100644 --- a/lib/zendesk_api/resources.rb +++ b/lib/zendesk_api/resources.rb @@ -167,6 +167,10 @@ def self.cbp_path_regexes end class Brand < Resource + def self.cbp_path_regexes + [/^brands$/] + end + def destroy! self.active = false save! @@ -407,7 +411,7 @@ class Ticket < Resource extend DestroyMany def self.cbp_path_regexes - [/^tickets$/] + [/^tickets$/, %r{organizations/\d+/tickets}] end # Unlike other attributes, "comment" is not a property of the ticket, @@ -428,6 +432,10 @@ class Event < Data has :author, :class => User has_many Event + + def self.cbp_path_regexes + [%r{^tickets/\d+/audits$}] + end end class Comment < DataResource @@ -740,6 +748,10 @@ class Identity < Resource put :request_verification end + def self.cbp_path_regexes + [/^users$/, %r{^organizations/\d+/users$}] + end + any :password # Set a user's password diff --git a/spec/live/cbp_support_spec.rb b/spec/live/cbp_support_spec.rb index 0a69d4fc..aa07d15d 100644 --- a/spec/live/cbp_support_spec.rb +++ b/spec/live/cbp_support_spec.rb @@ -98,6 +98,40 @@ end end + describe ZendeskAPI::Ticket do + describe '/tickets' do + it_behaves_like 'an endpoint that supports CBP' do + let(:collection) { client.tickets } + end + end + + describe '/organizations/:id/tickets' do + let(:organization) do + VCR.use_cassette("cbp_#{described_class}_organization_fetch") do + client.organizations.fetch.first + end + end + + it_behaves_like 'an endpoint that supports CBP' do + let(:collection) { organization.tickets } + end + end + end + + describe ZendeskAPI::Ticket::Audit do + describe '/tickets/:id/audits' do + let(:ticket) do + VCR.use_cassette("cbp_#{described_class}_ticket_fetch") do + client.tickets.fetch.first + end + end + + it_behaves_like 'an endpoint that supports CBP' do + let(:collection) { ticket.audits } + end + end + end + describe ZendeskAPI::TicketMetric do describe '/ticket_metrics' do it_behaves_like 'an endpoint that supports CBP' do @@ -161,4 +195,31 @@ end end end + + describe ZendeskAPI::Brand do + describe '/brands' do + it_behaves_like 'an endpoint that supports CBP' do + let(:collection) { client.brands } + end + end + end + + describe ZendeskAPI::User do + describe '/users' do + it_behaves_like 'an endpoint that supports CBP' do + let(:collection) { client.users } + end + end + + describe '/organizations/:id/users' do + let(:organization) do + VCR.use_cassette("cbp_#{described_class}_organization_fetch") do + client.organizations.fetch.first + end + end + it_behaves_like 'an endpoint that supports CBP' do + let(:collection) { organization.users } + end + end + end end