Class: LedgerSync::Adaptors::QuickBooksOnline::Customer::Searcher

Inherits:
Searcher
  • Object
show all
Defined in:
lib/ledger_sync/adaptors/quickbooks_online/customer/searcher.rb

Instance Attribute Summary

Attributes inherited from Searcher

#adaptor, #pagination, #query

Instance Method Summary collapse

Methods inherited from Searcher

#next_searcher, #previous_searcher, #search

Methods inherited from Searcher

#initialize, #next_searcher, #previous_searcher, #search

Constructor Details

This class inherits a constructor from LedgerSync::Adaptors::Searcher

Instance Method Details

#resourcesObject



6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/ledger_sync/adaptors/quickbooks_online/customer/searcher.rb', line 6

def resources
  @resources ||= begin
    adaptor
      .query(
        resource: 'customer',
        query: "DisplayName LIKE '%#{query}%'",
        limit: limit,
        offset: offset
      )
      .map do |c|
        LedgerSync::Customer.new(
          ledger_id: c.fetch('Id'),
          name: c.dig('FullyQualifiedName')
        )
      end
  end
end