Class: BaseCRM::VisitOutcomesService

Inherits:
Object
  • Object
show all
Defined in:
lib/basecrm/services/visit_outcomes_service.rb

Instance Method Summary collapse

Constructor Details

#initialize(client) ⇒ VisitOutcomesService

Returns a new instance of VisitOutcomesService.



5
6
7
# File 'lib/basecrm/services/visit_outcomes_service.rb', line 5

def initialize(client)
  @client = client
end

Instance Method Details

#allEnumerable

Retrieve visit outcomes

get ‘/visit_outcomes’

If you want to use filtering or sorting (see #where).

Returns:

  • (Enumerable)

    Paginated resource you can use to iterate over all the resources.



15
16
17
# File 'lib/basecrm/services/visit_outcomes_service.rb', line 15

def all
  PaginatedResource.new(self)
end

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

Retrieve visit outcomes

get ‘/visit_outcomes’

Returns Visit Outcomes, 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.

Returns:

  • (Array<VisitOutcome>)

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



29
30
31
32
33
# File 'lib/basecrm/services/visit_outcomes_service.rb', line 29

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

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