Sha256: b47ad24956377c0d90e9220ed37048dc380fe6c48149cecaf161a4f76fdba3b1
Contents?: true
Size: 684 Bytes
Versions: 3
Compression:
Stored size: 684 Bytes
Contents
require 'active_interaction' require './lib/mercadolibre_api/sites/queries/get_code' module MercadolibreApi module Products module Queries class GetID < ActiveInteraction::Base string :product_url def execute return unless product_code "#{site_code}#{product_code}" end private def site_code @site_code ||= MercadolibreApi::Sites::Queries::GetCode.run!(product_url: product_url) end def product_code code_matches = URI(product_url).path.match(/#{site_code}-(\d*)-/) return unless code_matches code_matches[1] end end end end end
Version data entries
3 entries across 3 versions & 1 rubygems