Class: AppleTrailers::Movie
- Inherits:
-
Object
- Object
- AppleTrailers::Movie
- Defined in:
- lib/apple_trailers/movie.rb
Instance Attribute Summary collapse
-
#actors ⇒ Object
Returns the value of attribute actors.
-
#directors ⇒ Object
Returns the value of attribute directors.
-
#genre ⇒ Object
Returns the value of attribute genre.
-
#location ⇒ Object
Returns the value of attribute location.
-
#moviesite ⇒ Object
Returns the value of attribute moviesite.
-
#rating ⇒ Object
Returns the value of attribute rating.
-
#studio ⇒ Object
Returns the value of attribute studio.
-
#title ⇒ Object
Returns the value of attribute title.
Instance Method Summary collapse
- #description ⇒ Object
-
#initialize(options) ⇒ Movie
constructor
A new instance of Movie.
- #trailers ⇒ Object
Constructor Details
#initialize(options) ⇒ Movie
Returns a new instance of Movie.
7 8 9 |
# File 'lib/apple_trailers/movie.rb', line 7 def initialize() .each { |key, value| instance_variable_set("@"+key.to_s, value)} end |
Instance Attribute Details
#actors ⇒ Object
Returns the value of attribute actors.
5 6 7 |
# File 'lib/apple_trailers/movie.rb', line 5 def actors @actors end |
#directors ⇒ Object
Returns the value of attribute directors.
5 6 7 |
# File 'lib/apple_trailers/movie.rb', line 5 def directors @directors end |
#genre ⇒ Object
Returns the value of attribute genre.
5 6 7 |
# File 'lib/apple_trailers/movie.rb', line 5 def genre @genre end |
#location ⇒ Object
Returns the value of attribute location.
5 6 7 |
# File 'lib/apple_trailers/movie.rb', line 5 def location @location end |
#moviesite ⇒ Object
Returns the value of attribute moviesite.
5 6 7 |
# File 'lib/apple_trailers/movie.rb', line 5 def moviesite @moviesite end |
#rating ⇒ Object
Returns the value of attribute rating.
5 6 7 |
# File 'lib/apple_trailers/movie.rb', line 5 def @rating end |
#studio ⇒ Object
Returns the value of attribute studio.
5 6 7 |
# File 'lib/apple_trailers/movie.rb', line 5 def studio @studio end |
#title ⇒ Object
Returns the value of attribute title.
5 6 7 |
# File 'lib/apple_trailers/movie.rb', line 5 def title @title end |
Instance Method Details
#description ⇒ Object
11 12 13 14 |
# File 'lib/apple_trailers/movie.rb', line 11 def description doc = Nokogiri::HTML(Net::HTTP.get(URI(["http://trailers.apple.com", @location].join('')))) doc.at('meta[@name="Description"]/@content').value end |
#trailers ⇒ Object
16 17 18 19 |
# File 'lib/apple_trailers/movie.rb', line 16 def trailers doc = Nokogiri::HTML(Net::HTTP.get(URI(["http://trailers.apple.com", @location, "includes/playlists/web.inc"].join('')))) doc.css('.trailer').count > 1 ? get_multiple_trailers(doc) : get_single_trailer(doc) end |