Permalink
Browse files

add v=1.5 parameter to Netflix client

Not sure if it does anything, but Netflix API docs state that the
default version is 1.0 unless v=1.5 is specified.
  • Loading branch information...
1 parent e9ef528 commit 58a955eff490b16b4bf465c4b6653a003dfdab26 @mislav committed Mar 13, 2012
Showing with 6 additions and 2 deletions.
  1. +1 −0 app/controllers/movies_controller.rb
  2. +3 −0 lib/netflix.rb
  3. +2 −2 spec/lib/netflix_spec.rb
@@ -35,6 +35,7 @@ def perform_search(query)
if params[:local]
@movies = Movie.search_regexp(@query, :no_escape).page(params[:page])
elsif params[:netflix]
+ require 'netflix'
@movies = Netflix.search(@query, :expand => %w'directors').titles
render :netflix_search, :layout => !request.xhr?
else
View
@@ -19,6 +19,9 @@ def call(env)
conn.headers[:user_agent] = user_agent
end
+ # http://developer.netflix.com/docs/REST_API_Conventions#0_pgfId-1009147
+ conn.params[:v] = '1.5'
+
oauth_config = Movies::Application.config.netflix
conn.request :oauth,
:consumer_key => oauth_config.consumer_key,
@@ -5,7 +5,7 @@
describe Netflix::Title do
before(:all) do
- stub_request(:get, 'http://api.netflix.com/catalog/titles?start_index=0&term=mar%20adentro&max_results=5').
+ stub_request(:get, 'http://api.netflix.com/catalog/titles?start_index=0&term=mar%20adentro&max_results=5&v=1.5').
to_return(:body => read_fixture('netflix-mar_adentro.xml'), :status => 200)
@catalog = Netflix.search('mar adentro')
@@ -60,7 +60,7 @@
describe Netflix, "autocomplete" do
before(:all) do
- stub_request(:get, 'http://api.netflix.com/catalog/titles/autocomplete?term=step').
+ stub_request(:get, 'http://api.netflix.com/catalog/titles/autocomplete?term=step&v=1.5').
to_return(:body => read_fixture('netflix-autocomplete.xml'), :status => 200)
@result = Netflix.autocomplete('step')

0 comments on commit 58a955e

Please sign in to comment.