filmbuff 0.1.5 → 0.1.6

Sign up to get free protection for your applications and to get access to all the features.
data/.gitignore CHANGED
@@ -5,3 +5,4 @@ pkg/*
5
5
  .DS_Store
6
6
  .rvmrc
7
7
  .rspec
8
+ vendor
data/History CHANGED
@@ -1,40 +1,52 @@
1
- == 0.1.5
1
+ === 0.1.6 / 2012-07-24
2
+
3
+ * 1 minor enhancement
4
+
5
+ * Updated find_by_title to use IMDb's new search API
6
+
7
+ === 0.1.5 / 2011-03-15
8
+
9
+ * 3 major enhancements
2
10
 
3
- * major enhancements
4
11
  * Ruby 1.8.x support. Only tested with 1.8.7-p334 but it should work with
5
- versions below as well. I don't intend to test with 1.8.x again, so consider
6
- yourself warned.
7
- * Use the new HTTParty-Icebox gem instead of vendoring the code.
8
- * Changed runtime format. Now returns the length in seconds rather than
9
- minutes, allowing greater customization.
12
+ versions below as well. I don't intend to test with 1.8.x again, so consider yourself warned
13
+ * Use the new HTTParty-Icebox gem instead of vendoring the code
14
+ * Changed runtime format. Now returns the length in seconds rather than
15
+ minutes, allowing greater customization
16
+
17
+ * 1 minor enhancement
10
18
 
11
- * minor enhancements
12
19
  * Removed redundant Rspec tests.
13
20
 
14
- == 0.1.2 2011-03-07
21
+ === 0.1.2 / 2011-03-07
22
+
23
+ * 2 minor enhancements
15
24
 
16
- * minor enhancements
17
25
  * Fixed locale support
18
26
  * Added part about locale to README
19
27
 
20
- == 0.1.1 2011-03-06
28
+ === 0.1.1 / 2011-03-06
29
+
30
+ * 1 minor enhancement
21
31
 
22
- * minor enhancements
23
32
  * Included "Readme.markdown" in released gem.
24
33
 
25
- == 0.1.0 2011-03-06
34
+ === 0.1.0 / 2011-03-06
35
+
36
+ * 2 major enhancements
26
37
 
27
- * major enhancements
28
38
  * Rewrote everything from the ground up. A lot of unnecessary functionality
29
39
  has been removed.
30
40
  * Added RSpec tests
31
41
 
32
- == 0.0.2 2010-09-30
42
+ === 0.0.2 / 2010-09-30
43
+
44
+ * 1 minor enhancement
33
45
 
34
- * minor enhancements
35
46
  * Renamed "HISTORY" to "History"
36
47
 
37
- == 0.0.1 2010-09-06
48
+ === 0.0.1 / 2010-09-06
49
+
50
+ * 1 major enhancement
38
51
 
39
- * major enhancements
40
52
  * Alpha release - Code needs to be cleaned up before 0.1.0
data/LICENSE CHANGED
@@ -1,4 +1,4 @@
1
- Copyright (c) 2011 Kristoffer Sachse
1
+ Copyright (c) 2012 Kristoffer Sachse
2
2
 
3
3
  Permission is hereby granted, free of charge, to any person obtaining
4
4
  a copy of this software and associated documentation files (the
data/filmbuff.gemspec CHANGED
@@ -14,9 +14,9 @@ Gem::Specification.new do |s|
14
14
 
15
15
  s.rubyforge_project = "filmbuff"
16
16
 
17
- s.add_dependency("httparty", "~> 0.7.4")
18
- s.add_dependency("httparty-icebox", "~> 0.0.1")
19
- s.add_development_dependency("rspec", "~> 2.5.0")
17
+ s.add_dependency("httparty", "~> 0.8.3")
18
+ s.add_dependency("httparty-icebox", "~> 0.0.4")
19
+ s.add_development_dependency("rspec", ">= 2.5.0")
20
20
 
21
21
  s.files = `git ls-files`.split("\n")
22
22
  s.test_files = `git ls-files -- {spec}/*`.split("\n")
data/lib/filmbuff/imdb.rb CHANGED
@@ -7,12 +7,7 @@ module FilmBuff
7
7
  cache :store => 'memory', :timeout => 120
8
8
 
9
9
  base_uri 'app.imdb.com'
10
- default_params = {
11
- "api" => "v1",
12
- "app_id" => "iphone1_1",
13
- "timestamp" => Time.now.utc.to_i,
14
- "sig" => "app1_1"
15
- }
10
+ format :json
16
11
 
17
12
  def initialize
18
13
  @locale = "en_US"
@@ -27,10 +22,21 @@ module FilmBuff
27
22
  end
28
23
 
29
24
  def find_by_title(title)
30
- results = self.class.get('/find', :query => {
31
- :q => title, :locale => @locale
25
+ result = self.class.get('http://www.imdb.com/xml/find', :query => {
26
+ :q => title,
27
+ :json => '1',
28
+ :tt => 'on'
32
29
  }).parsed_response
33
- find_by_id(results["data"]["results"][0]["list"][0]["tconst"])
30
+
31
+ %w(title_popular title_exact title_approx title_substring).each do |key|
32
+ if result[key]
33
+ result[key].each do |row|
34
+ next unless row['id'] && row['title'] && row['description']
35
+
36
+ return self.find_by_id(row['id'])
37
+ end
38
+ end
39
+ end
34
40
  end
35
41
  end
36
42
  end
@@ -13,8 +13,8 @@ module FilmBuff
13
13
  @votes = options["num_votes"]
14
14
  @poster_url = options["image"]["url"] if options["image"]
15
15
  @genres = options["genres"] || []
16
- @release_date = options["release_date"]["normal"] if
17
- options["release_date"]["normal"]
16
+ @release_date = Date.strptime(options["release_date"]["normal"]) if
17
+ options["release_date"]
18
18
  end
19
19
  end
20
20
  end
@@ -1,3 +1,3 @@
1
1
  module Filmbuff
2
- VERSION = "0.1.5"
2
+ VERSION = "0.1.6"
3
3
  end
@@ -17,8 +17,7 @@ describe FilmBuff::Title do
17
17
  end
18
18
 
19
19
  it "has a tagline" do
20
- @title.tagline.should == "\"The Wizard\" Musical Returns By " <<
21
- "Unprecedented Demand! [UK re-release]"
20
+ @title.tagline.should == "Mighty Miracle Show Of 1000 Delights !"
22
21
  end
23
22
 
24
23
  it "has a plot" do
@@ -44,11 +43,11 @@ describe FilmBuff::Title do
44
43
  end
45
44
 
46
45
  it "has genres" do
47
- @title.genres.should == %w[ Adventure Comedy Family Fantasy Musical ]
46
+ @title.genres.should == %w[ Adventure Family Fantasy Musical ]
48
47
  end
49
48
 
50
49
  it "has a release date" do
51
- @title.release_date.should == DateTime.parse("1939-08-25")
50
+ @title.release_date.should == Date.parse("1939-08-25")
52
51
  end
53
52
  end
54
53
 
metadata CHANGED
@@ -1,61 +1,72 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: filmbuff
3
- version: !ruby/object:Gem::Version
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.6
4
5
  prerelease:
5
- version: 0.1.5
6
6
  platform: ruby
7
- authors:
7
+ authors:
8
8
  - Kristoffer Sachse
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
-
13
- date: 2011-03-15 00:00:00 +01:00
14
- default_executable:
15
- dependencies:
16
- - !ruby/object:Gem::Dependency
12
+ date: 2012-07-24 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
17
15
  name: httparty
18
- prerelease: false
19
- requirement: &id001 !ruby/object:Gem::Requirement
16
+ requirement: !ruby/object:Gem::Requirement
20
17
  none: false
21
- requirements:
18
+ requirements:
22
19
  - - ~>
23
- - !ruby/object:Gem::Version
24
- version: 0.7.4
20
+ - !ruby/object:Gem::Version
21
+ version: 0.8.3
25
22
  type: :runtime
26
- version_requirements: *id001
27
- - !ruby/object:Gem::Dependency
28
- name: httparty-icebox
29
23
  prerelease: false
30
- requirement: &id002 !ruby/object:Gem::Requirement
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ~>
28
+ - !ruby/object:Gem::Version
29
+ version: 0.8.3
30
+ - !ruby/object:Gem::Dependency
31
+ name: httparty-icebox
32
+ requirement: !ruby/object:Gem::Requirement
31
33
  none: false
32
- requirements:
34
+ requirements:
33
35
  - - ~>
34
- - !ruby/object:Gem::Version
35
- version: 0.0.1
36
+ - !ruby/object:Gem::Version
37
+ version: 0.0.4
36
38
  type: :runtime
37
- version_requirements: *id002
38
- - !ruby/object:Gem::Dependency
39
- name: rspec
40
39
  prerelease: false
41
- requirement: &id003 !ruby/object:Gem::Requirement
40
+ version_requirements: !ruby/object:Gem::Requirement
42
41
  none: false
43
- requirements:
42
+ requirements:
44
43
  - - ~>
45
- - !ruby/object:Gem::Version
44
+ - !ruby/object:Gem::Version
45
+ version: 0.0.4
46
+ - !ruby/object:Gem::Dependency
47
+ name: rspec
48
+ requirement: !ruby/object:Gem::Requirement
49
+ none: false
50
+ requirements:
51
+ - - ! '>='
52
+ - !ruby/object:Gem::Version
46
53
  version: 2.5.0
47
54
  type: :development
48
- version_requirements: *id003
49
- description: Film Buff provides a Ruby wrapper for IMDb's JSON API, which is the fastest and easiest way to get information from IMDb.
50
- email:
55
+ prerelease: false
56
+ version_requirements: !ruby/object:Gem::Requirement
57
+ none: false
58
+ requirements:
59
+ - - ! '>='
60
+ - !ruby/object:Gem::Version
61
+ version: 2.5.0
62
+ description: Film Buff provides a Ruby wrapper for IMDb's JSON API, which is the fastest
63
+ and easiest way to get information from IMDb.
64
+ email:
51
65
  - kristoffer@sachse.nu
52
66
  executables: []
53
-
54
67
  extensions: []
55
-
56
68
  extra_rdoc_files: []
57
-
58
- files:
69
+ files:
59
70
  - .gitignore
60
71
  - Gemfile
61
72
  - History
@@ -71,33 +82,28 @@ files:
71
82
  - spec/filmbuff/title_spec.rb
72
83
  - spec/filmbuff_spec.rb
73
84
  - spec/spec_helper.rb
74
- has_rdoc: true
75
85
  homepage: https://github.com/sachse/filmbuff
76
86
  licenses: []
77
-
78
87
  post_install_message:
79
88
  rdoc_options: []
80
-
81
- require_paths:
89
+ require_paths:
82
90
  - lib
83
- required_ruby_version: !ruby/object:Gem::Requirement
91
+ required_ruby_version: !ruby/object:Gem::Requirement
84
92
  none: false
85
- requirements:
86
- - - ">="
87
- - !ruby/object:Gem::Version
88
- version: "0"
89
- required_rubygems_version: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - ! '>='
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
97
+ required_rubygems_version: !ruby/object:Gem::Requirement
90
98
  none: false
91
- requirements:
92
- - - ">="
93
- - !ruby/object:Gem::Version
94
- version: "0"
99
+ requirements:
100
+ - - ! '>='
101
+ - !ruby/object:Gem::Version
102
+ version: '0'
95
103
  requirements: []
96
-
97
104
  rubyforge_project: filmbuff
98
- rubygems_version: 1.6.2
105
+ rubygems_version: 1.8.24
99
106
  signing_key:
100
107
  specification_version: 3
101
108
  summary: A Ruby wrapper for IMDb's JSON API
102
109
  test_files: []
103
-