Sha256: 844a25366fe32e2926168063c2a8d74b85e7be56d5ba671ceef3f7b150d29313

Contents?: true

Size: 1 KB

Versions: 6

Compression:

Stored size: 1 KB

Contents

module Fletcher
  module Model
    class Etsy < Fletcher::Model::Base
      # A regular expression for determining if a url comes from a specific service/website
      def self.regexp
        /etsy\.com/
      end
        
      # Parse data and look for object attributes to give to object    
      def parse(data)
        super(data)
        
        case doc
        when Nokogiri::HTML::Document
          # Get Name
          self.name = doc.xpath("//div[@id='item-title']/h1").first_string

          # Get Description
          self.description = doc.xpath("//div[@id='item-description']/div[contains(@class,'section-content')]").first_string

          # Get Price
          parse_price(doc.xpath("//div[@class='item-amount']").first_string)
                          
          # Get Images
          self.images = doc.xpath("//div[@id='item-main']//div[@id='fullimage_link1']//img").attribute_array 
          self.image = images.first
        end            
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
fletcher-0.6.2 lib/fletcher/models/etsy.rb
fletcher-0.6.1 lib/fletcher/models/etsy.rb
fletcher-0.6.0 lib/fletcher/models/etsy.rb
fletcher-0.5.2 lib/fletcher/models/etsy.rb
fletcher-0.5.1 lib/fletcher/models/etsy.rb
fletcher-0.5.0 lib/fletcher/models/etsy.rb