Class: FaspClient::AccountSearchService

Inherits:
Object
  • Object
show all
Defined in:
app/services/fasp_client/account_search_service.rb

Instance Method Summary collapse

Constructor Details

#initialize(provider:) ⇒ AccountSearchService

Returns a new instance of AccountSearchService.



5
6
7
# File 'app/services/fasp_client/account_search_service.rb', line 5

def initialize(provider:)
  @provider = provider
end

Instance Method Details

#search(query:, limit: 20) ⇒ Object



9
10
11
12
13
14
# File 'app/services/fasp_client/account_search_service.rb', line 9

def search(query:, limit: 20)
  response = HttpRequestService.new(provider: @provider).execute!(
    Net::HTTP::Get.new(URI(@provider.base_url + "/account_search/v0/search?limit=#{limit}&term=" + CGI.escape(query)))
  )
  JSON.parse(response.body)
end