Class: SellsyV2::Search

Inherits:
Object
  • Object
show all
Defined in:
lib/sellsy_v2.rb

Constant Summary collapse

ROOT_PATH =
'/search'

Instance Method Summary collapse

Constructor Details

#initialize(query:, **options) ⇒ Search

Returns a new instance of Search.



40
41
42
43
44
45
# File 'lib/sellsy_v2.rb', line 40

def initialize(query:, **options)
  search_response = Request.new(path: ROOT_PATH, verb: 'get', options: options.merge({q: query})).call
  if search_response.success?
    search_response.data.dig('data').map{OpenStruct.new(_1)}
  end
end