Sha256: 85ae1524f6a08c6bfb9292ffcd84f45da33814eb3a50df4dae80de14bb634440

Contents?: true

Size: 1.1 KB

Versions: 54

Compression:

Stored size: 1.1 KB

Contents

class Ey::Core::Client
  class Real
    def get_contacts(params={})
      request(
        :params => params,
        :query  => Ey::Core.paging_parameters(params),
        :path   => "/contacts",
        :url    => params.delete("url"),
      )
    end
  end # Real

  class Mock
    def get_contacts(params={})
      extract_url_params!(params)

      resources = if database_service_url = params.delete("database_service")
                    database_service_id = resource_identity(database_service_url)
                    contact_ids = self.data[:contact_assignments].inject([]) { |r, (contact_id, resource_id)| (resource_id == database_service_id) ? r << contact_id : r }
                    self.data[:contacts].select { |id, _| contact_ids.include?(id) }
                  else
                    self.data[:contacts]
                  end

      headers, contacts_page = search_and_page(params, :contacts, search_keys: %w[name email], resources: resources)

      response(
        :body    => {"contacts" => contacts_page},
        :status  => 200,
        :headers => headers
      )
    end
  end # Mock
end

Version data entries

54 entries across 54 versions & 3 rubygems

Version Path
ey-core-3.6.0.autoscaling1 lib/ey-core/requests/get_contacts.rb
ey-core-3.6.4 lib/ey-core/requests/get_contacts.rb
ey-core-3.6.3 lib/ey-core/requests/get_contacts.rb
ey-core-3.6.1 lib/ey-core/requests/get_contacts.rb
groove-ey-core-3.6.3 lib/ey-core/requests/get_contacts.rb
groove-ey-core-3.6.2 lib/ey-core/requests/get_contacts.rb
groove-ey-core-3.6.1 lib/ey-core/requests/get_contacts.rb
ey-core-3.5.0 lib/ey-core/requests/get_contacts.rb
ey-core-3.4.4 lib/ey-core/requests/get_contacts.rb
ey-core-3.4.2 lib/ey-core/requests/get_contacts.rb
ey-core-3.4.1 lib/ey-core/requests/get_contacts.rb
ey-core-3.4.0 lib/ey-core/requests/get_contacts.rb
ey-core-3.3.1 lib/ey-core/requests/get_contacts.rb
ey-core-3.3.0 lib/ey-core/requests/get_contacts.rb
ey-core-3.2.6 lib/ey-core/requests/get_contacts.rb
ey-core-3.2.5 lib/ey-core/requests/get_contacts.rb
ey-core-3.2.4 lib/ey-core/requests/get_contacts.rb
ey-core-3.2.3 lib/ey-core/requests/get_contacts.rb
ey-core-3.2.2 lib/ey-core/requests/get_contacts.rb
ey-core-3.2.1 lib/ey-core/requests/get_contacts.rb