Sha256: aab053fcfe2fb22ad53171fdaf66e8deae2fc576fdea22b5369f0da9d5512a0a
Contents?: true
Size: 1.02 KB
Versions: 2
Compression:
Stored size: 1.02 KB
Contents
# frozen_string_literal: true module SleeperRb module Resources ## # The Avatar class allows access to full-size or thumbnail URLs for user avatars. class Avatar include SleeperRb::Utilities::Request include SleeperRb::Utilities::Cache ## # :attr_reader: avatar_id ## # :method: full_size # Returns the full size image for the Avatar # # @return [Tempfile] ## # :method: thumbnail # Returns the full size image for the Avatar # # @return [Tempfile] cached_attr :full_size, :thumbnail, :avatar_id private def retrieve_values! full_url = "#{CDN_BASE_URL}/avatars/#{avatar_id}" full_file = download_file(full_url, "#{avatar_id}-full") thumb_url = "#{CDN_BASE_URL}/avatars/thumbs/#{avatar_id}" thumb_file = download_file(thumb_url, "#{avatar_id}-thumb") { full_size: full_file, thumbnail: thumb_file, avatar_id: avatar_id } end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
sleeper_rb-0.2.1 | lib/sleeper_rb/resources/avatar.rb |
sleeper_rb-0.2.0 | lib/sleeper_rb/resources/avatar.rb |