ruby-imdb 0.7.0 → 0.7.1

Sign up to get free protection for your applications and to get access to all the features.
data/Rakefile CHANGED
@@ -15,6 +15,7 @@ begin
15
15
  s.add_dependency "mongo", ">= 1.0.1"
16
16
  s.add_dependency "mongo_mapper", ">= 0.7.5"
17
17
  s.add_dependency "chronic", ">= 0.2.3"
18
+ #s.add_dependency "rack", ">= 1.1.0"
18
19
  end
19
20
  rescue LoadError
20
21
  puts "Jeweler not available. Install it with: gem install jeweler"
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.7.0
1
+ 0.7.1
@@ -19,4 +19,3 @@ require "imdb/search"
19
19
  require "imdb/movie"
20
20
  require "imdb/person"
21
21
 
22
-
@@ -12,9 +12,9 @@ module IMDB
12
12
  super("Movie", {:imdb_id => String,
13
13
  :poster => String,
14
14
  :title => String,
15
+ :release_date => String,
15
16
  :cast => Array,
16
17
  :photos => Array,
17
- :release_date => String,
18
18
  :director => String,
19
19
  :genres => Array,
20
20
  :writers => Array}, [:imdb_id])
@@ -51,21 +51,21 @@ module IMDB
51
51
  # Get movie photos
52
52
  # @return [Array]
53
53
  def photos
54
- doc.search("img").map { |img|
55
- unless img["src"][/_CR/].nil?
56
- img["src"]
57
- end
58
- }.compact
59
- rescue
60
- nil
61
-
54
+ begin
55
+ doc.search("img").map { |img|
56
+ unless img["src"][/_CR/].nil?
57
+ img["src"]
58
+ end
59
+ }
60
+ rescue
61
+ nil
62
+ end
62
63
  end
63
64
 
64
65
  # Get release date
65
66
  # @return [String]
66
67
  def release_date
67
- Date.parse(Chronic.parse(doc.xpath("//h5[contains(., 'Release Date')]/..").first.content[/^\d{1,2} \w+ \d{4}/]).strftime('%Y/%m/%d'))
68
- rescue nil
68
+ Date.parse(Chronic.parse(doc.xpath("//h5[contains(., 'Release Date')]/..").first.content[/^\d{1,2} \w+ \d{4}/]).strftime('%Y/%m/%d')).to_s rescue nil
69
69
  end
70
70
 
71
71
  # Get Director
@@ -90,7 +90,7 @@ module IMDB
90
90
  doc.xpath("//a[@name='writers']/../../../..").search('a[@href^="/name/nm"]').map {|w|
91
91
  name = w.content
92
92
  profile = w['href']
93
- IMDB::Person.new(@imdb_id, name, nil, profile, nil)
93
+ IMDB::Person.new(@imdb_id, name, "nil", profile, "nil")
94
94
  }
95
95
  end
96
96
 
@@ -1,5 +1,5 @@
1
1
  module IMDB
2
- class Search
2
+ class Search < IMDB::Skeleton
3
3
  def self.movie(keyword)
4
4
  doc = Nokogiri::HTML(open("http://www.imdb.com/find?s=tt&q=#{CGI.escape(keyword)}"))
5
5
  ret_val = []
@@ -11,7 +11,7 @@ module IMDB
11
11
 
12
12
  end # Search
13
13
 
14
- class Result
14
+ class Result < IMDB::Skeleton
15
15
  attr_accessor :id, :title, :link, :year
16
16
 
17
17
  def initialize(id, title, link)
@@ -28,14 +28,13 @@ module IMDB
28
28
  end
29
29
 
30
30
  if @db_query[meth].nil? or (@db_query[meth].length.zero? if @db_query[meth].kind_of?(Array))
31
-
32
31
  a = send(old_meth)
33
32
  if a.kind_of?(Array)
34
33
  a.compact!
35
- a.map! {
36
- |c|
37
- c.to_hash
38
- }
34
+ #a.map! {
35
+ # |c|
36
+ # c.to_hash
37
+ #}.compact
39
38
  @db_query[meth] = a
40
39
  else
41
40
  @db_query[meth] = a
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{ruby-imdb}
8
- s.version = "0.7.0"
8
+ s.version = "0.7.1"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Yalcin Acikyildiz"]
12
- s.date = %q{2010-05-24}
12
+ s.date = %q{2010-05-30}
13
13
  s.description = %q{Ruby IMDB Parsing Library}
14
14
  s.email = %q{yalcin@webliyacelebi.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
  - 7
8
- - 0
9
- version: 0.7.0
8
+ - 1
9
+ version: 0.7.1
10
10
  platform: ruby
11
11
  authors:
12
12
  - Yalcin Acikyildiz
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2010-05-24 00:00:00 -04:00
17
+ date: 2010-05-30 00:00:00 +03:00
18
18
  default_executable:
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency