myimdb 0.4.2 → 0.4.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.
Files changed (5) hide show
  1. data/README.rdoc +4 -2
  2. data/VERSION +1 -1
  3. data/lib/myimdb.rb +10 -4
  4. data/myimdb.gemspec +1 -1
  5. metadata +1 -1
@@ -57,9 +57,11 @@ Utility gem for fetching movie details.
57
57
  ~/m> myimdb-catalogue the\ dark\ knight/
58
58
  Fetching metadata for: the dark knight
59
59
  Renaming: the dark knight to: the dark knight [2008] [8.9,430594] [Christopher Nolan]
60
+ ~/m> ls
61
+ the dark knight [2008] [8.9,430594] [Christopher Nolan]
60
62
 
61
63
 
62
- ==== As a library
64
+ === As a library
63
65
 
64
66
  >> require 'myimdb'
65
67
  => true
@@ -74,7 +76,7 @@ Utility gem for fetching movie details.
74
76
  >> site.release_date.to_s
75
77
  => "2008-07-18"
76
78
 
77
- or
79
+ ==== or
78
80
 
79
81
  >> require 'myimdb'
80
82
  => true
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.4.2
1
+ 0.4.3
@@ -6,9 +6,15 @@ require 'open-uri'
6
6
  require 'myimdb/search'
7
7
  require 'myimdb/scraper'
8
8
 
9
- class ImdbMovie
10
- def self.search(movie_name)
11
- search_result = Myimdb::Search::Base.search(movie_name, :restrict_to=> 'imdb.com')[0]
12
- Myimdb::Scraper::Imdb.new(search_result[:url]) if search_result
9
+ ['Imdb', 'RottenTomatoes', 'Metacritic', 'Freebase'].each do |site|
10
+ klass = Object.const_set("#{site}Movie", Class.new)
11
+ klass.class_eval do
12
+ class << self
13
+ define_method :search do |movie_name|
14
+ site = self.to_s.gsub('Movie', '')
15
+ search_result = Myimdb::Search::Base.search(movie_name, :restrict_to=> "#{site.downcase}.com")[0]
16
+ eval("Myimdb::Scraper::#{site}").new(search_result[:url]) if search_result
17
+ end
18
+ end
13
19
  end
14
20
  end
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{myimdb}
8
- s.version = "0.4.2"
8
+ s.version = "0.4.3"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Gaurav"]
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: myimdb
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.2
4
+ version: 0.4.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gaurav