Sha256: 29214417876757077d4a89e498c65b5bd581303b6f0d9408d664d5b0bf6e0857

Contents?: true

Size: 670 Bytes

Versions: 1

Compression:

Stored size: 670 Bytes

Contents

require "hashie"

module Fletcher
  module Item
    class Base < ::Hashie::Mash
         
      # Create a product object based on service
      #   Fletcher::Item::Base.generate(:amazon, "<html>...") # => #<Fletcher::Item::Amazon:0x...> 
      def self.generate(service = nil, data = nil)
        case service.downcase.to_sym
        when :amazon
          return Fletcher::Item::Amazon.new(data)
        when :ebay
        end 
      end

      # Parse data and set object attributes    
      def parse(data)
        @doc = data # save data for if user wants to access it later      
      end      
    end # Base
  end # Product
end # Fletcher

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
fletcher-0.1.0 lib/fletcher/item/base.rb