maddox / imdb-party

IMDB client using the IMDB API that their iPhone app uses
MIT License
117 stars 32 forks source link

gem not working #18

Open RoyalTS opened 11 years ago

RoyalTS commented 11 years ago

I just tried out the gem and it doesn't seem to work at all. Here's what I get when I run the example from the readme:

1.9.3p194 :001 > require('imdb_party')
 => true 
1.9.3p194 :002 > imdb = ImdbParty::Imdb.new
 => #<ImdbParty::Imdb:0x007fc7c92ed1f8> 
1.9.3p194 :003 > imdb.find_by_title("The Dark Knight")
TypeError: no _dump_data is defined for class Proc
    from /Users/tobiasschmidt/.rvm/gems/ruby-1.9.3-p194/gems/imdb_party-0.7.1/lib/imdb_party/httparty_icebox.rb:210:in `dump'
    from /Users/tobiasschmidt/.rvm/gems/ruby-1.9.3-p194/gems/imdb_party-0.7.1/lib/imdb_party/httparty_icebox.rb:210:in `block in set'
    from /Users/tobiasschmidt/.rvm/gems/ruby-1.9.3-p194/gems/imdb_party-0.7.1/lib/imdb_party/httparty_icebox.rb:210:in `open'
    from /Users/tobiasschmidt/.rvm/gems/ruby-1.9.3-p194/gems/imdb_party-0.7.1/lib/imdb_party/httparty_icebox.rb:210:in `set'
    from /Users/tobiasschmidt/.rvm/gems/ruby-1.9.3-p194/gems/imdb_party-0.7.1/lib/imdb_party/httparty_icebox.rb:120:in `set'
    from /Users/tobiasschmidt/.rvm/gems/ruby-1.9.3-p194/gems/imdb_party-0.7.1/lib/imdb_party/httparty_icebox.rb:93:in `get_with_caching'
    from /Users/tobiasschmidt/.rvm/gems/ruby-1.9.3-p194/gems/imdb_party-0.7.1/lib/imdb_party/httparty_icebox.rb:101:in `get'
    from /Users/tobiasschmidt/.rvm/gems/ruby-1.9.3-p194/gems/imdb_party-0.7.1/lib/imdb_party/imdb.rb:38:in `find_by_title'
    from (irb):3
    from /Users/tobiasschmidt/.rvm/rubies/ruby-1.9.3-p194/bin/irb:16:in `<main>'
1.9.3p194 :004 > imdb = ImdbParty::Imdb.new(:anonymize => true)
 => #<ImdbParty::Imdb:0x007fc7c920ea70> 
1.9.3p194 :005 > imdb.find_by_title("The Dark Knight")
EOFError: end of file reached
    from /Users/tobiasschmidt/.rvm/gems/ruby-1.9.3-p194/gems/imdb_party-0.7.1/lib/imdb_party/httparty_icebox.rb:214:in `load'
    from /Users/tobiasschmidt/.rvm/gems/ruby-1.9.3-p194/gems/imdb_party-0.7.1/lib/imdb_party/httparty_icebox.rb:214:in `get'
    from /Users/tobiasschmidt/.rvm/gems/ruby-1.9.3-p194/gems/imdb_party-0.7.1/lib/imdb_party/httparty_icebox.rb:119:in `get'
    from /Users/tobiasschmidt/.rvm/gems/ruby-1.9.3-p194/gems/imdb_party-0.7.1/lib/imdb_party/httparty_icebox.rb:89:in `get_with_caching'
    from /Users/tobiasschmidt/.rvm/gems/ruby-1.9.3-p194/gems/imdb_party-0.7.1/lib/imdb_party/httparty_icebox.rb:101:in `get'
    from /Users/tobiasschmidt/.rvm/gems/ruby-1.9.3-p194/gems/imdb_party-0.7.1/lib/imdb_party/imdb.rb:38:in `find_by_title'
    from (irb):5
    from /Users/tobiasschmidt/.rvm/rubies/ruby-1.9.3-p194/bin/irb:16:in `<main>'
1.9.3p194 :006 > 

What am I doing wrong?

xeviknal commented 11 years ago

+1

tkrajacic commented 11 years ago

With tvdb_party I get a similar error. This is what fixed it for me there:

https://github.com/maddox/tvdb_party/issues/9

I would still like to get a proper solution though one day.

ahmetabdi commented 11 years ago

This issue still needs fixing

bastien commented 11 years ago

Same problem here when I try to search by id. Search by title always returns an empty array.

ahmetabdi commented 11 years ago

They both work fine for me after using tkrajacic's fix you should try it.

gem 'httparty', '=0.8.2'

My search by ID, and search by title is working fine now

@movies = ImdbParty::Imdb.new @results = @movies.find_by_title(params[:search_movie]).as_json

bastien commented 11 years ago

That did fix the search by id.

But when I try to search by title I still get nothing when I don't make anonymized requests:

imdb = ImdbParty::Imdb.new
imdb.find_by_title("The Dark Knight")

=> []

And get an error if I do anonymize:

imdb = ImdbParty::Imdb.new(anonymize: true)
imdb.find_by_title("The Dark Knight")

=> URI::InvalidComponentError: bad component(expected host component): anonymouse.org/cgi-bin/anon-www.cgi/app.imdb.com
    from /Users/Bastien/.rbenv/versions/1.9.3-p125/lib/ruby/1.9.1/uri/generic.rb:604:in `check_host'
    from /Users/Bastien/.rbenv/versions/1.9.3-p125/lib/ruby/1.9.1/uri/generic.rb:645:in `host='
    from /Users/Bastien/.rbenv/versions/1.9.3-p125/lib/ruby/1.9.1/uri/generic.rb:194:in `initialize'
    from /Users/Bastien/.rbenv/versions/1.9.3-p125/lib/ruby/1.9.1/uri/http.rb:84:in `initialize'
    from /Users/Bastien/.rbenv/versions/1.9.3-p125/lib/ruby/1.9.1/uri/generic.rb:140:in `new'
    from /Users/Bastien/.rbenv/versions/1.9.3-p125/lib/ruby/1.9.1/uri/generic.rb:140:in `build'
    from /Users/Bastien/.rbenv/versions/1.9.3-p125/lib/ruby/1.9.1/uri/http.rb:62:in `build'
    from /Users/Bastien/Dev/pixs/vendor/bundle/gems/imdb_party-0.6.0/lib/imdb_party/imdb.rb:22:in `build_url'
    from /Users/Bastien/Dev/pixs/vendor/bundle/gems/imdb_party-0.6.0/lib/imdb_party/imdb.rb:32:in `find_by_title'
    from (irb):5
    from /Users/Bastien/Dev/pixs/vendor/bundle/gems/railties-3.2.13/lib/rails/commands/console.rb:47:in `start'
    from /Users/Bastien/Dev/pixs/vendor/bundle/gems/railties-3.2.13/lib/rails/commands/console.rb:8:in `start'
    from /Users/Bastien/Dev/pixs/vendor/bundle/gems/railties-3.2.13/lib/rails/commands.rb:41:in `<top (required)>'
    from script/rails:6:in `require'
    from script/rails:6:in `<main>'
ahmetabdi commented 11 years ago

Do you have

gem 'jeweler'
gem 'shoulda'

Beacause without Anonymize it works fine for me.

irb(main):001:0> imdb = ImdbParty::Imdb.new 
=> #<ImdbParty::Imdb:0x5790db0>
irb(main):002:0> imdb.find_by_title("The Dark Knight")

{"title_popular"=>[{"id"=>"tt0468569", "title"=>"The Dark Knight", "name"=>"", "
title_description"=>"2008,     <a href='/name/nm0634240/'>Christopher Nolan</a>"
, "episode_title"=>"", "description"=>"2008,     <a href='/name/nm0634240/'>Chri...
bastien commented 11 years ago

jeweler and shoulda are only dependencies if you want to work on this library, or run the tests. It shouldn't have any effect on the actual api calls.

For the sake of trying I added them to my Gemfile, but it din't have any effect.

I noticed that you were running it from irb, so I tried to run it outside of my app, and that worked. Maybe a conflict with another gem I'm using. I'll have to investigate.

For refence, here's what my Gemfile looks like:

source "https://rubygems.org"
ruby "1.9.3"

gem 'rails',        '3.2.13'
gem 'json'
gem 'nokogiri'
gem 'jquery-rails'
gem 'httparty', '=0.8.2'
gem 'imdb_party',   '0.6.0'
gem 'omniauth',     '1.1.3'
gem 'omniauth-facebook'
gem 'simple_form'
gem 'fastercsv'

group :production do
  gem 'unicorn'
  gem 'pg'
end

group :development, :test do
  gem 'sqlite3'
  gem 'factory_girl_rails'
  gem 'wirble'
  gem 'rails3-generators'
  gem 'rspec-rails', '~> 2.12.0'
  gem 'debugger', '~> 1.4', require: false, platforms: :ruby_19
  gem 'taps'
end

group :test do
  gem 'rb-fsevent', :require => false
  gem 'guard'
  gem 'guard-rspec'
  gem 'shoulda'
  gem 'rr'
  gem 'timecop'
end