Sha256: da87c6cd090c9e6eeeb3ce835f07b71326b851bae234ee099f75a8d5320a7a04

Contents?: true

Size: 605 Bytes

Versions: 6

Compression:

Stored size: 605 Bytes

Contents

# frozen_string_literal: true
class Zendesk2::GetOrganizationTickets
  include Zendesk2::Request

  request_method :get
  request_path { |r| "/organizations/#{r.organization_id}/tickets.json" }

  page_params!

  def organization_id
    params.fetch('organization_id').to_i
  end

  def mock(_params = {})
    organizations = data[:users].values.select { |u| u['organization_id'] == organization_id }
    requesters = organizations.map { |s| s['organization_id'] }

    tickets = data[:tickets].values.select { |t| requesters.include?(t['organization_id']) }

    page(tickets, root: 'tickets')
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
zendesk2-1.15.0 lib/zendesk2/get_organization_tickets.rb
zendesk2-1.13.1 lib/zendesk2/get_organization_tickets.rb
zendesk2-1.13.0 lib/zendesk2/get_organization_tickets.rb
zendesk2-1.12.0 lib/zendesk2/get_organization_tickets.rb
zendesk2-1.11.0 lib/zendesk2/get_organization_tickets.rb
zendesk2-1.10.0 lib/zendesk2/get_organization_tickets.rb