Sha256: 6073ba534fac4023e0afe751e1203ae1b8ffa66679ef7874513b5bec18d33edb

Contents?: true

Size: 1.05 KB

Versions: 1

Compression:

Stored size: 1.05 KB

Contents

module Stew
  module Community

    #Represents a Steam Game owned by a Steam Id
    class ProfileGame
      attr_reader :app_id

      attr_reader :name

      attr_reader :logo

      attr_reader :store_link

      attr_reader :playtime_2weeks

      attr_reader :playtime_forever

      def initialize(hash)
        @app_id = hash['appid'].to_i
        @name = hash['name']
        @logo = hash['logo']
        @playtime_2weeks = hash['playtime_2weeks'].to_i
        @playtime_forever = hash['playtime_forever'].to_i
        @img_logo_url = hash['img_logo_url']
        @img_icon_url = hash['img_icon_url']
      end

      def store_url
        "http://store.steampowered.com/app/#{@app_id}"
      end

      def community_url
        "http://steamcommunity.com/app/#{@app_id}"
      end

      def icon
        "http://media.steampowered.com/steamcommunity/public/images/apps/#{@app_id}/#{@img_icon_url}.jpg"
      end

      def logo
        "http://media.steampowered.com/steamcommunity/public/images/apps/#{@app_id}/#{@img_logo_url}.jpg"
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
stew-0.6.0 lib/stew/community/profile_game.rb