class NasaApod::SearchResults
Attributes
copyright[RW]
date[RW]
explanation[RW]
hd_url[RW]
media_type[RW]
thumbnail_url[R]
title[RW]
url[RW]
Public Class Methods
new(attributes={})
click to toggle source
# File lib/nasa_apod/search_results.rb, line 7 def initialize(attributes={}) @url = attributes["url"] @media_type = attributes["media_type"] @explanation = attributes["explanation"] @title = attributes["title"] @hd_url = attributes["hdurl"] @date = attributes["date"] @copyright = attributes["copyright"] end
Private Instance Methods
youtube_id()
click to toggle source
# File lib/nasa_apod/search_results.rb, line 27 def youtube_id @url.match(/(?:youtube\.com\/(?:[^\/]+\/.+\/|(?:v|e(?:mbed)?)\/|.*[?&]v=)|youtu\.be\/)([^"&?\/ ]{11})/)[1] end