Sha256: 8db99e7eb025c3500b144ed91ee9a31fb4e50f33b3f5a5953ca430bd28191a3e
Contents?: true
Size: 628 Bytes
Versions: 5
Compression:
Stored size: 628 Bytes
Contents
require 'active_interaction' 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
5 entries across 5 versions & 1 rubygems