Sha256: f4dc3f14beb81a0a914272ce446ce7ce6ab51bd0f3c6113af87f0c9db7db40d4

Contents?: true

Size: 559 Bytes

Versions: 1

Compression:

Stored size: 559 Bytes

Contents

module StarParty
  module Adapters
    class Macys
      include Capybara::DSL

      def visit_site
        visit("https://www.macys.com")
      end

      def search_for(web_id)
       fill_in "globalSearchInputField", with: web_id
       click_button "subnavSearchSubmit"

       get_price
      end

      private

      def get_price
        price_element = find('.priceSale') || find('.singlePrice')
        parse_currency(price_element.text)
      end

      def parse_currency(price)
        price.match(/\$(.*)$/)[1].to_f
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
star_party-1.0.1 lib/star_party/adapters/macys.rb