Class: Rotten_tomatoes::Movie

Inherits:
Object
  • Object
show all
Defined in:
lib/rotten-tomatoes.rb

Overview

Rotten_tomatoes::Movie is a class that organizes the scraped information about the movie into easily accessible attribues.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(movie_url) ⇒ Movie

Returns a new instance of Movie.



77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
# File 'lib/rotten-tomatoes.rb', line 77

def initialize movie_url
  @info_page = Nokogiri::HTML(open(URI.parse(Rotten_tomatoes::Base_url + movie_url)))
  if @info_page
    set_title_and_year
    set_cast
    set_writers
    set_directors
    set_people
    set_runtime
    set_rating
    set_tomatometer
    set_tomatometer_average_rating
    set_tomatometer_reviews_counted
    set_tomatometer_fresh_and_rotten
    set_audience_rating
    set_audience_average_rating
    set_audience_number_of_ratings
    set_genres
    set_release
    set_distributor
  end
  @info_page = nil
  return self
end

Instance Attribute Details

#audience_average_ratingObject (readonly)

Returns the value of attribute audience_average_rating.



75
76
77
# File 'lib/rotten-tomatoes.rb', line 75

def audience_average_rating
  @audience_average_rating
end

#audience_number_of_ratingsObject (readonly)

Returns the value of attribute audience_number_of_ratings.



75
76
77
# File 'lib/rotten-tomatoes.rb', line 75

def audience_number_of_ratings
  @audience_number_of_ratings
end

#audience_ratingObject (readonly)

Returns the value of attribute audience_rating.



75
76
77
# File 'lib/rotten-tomatoes.rb', line 75

def audience_rating
  @audience_rating
end

#castObject (readonly)

Returns the value of attribute cast.



75
76
77
# File 'lib/rotten-tomatoes.rb', line 75

def cast
  @cast
end

#directorsObject (readonly)

Returns the value of attribute directors.



75
76
77
# File 'lib/rotten-tomatoes.rb', line 75

def directors
  @directors
end

#distributorObject (readonly)

Returns the value of attribute distributor.



75
76
77
# File 'lib/rotten-tomatoes.rb', line 75

def distributor
  @distributor
end

#genresObject (readonly)

Returns the value of attribute genres.



75
76
77
# File 'lib/rotten-tomatoes.rb', line 75

def genres
  @genres
end

#info_pageObject (readonly)

Returns the value of attribute info_page.



75
76
77
# File 'lib/rotten-tomatoes.rb', line 75

def info_page
  @info_page
end

#peopleObject (readonly)

Returns the value of attribute people.



75
76
77
# File 'lib/rotten-tomatoes.rb', line 75

def people
  @people
end

#ratingObject (readonly)

Returns the value of attribute rating.



75
76
77
# File 'lib/rotten-tomatoes.rb', line 75

def rating
  @rating
end

#releaseObject (readonly)

Returns the value of attribute release.



75
76
77
# File 'lib/rotten-tomatoes.rb', line 75

def release
  @release
end

#runtimeObject (readonly)

Returns the value of attribute runtime.



75
76
77
# File 'lib/rotten-tomatoes.rb', line 75

def runtime
  @runtime
end

#titleObject (readonly)

Returns the value of attribute title.



75
76
77
# File 'lib/rotten-tomatoes.rb', line 75

def title
  @title
end

#tomatometerObject (readonly)

Returns the value of attribute tomatometer.



75
76
77
# File 'lib/rotten-tomatoes.rb', line 75

def tomatometer
  @tomatometer
end

#tomatometer_average_ratingObject (readonly)

Returns the value of attribute tomatometer_average_rating.



75
76
77
# File 'lib/rotten-tomatoes.rb', line 75

def tomatometer_average_rating
  @tomatometer_average_rating
end

#tomatometer_freshObject (readonly)

Returns the value of attribute tomatometer_fresh.



75
76
77
# File 'lib/rotten-tomatoes.rb', line 75

def tomatometer_fresh
  @tomatometer_fresh
end

#tomatometer_reviews_countedObject (readonly)

Returns the value of attribute tomatometer_reviews_counted.



75
76
77
# File 'lib/rotten-tomatoes.rb', line 75

def tomatometer_reviews_counted
  @tomatometer_reviews_counted
end

#tomatometer_rottenObject (readonly)

Returns the value of attribute tomatometer_rotten.



75
76
77
# File 'lib/rotten-tomatoes.rb', line 75

def tomatometer_rotten
  @tomatometer_rotten
end

#writersObject (readonly)

Returns the value of attribute writers.



75
76
77
# File 'lib/rotten-tomatoes.rb', line 75

def writers
  @writers
end

#yearObject (readonly)

Returns the value of attribute year.



75
76
77
# File 'lib/rotten-tomatoes.rb', line 75

def year
  @year
end

Instance Method Details

#directorObject



204
205
206
# File 'lib/rotten-tomatoes.rb', line 204

def director
  @directors.first
end

#writerObject



208
209
210
# File 'lib/rotten-tomatoes.rb', line 208

def writer
  @writers.first
end