Class: LedgerSync::Adaptors::Test::Customer::Searcher
- Inherits:
-
Searcher
- Object
- Searcher
- LedgerSync::Adaptors::Test::Customer::Searcher
show all
- Defined in:
- lib/ledger_sync/adaptors/test/customer/searcher.rb
Instance Attribute Summary
Attributes inherited from Searcher
#adaptor, #pagination, #query, #request
Instance Method Summary
collapse
Methods inherited from Searcher
#initialize
included
included
Instance Method Details
#next_searcher ⇒ Object
6
7
8
|
# File 'lib/ledger_sync/adaptors/test/customer/searcher.rb', line 6
def next_searcher
paginate(cursor: 'next_page')
end
|
#previous_searcher ⇒ Object
10
11
12
|
# File 'lib/ledger_sync/adaptors/test/customer/searcher.rb', line 10
def previous_searcher
paginate(cursor: 'previous_page')
end
|
#resources ⇒ Object
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
|
# File 'lib/ledger_sync/adaptors/test/customer/searcher.rb', line 14
def resources
@resources ||= begin
adaptor
.query(
resource: 'customer',
query: "name LIKE '#{query}%'"
)
.map do |c|
LedgerSync::Customer.new(
ledger_id: c.fetch('id'),
name: c.dig('name'),
)
end
end
end
|
#search ⇒ Object
31
32
33
34
35
|
# File 'lib/ledger_sync/adaptors/test/customer/searcher.rb', line 31
def search
super
rescue OAuth2::Error => e
failure(e)
end
|