ruby-tmdb 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.
@@ -1,232 +1,15 @@
1
- HTTP/1.1 200 OK
2
- Status: 200 OK
3
- Content-Type: text/x-yaml; charset=utf-8
4
- Transfer-Encoding: chunked
5
- Date: Sun, 16 May 2010 17:55:18 GMT
6
- X-Varnish: 4020117426
7
- Age: 0
8
- Via: 1.1 varnish
9
- Connection: keep-alive
10
- X-Cache: MISS
11
-
12
- ---
13
- - score: 25
14
- popularity: 3
15
- name: Vince Locke
16
- id: 4484
17
- biography: ""
18
- url: http://www.themoviedb.org/person/4484
19
- profile: []
20
-
21
- - score: 24
22
- popularity: 3
23
- name: Vince Deadrick Jr.
24
- id: 12879
25
- biography: ""
26
- url: http://www.themoviedb.org/person/12879
27
- profile: []
28
-
29
- - score: 23
30
- popularity: 3
31
- name: Vince Trankina
32
- id: 91412
33
- biography: ""
34
- url: http://www.themoviedb.org/person/91412
35
- profile: []
36
-
37
- - score: 22
38
- popularity: 3
39
- name: Pruitt Taylor Vince
40
- id: 3201
41
- biography: ""
42
- url: http://www.themoviedb.org/person/3201
43
- profile: []
44
-
45
- - score: 21
46
- popularity: 3
47
- name: Vince Edwards
48
- id: 3337
49
- biography: ""
50
- url: http://www.themoviedb.org/person/3337
51
- profile: []
52
-
53
- - score: 20
54
- popularity: 3
55
- name: Vince Vaughn
56
- id: 4937
57
- biography: ""
58
- url: http://www.themoviedb.org/person/4937
59
- profile:
60
- - image:
61
- type: profile
62
- size: original
63
- height: 1087
64
- width: 800
65
- url: http://i2.themoviedb.org/profiles/029/4bc9fe2c017a3c0e8b000029/vince-vaughn-original.jpg
66
- id: 4bc9fe2c017a3c0e8b000029
67
- - image:
68
- type: profile
69
- size: profile
70
- height: 251
71
- width: 185
72
- url: http://i2.themoviedb.org/profiles/029/4bc9fe2c017a3c0e8b000029/vince-vaughn-profile.jpg
73
- id: 4bc9fe2c017a3c0e8b000029
74
- - image:
75
- type: profile
76
- size: thumb
77
- height: 61
78
- width: 45
79
- url: http://i1.themoviedb.org/profiles/029/4bc9fe2c017a3c0e8b000029/vince-vaughn-thumb.jpg
80
- id: 4bc9fe2c017a3c0e8b000029
81
- - score: 19
82
- popularity: 3
83
- name: William Vince
84
- id: 5358
85
- biography: ""
86
- url: http://www.themoviedb.org/person/5358
87
- profile: []
88
-
89
- - score: 18
90
- popularity: 3
91
- name: Vince Oddone
92
- id: 9467
93
- biography: ""
94
- url: http://www.themoviedb.org/person/9467
95
- profile: []
96
-
97
- - score: 17
98
- popularity: 3
99
- name: Vince Barnett
100
- id: 13357
101
- biography: ""
102
- url: http://www.themoviedb.org/person/13357
103
- profile: []
104
-
105
- - score: 16
106
- popularity: 3
107
- name: Vince DiCola
108
- id: 16637
109
- biography: ""
110
- url: http://www.themoviedb.org/person/16637
111
- profile: []
112
-
113
- - score: 15
114
- popularity: 3
115
- name: Vince Palmieri
116
- id: 19446
117
- biography: ""
118
- url: http://www.themoviedb.org/person/19446
119
- profile: []
120
-
121
- - score: 14
122
- popularity: 3
123
- name: Alexander Vince
124
- id: 20058
125
- biography: ""
126
- url: http://www.themoviedb.org/person/20058
127
- profile: []
128
-
129
- - score: 13
130
- popularity: 3
131
- name: Barrie Vince
132
- id: 22154
133
- biography: ""
134
- url: http://www.themoviedb.org/person/22154
135
- profile: []
136
-
137
- - score: 12
138
- popularity: 3
139
- name: Robert Vince
140
- id: 25010
141
- biography: ""
142
- url: http://www.themoviedb.org/person/25010
143
- profile: []
144
-
145
- - score: 11
146
- popularity: 3
147
- name: Vince Desiderio
148
- id: 27591
149
- biography: ""
150
- url: http://www.themoviedb.org/person/27591
151
- profile: []
152
-
153
- - score: 10
154
- popularity: 3
155
- name: Vince Giordano
156
- id: 28009
157
- biography: ""
158
- url: http://www.themoviedb.org/person/28009
159
- profile: []
160
-
161
- - score: 9
162
- popularity: 3
163
- name: Pruitt Taylor Vince
164
- id: 28411
165
- biography: ""
166
- url: http://www.themoviedb.org/person/28411
167
- profile: []
168
-
169
- - score: 8
170
- popularity: 3
171
- name: Vince Di Meglio
172
- id: 29012
173
- biography: ""
174
- url: http://www.themoviedb.org/person/29012
175
- profile: []
176
-
177
- - score: 7
178
- popularity: 3
179
- name: Vince Murdocco
180
- id: 33585
181
- biography: ""
182
- url: http://www.themoviedb.org/person/33585
183
- profile: []
184
-
185
- - score: 6
186
- popularity: 3
187
- name: Vince Martin
188
- id: 45215
189
- biography: ""
190
- url: http://www.themoviedb.org/person/45215
191
- profile: []
192
-
193
- - score: 5
194
- popularity: 3
195
- name: Vince Gerardis
196
- id: 54268
197
- biography: ""
198
- url: http://www.themoviedb.org/person/54268
199
- profile: []
200
-
201
- - score: 4
202
- popularity: 3
203
- name: Vince Gilligan
204
- id: 66633
205
- biography: ""
206
- url: http://www.themoviedb.org/person/66633
207
- profile: []
208
-
209
- - score: 3
210
- popularity: 3
211
- name: Nicholas Vince
212
- id: 56559
213
- biography: ""
214
- url: http://www.themoviedb.org/person/56559
215
- profile: []
216
-
217
- - score: 2
218
- popularity: 3
219
- name: Vince McMahon
220
- id: 57342
221
- biography: ""
222
- url: http://www.themoviedb.org/person/57342
223
- profile: []
224
-
225
- - score: 1
226
- popularity: 3
227
- name: Vince Vieluf
228
- id: 58381
229
- biography: ""
230
- url: http://www.themoviedb.org/person/58381
231
- profile: []
232
-
1
+ HTTP/1.1 200 OK
2
+ Server: nginx
3
+ Date: Mon, 23 Aug 2010 16:39:45 GMT
4
+ Content-Type: text/json; charset=utf-8
5
+ Transfer-Encoding: chunked
6
+ Connection: keep-alive
7
+ Keep-Alive: timeout=20
8
+ Status: 200 OK
9
+ Cache-Control: public, max-age=21600
10
+ X-Varnish: 2542104567 2542101419
11
+ Age: 36
12
+ Via: 1.1 varnish
13
+ X-Cache: HIT
14
+
15
+ [{"score":30,"popularity":3,"name":"Nicholas Vince","id":56559,"biography":"","url":"http://www.themoviedb.org/person/56559","profile":[],"version":2,"last_modified_at":"2010-07-19 18:00:13"},{"score":29,"popularity":3,"name":"Vince Guaraldi","id":124022,"biography":"","url":"http://www.themoviedb.org/person/124022","profile":[],"version":3,"last_modified_at":"2010-07-26 21:41:09"},{"score":28,"popularity":3,"name":"Vince Flaherty","id":121264,"biography":"","url":"http://www.themoviedb.org/person/121264","profile":[],"version":2,"last_modified_at":"2010-07-19 20:56:43"},{"score":27,"popularity":3,"name":"Vince Corazza","id":106711,"biography":"","url":"http://www.themoviedb.org/person/106711","profile":[],"version":2,"last_modified_at":"2010-07-19 20:13:41"},{"score":26,"popularity":3,"name":"Vince Green","id":59569,"biography":"","url":"http://www.themoviedb.org/person/59569","profile":[],"version":2,"last_modified_at":"2010-07-19 23:10:54"},{"score":25,"popularity":3,"name":"Vince Leigh","id":60419,"biography":"","url":"http://www.themoviedb.org/person/60419","profile":[],"version":2,"last_modified_at":"2010-07-19 23:18:05"},{"score":24,"popularity":3,"name":"Robert Vince","id":61248,"biography":"","url":"http://www.themoviedb.org/person/61248","profile":[],"version":2,"last_modified_at":"2010-07-26 18:35:29"},{"score":23,"popularity":3,"name":"Vince Lozano","id":88032,"biography":"","url":"http://www.themoviedb.org/person/88032","profile":[],"version":2,"last_modified_at":"2010-07-19 20:05:49"},{"score":22,"popularity":3,"name":"Vince Trankina","id":91412,"biography":"","url":"http://www.themoviedb.org/person/91412","profile":[],"version":2,"last_modified_at":"2010-07-19 17:51:39"},{"score":21,"popularity":3,"name":"Vince Martin","id":45215,"biography":"","url":"http://www.themoviedb.org/person/45215","profile":[],"version":2,"last_modified_at":"2010-07-19 18:43:43"},{"score":20,"popularity":3,"name":"Vince Vieluf","id":58381,"biography":"","url":"http://www.themoviedb.org/person/58381","profile":[],"version":4,"last_modified_at":"2010-07-26 20:41:53"},{"score":19,"popularity":3,"name":"Vince Gilligan","id":66633,"biography":"","url":"http://www.themoviedb.org/person/66633","profile":[],"version":3,"last_modified_at":"2010-07-26 18:17:51"},{"score":18,"popularity":3,"name":"Robert Vince","id":61244,"biography":"","url":"http://www.themoviedb.org/person/61244","profile":[],"version":15,"last_modified_at":"2010-07-27 15:56:39"},{"score":17,"popularity":3,"name":"Vince Clarke","id":105820,"biography":"","url":"http://www.themoviedb.org/person/105820","profile":[],"version":2,"last_modified_at":"2010-07-19 20:19:59"},{"score":16,"popularity":3,"name":"William Vince","id":5358,"biography":"","url":"http://www.themoviedb.org/person/5358","profile":[],"version":6,"last_modified_at":"2010-07-27 16:01:24"},{"score":15,"popularity":3,"name":"Alexander Vince","id":20058,"biography":"","url":"http://www.themoviedb.org/person/20058","profile":[],"version":2,"last_modified_at":"2010-07-19 21:46:32"},{"score":14,"popularity":3,"name":"Vince Palomino","id":102312,"biography":"","url":"http://www.themoviedb.org/person/102312","profile":[],"version":2,"last_modified_at":"2010-07-19 21:52:08"},{"score":13,"popularity":3,"name":"Vince Locke","id":4484,"biography":"","url":"http://www.themoviedb.org/person/4484","profile":[],"version":2,"last_modified_at":"2010-07-19 22:16:48"},{"score":12,"popularity":3,"name":"Vince Oddone","id":9467,"biography":"","url":"http://www.themoviedb.org/person/9467","profile":[],"version":2,"last_modified_at":"2010-07-19 22:39:49"},{"score":11,"popularity":3,"name":"Barrie Vince","id":22154,"biography":"","url":"http://www.themoviedb.org/person/22154","profile":[],"version":2,"last_modified_at":"2010-07-19 23:28:26"},{"score":10,"popularity":3,"name":"Vince Ravine","id":25293,"biography":"","url":"http://www.themoviedb.org/person/25293","profile":[],"version":3,"last_modified_at":"2010-07-30 13:41:37"},{"score":9,"popularity":3,"name":"Vince Barnett","id":13357,"biography":"","url":"http://www.themoviedb.org/person/13357","profile":[],"version":6,"last_modified_at":"2010-07-26 21:42:23"},{"score":8,"popularity":3,"name":"Robert Vince","id":25010,"biography":"","url":"http://www.themoviedb.org/person/25010","profile":[],"version":2,"last_modified_at":"2010-07-20 00:05:30"},{"score":7,"popularity":3,"name":"Vince Desiderio","id":27591,"biography":"","url":"http://www.themoviedb.org/person/27591","profile":[],"version":3,"last_modified_at":"2010-07-27 13:34:56"},{"score":6,"popularity":3,"name":"Vince Giordano","id":28009,"biography":"","url":"http://www.themoviedb.org/person/28009","profile":[],"version":2,"last_modified_at":"2010-07-20 00:09:10"},{"score":5,"popularity":3,"name":"Vince Murdocco","id":33585,"biography":"","url":"http://www.themoviedb.org/person/33585","profile":[],"version":3,"last_modified_at":"2010-07-26 21:15:56"},{"score":4,"popularity":3,"name":"Vince Evans","id":126201,"biography":"","url":"http://www.themoviedb.org/person/126201","profile":[],"version":3,"last_modified_at":"2010-07-25 17:03:33"},{"score":3,"popularity":3,"name":"Vince Colosimo","id":77496,"biography":"","url":"http://www.themoviedb.org/person/77496","profile":[],"version":6,"last_modified_at":"2010-07-26 19:52:22"},{"score":2,"popularity":3,"name":"Vince Gerardis","id":54268,"biography":"","url":"http://www.themoviedb.org/person/54268","profile":[],"version":3,"last_modified_at":"2010-07-28 11:00:11"},{"score":1,"popularity":3,"name":"Robert Vince","id":61245,"biography":"","url":"http://www.themoviedb.org/person/61245","profile":[],"version":2,"last_modified_at":"2010-07-26 18:35:28"}]
@@ -1,3 +1,3 @@
1
- File.open(File.join(File.dirname(__FILE__), 'tmdb_api_key.txt')) do |file|
2
- Tmdb.api_key = file.read
1
+ File.open(File.join(File.dirname(__FILE__), 'tmdb_api_key.txt')) do |file|
2
+ Tmdb.api_key = file.read
3
3
  end
@@ -1,21 +1,21 @@
1
- module Test::Unit
2
- # Used to fix a minor minitest/unit incompatibility in flexmock
3
- AssertionFailedError = Class.new(StandardError)
4
-
5
- class TestCase
6
-
7
- def self.test(name, &block)
8
- test_name = "test_#{name.gsub(/\s+/,'_')}".to_sym
9
- defined = instance_method(test_name) rescue false
10
- raise "#{test_name} is already defined in #{self}" if defined
11
- if block_given?
12
- define_method(test_name, &block)
13
- else
14
- define_method(test_name) do
15
- flunk "No implementation provided for #{name}"
16
- end
17
- end
18
- end
19
-
20
- end
1
+ module Test::Unit
2
+ # Used to fix a minor minitest/unit incompatibility in flexmock
3
+ AssertionFailedError = Class.new(StandardError)
4
+
5
+ class TestCase
6
+
7
+ def self.test(name, &block)
8
+ test_name = "test_#{name.gsub(/\s+/,'_')}".to_sym
9
+ defined = instance_method(test_name) rescue false
10
+ raise "#{test_name} is already defined in #{self}" if defined
11
+ if block_given?
12
+ define_method(test_name, &block)
13
+ else
14
+ define_method(test_name) do
15
+ flunk "No implementation provided for #{name}"
16
+ end
17
+ end
18
+ end
19
+
20
+ end
21
21
  end
@@ -1,5 +1,7 @@
1
1
  def register_api_url_stubs
2
2
  unless(TEST_LIVE_API)
3
+
4
+
3
5
  File.open(File.join(File.dirname(__FILE__), "..", "fixtures", "movie_search.txt")) do |file|
4
6
  stub_request(:get, Regexp.new(Tmdb.base_api_url + "Movie.search/" + ".*")).to_return(file)
5
7
  end
@@ -22,11 +24,11 @@ def register_api_url_stubs
22
24
 
23
25
  File.open(File.join(File.dirname(__FILE__), "..", "fixtures", "incorrect_api_url.txt")) do |file|
24
26
  stub_request(:get, Regexp.new(Tmdb.base_api_url + "Movie.blarg/" + ".*")).to_return(file)
27
+ end
25
28
 
26
- File.open(File.join(File.dirname(__FILE__), "..", "fixtures", "blank_result.txt")) do |file|
29
+ File.open(File.join(File.dirname(__FILE__), "..", "fixtures", "blank_result.txt")) do |file|
27
30
  stub_request(:get, Regexp.new(Tmdb.base_api_url + "Search.empty/" + ".*")).to_return(file)
28
31
  end
29
- end
30
32
 
31
33
  File.open(File.join(File.dirname(__FILE__), "..", "fixtures", "example_com.txt")) do |file|
32
34
  stub_request(:get, Regexp.new("http://example.com.*")).to_return(file)
@@ -36,6 +38,14 @@ def register_api_url_stubs
36
38
  stub_request(:get, Regexp.new('http://i[0-9].themoviedb.org/[backdrops|posters|profiles].*')).to_return(file)
37
39
  end
38
40
 
41
+ File.open(File.join(File.dirname(__FILE__), "..", "fixtures", "image.jpg")) do |file|
42
+ stub_request(:get, Regexp.new('http://hwcdn.themoviedb.org/[backdrops|posters|profiles].*')).to_return(file)
43
+ end
44
+
45
+ File.open(File.join(File.dirname(__FILE__), "..", "fixtures", "blank_result.txt")) do |file|
46
+ stub_request(:get, Regexp.new("item_not_found$")).to_return(file)
47
+ end
48
+
39
49
  stub_request(:get, 'http://thisisaurlthatdoesntexist.co.nz').to_return(:body => "", :status => 404, :headers => {'content-length' => 0})
40
50
  end
41
51
  end
data/test/test_helper.rb CHANGED
@@ -1,20 +1,20 @@
1
- TEST_LIVE_API = false
2
-
3
- require 'rubygems'
4
- require 'test/unit'
5
-
6
- unless(TEST_LIVE_API)
7
- require 'webmock/test_unit'
8
- include WebMock
9
- end
10
-
11
- require_files = []
12
- require_files << File.join(File.dirname(__FILE__), '..', 'lib', 'ruby-tmdb.rb')
13
- require_files.concat Dir[File.join(File.dirname(__FILE__), 'setup', '*.rb')]
14
-
15
- require_files.each do |file|
16
- require File.expand_path(file)
17
- end
18
-
19
- #load(File.join('unit', 'test_direct_require.rb'), true)
1
+ TEST_LIVE_API = false
2
+
3
+ require 'rubygems'
4
+ require 'test/unit'
5
+
6
+ unless(TEST_LIVE_API)
7
+ require 'webmock/test_unit'
8
+ include WebMock
9
+ end
10
+
11
+ require_files = []
12
+ require_files << File.join(File.dirname(__FILE__), '..', 'lib', 'ruby-tmdb.rb')
13
+ require_files.concat Dir[File.join(File.dirname(__FILE__), 'setup', '*.rb')]
14
+
15
+ require_files.each do |file|
16
+ require File.expand_path(file)
17
+ end
18
+
19
+ #load(File.join('unit', 'test_direct_require.rb'), true)
20
20
  system('ruby ' + File.expand_path(File.join(File.dirname(__FILE__), 'unit', 'test_direct_require.rb')))
@@ -1,25 +1,25 @@
1
- require "test/unit"
2
-
3
- require_files = []
4
- require_files << File.join(File.dirname(__FILE__), "..", "..", "lib", "ruby-tmdb.rb")
5
- require_files.concat Dir[File.join(File.dirname(__FILE__), '..', 'setup', '*.rb')]
6
-
7
- require_files.each do |file|
8
- require File.expand_path(file)
9
- end
10
-
11
- class DirectRequireTest < Test::Unit::TestCase
12
-
13
- test "TmdbMovie should not raise exception when directly required without using rubygems" do
14
- assert_nothing_raised do
15
- TmdbMovie.find(:id => 187)
16
- end
17
- end
18
-
19
- test "TmdbCast should not raise exception when directly required without using rubygems" do
20
- assert_nothing_raised do
21
- TmdbCast.find(:id => 287)
22
- end
23
- end
24
-
1
+ require "test/unit"
2
+
3
+ require_files = []
4
+ require_files << File.join(File.dirname(__FILE__), "..", "..", "lib", "ruby-tmdb.rb")
5
+ require_files.concat Dir[File.join(File.dirname(__FILE__), '..', 'setup', '*.rb')]
6
+
7
+ require_files.each do |file|
8
+ require File.expand_path(file)
9
+ end
10
+
11
+ class DirectRequireTest < Test::Unit::TestCase
12
+
13
+ test "TmdbMovie should not raise exception when directly required without using rubygems" do
14
+ assert_nothing_raised do
15
+ TmdbMovie.find(:id => 187)
16
+ end
17
+ end
18
+
19
+ test "TmdbCast should not raise exception when directly required without using rubygems" do
20
+ assert_nothing_raised do
21
+ TmdbCast.find(:id => 287)
22
+ end
23
+ end
24
+
25
25
  end
@@ -6,6 +6,11 @@ class TmdbCastTest < Test::Unit::TestCase
6
6
  register_api_url_stubs
7
7
  end
8
8
 
9
+ test "search that returns no results should create empty array" do
10
+ movie = TmdbCast.find(:name => "item_not_found")
11
+ assert_equal [], movie
12
+ end
13
+
9
14
  test "cast data should be able to be dumped and re-loaded" do
10
15
  assert_nothing_raised do
11
16
  cast = TmdbCast.find(:id => 287)
@@ -6,6 +6,11 @@ class TmdbMovieTest < Test::Unit::TestCase
6
6
  register_api_url_stubs
7
7
  end
8
8
 
9
+ test "search that returns no results should create empty array" do
10
+ movie = TmdbMovie.find(:title => "item_not_found")
11
+ assert_equal [], movie
12
+ end
13
+
9
14
  test "movie should be able to be dumped and re-loaded" do
10
15
  assert_nothing_raised do
11
16
  movie = TmdbMovie.find(:id => 187)