Sha256: e73f2b1c51d02382acd5fb54cdff2aecce034635c095715fb62f2de6681b1756
Contents?: true
Size: 1021 Bytes
Versions: 3
Compression:
Stored size: 1021 Bytes
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[@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
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
fletcher-0.4.2 | lib/fletcher/models/etsy.rb |
fletcher-0.4.1 | lib/fletcher/models/etsy.rb |
fletcher-0.4.0 | lib/fletcher/models/etsy.rb |