Sha256: ab5fb42bd3640f414e5392f6a8ee9399ee3b5cdeec909f5fb51e55c0f04111d6

Contents?: true

Size: 788 Bytes

Versions: 6

Compression:

Stored size: 788 Bytes

Contents

class Zendesk2::Client::Organizations < Zendesk2::Client::Collection
  include Zendesk2::PagedCollection
  include Zendesk2::Searchable

  model Zendesk2::Client::Organization

  def find_by_external_id(external_id)
    body = service.get_organization_by_external_id("external_id" => external_id).body
    if data = body.delete("organizations")
      collection = self.clone.load(data)
      collection.merge_attributes(Cistern::Hash.slice(body, "count", "next_page", "previous_page"))
      collection
    end
  end

  self.collection_method = :get_organizations
  self.collection_root   = "organizations"
  self.model_method      = :get_organization
  self.model_root        = "organization"
  self.search_type       = "organization"
  self.search_request    = :search_organization
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
zendesk2-1.5.8 lib/zendesk2/client/collections/organizations.rb
zendesk2-1.5.7 lib/zendesk2/client/collections/organizations.rb
zendesk2-1.5.6 lib/zendesk2/client/collections/organizations.rb
zendesk2-1.5.5 lib/zendesk2/client/collections/organizations.rb
zendesk2-1.5.4 lib/zendesk2/client/collections/organizations.rb
zendesk2-1.5.3 lib/zendesk2/client/collections/organizations.rb