class Genius::Song

Attributes

annotation_count[R]
bop_url[R]
current_user_metadata[R]
description[R]
description_annotation[R]
header_image_url[R]
id[R]
lyrics_updated_at[R]
media[R]
pyongs_count[R]
stats[R]
title[R]
tracking_paths[R]
updated_by_human_at[R]
url[R]
verified_annotations_by[R]

Public Class Methods

Public Instance Methods

parse_resource!() click to toggle source
# File lib/genius/song.rb, line 19
def parse_resource!
  @id = resource["id"]
  @url = resource["url"]
  @title = resource["title"]
  @media = resource["media"]
  @description_annotation = resource["description_annotation"]
  @annotation_count = resource["annotation_count"]
  @tracking_paths = resource["tracking_paths"]
  @description = formatted_attribute("description")
  @bop_url = resource["bop_url"]
  @header_image_url = resource["header_image_url"]

  if resource["updated_by_human_at"]
    @updated_by_human_at = Time.at(resource["updated_by_human_at"])
  end

  if resource["lyrics_updated_at"]
    @lyrics_updated_at = Time.at(resource["lyrics_updated_at"])
  end

  @pyongs_count = resource["pyongs_count"]
  @stats = resource["stats"]
  @current_user_metadata = resource["current_user_metadata"]
  @verified_annotations_by = resource["verified_annotations_by"]
end
primary_artist() click to toggle source
# File lib/genius/song.rb, line 63
def primary_artist
  @primary_artist ||= Artist.from_hash(resource["primary_artist"])
end
producer_artists() click to toggle source
# File lib/genius/song.rb, line 51
def producer_artists
  @featured_artists ||= resource["producer_artists"].map do |artist|
    Artist.from_hash(artist)
  end
end
writer_artists() click to toggle source
# File lib/genius/song.rb, line 57
def writer_artists
  @featured_artists ||= resource["writer_artists"].map do |artist|
    Artist.from_hash(artist)
  end
end