Method: BaseCRM::SourcesService#where

Defined in:
lib/basecrm/services/sources_service.rb

#where(options = {}) ⇒ Array<Source>

Retrieve all sources

get ‘/sources’

Returns all deal sources available to the user according to the parameters provided

Parameters:

  • options (Hash) (defaults to: {})

    Search options

Options Hash (options):

  • :ids (String)

    Comma-separated list of deal source IDs to be returned in a request.

  • :name (String)

    Name of the source to search for. This parameter is used in a strict sense.

  • :page (Integer) — default: 1

    Page number to start from. Page numbering starts at 1, and omitting the ‘page` parameter will return the first page.

  • :per_page (Integer) — default: 25

    Number of records to return per page. The default limit is 25 and the maximum number that can be returned is 100.

  • :sort_by (String) — default: id:asc

    A field to sort by. The default ordering is ascending. If you want to change the sort order to descending, append ‘:desc` to the field e.g. `sort_by=name:desc`.

Returns:

  • (Array<Source>)

    The list of Sources for the first page, unless otherwise specified.



34
35
36
37
38
# File 'lib/basecrm/services/sources_service.rb', line 34

def where(options = {})
  _, _, root = @client.get("/sources", options)

  root[:items].map{ |item| Source.new(item[:data]) }
end