Class: MercadolibreApi::Sellers::Products::Queries::MostSold

Inherits:
ActiveInteraction::Base
  • Object
show all
Defined in:
lib/mercadolibre_api/sellers/products/queries/most_sold.rb

Instance Method Summary collapse

Instance Method Details

#executeObject



12
13
14
15
16
17
18
19
# File 'lib/mercadolibre_api/sellers/products/queries/most_sold.rb', line 12

def execute
  results = search_uris.map do |uri|
    response = Net::HTTP.get_response(uri)
    JSON.parse(response.body, symbolize_names: true)[:results]
  end

  results.flatten.map { |r| MercadolibreApi::Products::Entities::Product.represent(r).as_json }
end