Method: BaseCRM::TextMessagesService#where

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

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

Retrieve text messages

get ‘/text_messages’

Returns Text Messages, according to the parameters provided

Parameters:

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

    Search options

Options Hash (options):

  • :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 at one time is 100.

  • :ids (String)

    Comma-separated list of text message IDs to be returned in request.

  • :resource_id (Integer)

    Unique identifier of a resource the text message is attached to. Requires also resource_type to be specified.

  • :resource_type (String)

    Name of a resource type the text message is attached to. Requires also resource_id to be specified.

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

    Comma-separated list of fields to sort by. The sort criteria is applied in the order specified. The default ordering is descending. If you want to change the sort ordering to ascending, append ‘:asc` to the field e.g. `sort_by=id:asc`

Returns:

  • (Array<TextMessage>)

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



33
34
35
36
37
# File 'lib/basecrm/services/text_messages_service.rb', line 33

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

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