10
11
12
13
14
15
16
17
18
19
20
21
|
# File 'lib/mercadolibre_api/products/queries/find.rb', line 10
def execute
response = Net::HTTP.get_response(product_uri)
response_body = JSON.parse(response.body, symbolize_names: true)
sold_quantity = MercadolibreApi::Products::Queries::SoldQuantity.run!(product_url: response_body[:permalink])
description = MercadolibreApi::Products::Descriptions::Queries::Find.run!(
product_id: product_id, description_id: response_body[:descriptions].dig(0, :id)
)
response_body[:description] = description
response_body[:confirmed_sold_quantity] = sold_quantity
MercadolibreApi::Products::Entities::Product.represent(response_body).as_json
end
|