Sha256: 28eebb94bcc0c63124d191370550ec72c39779890a005a17f0add2ff67fd8bc3

Contents?: true

Size: 1011 Bytes

Versions: 4

Compression:

Stored size: 1011 Bytes

Contents

module Fletcher
  module Model
    class Steam < Fletcher::Model::Base
      # A regular expression for determining if a url comes from a specific service/website
      def self.regexp
        /store\.steampowered\.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.css('div#main_content div.apphub_AppName').first_string

          # Get Description
          self.description = doc.css("div#main_content div#game_area_description").first_string   

          # Get Price
          parse_price( doc.css('div.leftcol.game_description_column div.game_purchase_price.price').first_string )
                          
          # Get Images
          self.images = doc.css('div.screenshot_holder a[@href]').attribute_array.collect{|img| img[:href] }
          self.image = images.first
        end
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
fletcher-0.6.0 lib/fletcher/models/steam.rb
fletcher-0.5.2 lib/fletcher/models/steam.rb
fletcher-0.5.1 lib/fletcher/models/steam.rb
fletcher-0.5.0 lib/fletcher/models/steam.rb