class SleeperRb::Resources::Avatar

The Avatar class allows access to full-size or thumbnail URLs for user avatars.

Attributes

avatar_id[R]

Public Instance Methods

full_size() click to toggle source

Returns the full size image for the Avatar

@return [Tempfile]

# File lib/sleeper_rb/resources/avatar.rb, line 15
      
thumbnail() click to toggle source

Returns the full size image for the Avatar

@return [Tempfile]

# File lib/sleeper_rb/resources/avatar.rb, line 26
cached_attr :full_size, :thumbnail, :avatar_id

Private Instance Methods

retrieve_values!() click to toggle source
# File lib/sleeper_rb/resources/avatar.rb, line 30
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