rotten-tomatoes 0.1.2 → 0.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/README.rdoc CHANGED
@@ -1,9 +1,39 @@
1
1
  = rotten-tomatoes
2
2
 
3
- Description goes here.
3
+ install the gem
4
+
5
+ gem install rotten-tomatoes
6
+
7
+ use it
8
+
9
+ require 'rubygems'
10
+ require 'rotten-tomatoes'
11
+
12
+ # get a movie
13
+ movie = Rotten_tomatoes::lucky_get_info 'evil dead'
14
+
15
+ # do stuff with it
16
+ puts movie.title
17
+ puts movie.year
18
+ puts movie.runtime
19
+ puts movie.rating
20
+ puts movie.tomatometer
21
+ puts movie.tomatometer_average_rating
22
+ puts movie.tomatometer_reviews_counted
23
+ puts movie.tomatometer_fresh
24
+ puts movie.tomatometer_rotten
25
+ puts movie.audience_rating
26
+ puts movie.number_of_ratings
27
+ puts movie.number_of_critic_reviews
28
+ puts movie.genres
29
+ puts movie.release
30
+ puts movie.distributor
31
+
32
+ movie.cast.each do |cast_member|
33
+ end
4
34
 
5
35
  == Note on Patches/Pull Requests
6
-
36
+
7
37
  * Fork the project.
8
38
  * Make your feature addition or bug fix.
9
39
  * Add tests for it. This is important so I don't break it in a
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.2
1
+ 0.1.3
@@ -50,7 +50,7 @@ module Rotten_tomatoes
50
50
  # information about the movie into easily accessible attribues.
51
51
  class Movie
52
52
 
53
- attr_reader :info_page, :title, :year, :people, :cast, :writers, :directors, :runtime, :rating, :tomatometer, :tomatometer_average_rating, :tomatometer_reviews_counted, :tomatometer_fresh, :tomatometer_rotten, :audience_rating, :number_of_ratings, :number_of_critic_reviews, :fresh_reviews, :rotten_reviews, :average_critic_rating, :genres, :release, :distributor
53
+ attr_reader :info_page, :title, :year, :people, :cast, :writers, :directors, :runtime, :rating, :tomatometer, :tomatometer_average_rating, :tomatometer_reviews_counted, :tomatometer_fresh, :tomatometer_rotten, :audience_rating, :audience_average_rating, :audience_number_of_ratings, :genres, :release, :distributor
54
54
 
55
55
  def initialize movie_url
56
56
  @info_page = Nokogiri::HTML(open(URI.parse(Rotten_tomatoes::Base_url + movie_url)))
@@ -89,10 +89,10 @@ module Rotten_tomatoes
89
89
  @cast = []
90
90
  @info_page.css('#cast-info li').each do |person|
91
91
  @cast.push({
92
- 'name' => person.css('a').inner_html,
93
- 'info_path' => person.css('a').first['href'],
94
- 'thumbnail' => person.css('img').first['src'],
95
- 'characters'=> person.css('.characters').first.content.gsub(/\(\)/, '')
92
+ :name => person.css('a').inner_html,
93
+ :info_path => person.css('a').first['href'],
94
+ :thumbnail => person.css('img').first['src'],
95
+ :characters => person.css('.characters').first.text.gsub('(', '').gsub(')', '')
96
96
  })
97
97
  end
98
98
  end
@@ -101,8 +101,8 @@ module Rotten_tomatoes
101
101
  @writers = []
102
102
  @info_page.css('.movie_info .right_col p:nth-child(3) a').each do |writer|
103
103
  @writers.push({
104
- 'name' => writer.inner_html,
105
- 'info_path' => writer['href']
104
+ :name => writer.inner_html,
105
+ :info_path => writer['href']
106
106
  })
107
107
  end
108
108
  end
@@ -111,8 +111,8 @@ module Rotten_tomatoes
111
111
  @directors = []
112
112
  @info_page.css('.movie_info .right_col p:nth-child(2) a').each do |director|
113
113
  @directors.push({
114
- 'name' => director.inner_html,
115
- 'info_path' => director['href']
114
+ :name => director.inner_html,
115
+ :info_path => director['href']
116
116
  })
117
117
  end
118
118
  end
@@ -148,17 +148,22 @@ module Rotten_tomatoes
148
148
  end
149
149
 
150
150
  def set_audience_rating
151
+ @audience_rating = @info_page.css('.fan_side .meter').text
151
152
  end
152
153
 
153
154
  def set_audience_average_rating
155
+ match = @info_page.css('.fan_side .critic_stats').text.match(/Average Rating: ([\d\.]+)\//)
156
+ @audience_average_rating = match[1]
154
157
  end
155
158
 
156
159
  def set_audience_number_of_ratings
160
+ match = @info_page.css('.fan_side .critic_stats').text.match(/User Ratings: (\d+)/)
161
+ @audience_number_of_ratings = match[1]
157
162
  end
158
163
 
159
164
  def set_genres
160
165
  @genres = []
161
- @info_page.css('.movie_info p:first-of-type .content a').each do |genre|
166
+ @info_page.css('.movie_info > p:first-of-type .content a').each do |genre|
162
167
  @genres.push genre.text
163
168
  end
164
169
  end
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{rotten-tomatoes}
8
- s.version = "0.1.2"
8
+ s.version = "0.1.3"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["atom smith"]
12
- s.date = %q{2011-01-07}
12
+ s.date = %q{2011-01-08}
13
13
  s.description = %q{Allows you to search and get information about movies from rottentomatoes.com. Organizes returned information into easy to access attributes.}
14
14
  s.email = %q{re5etsmyth@gmail.com}
15
15
  s.extra_rdoc_files = [
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 1
8
- - 2
9
- version: 0.1.2
8
+ - 3
9
+ version: 0.1.3
10
10
  platform: ruby
11
11
  authors:
12
12
  - atom smith
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2011-01-07 00:00:00 -08:00
17
+ date: 2011-01-08 00:00:00 -08:00
18
18
  default_executable:
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency