Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Get more than 20 results for popular, upcoming etc. #4

Closed
joshkremer opened this issue Mar 25, 2016 · 12 comments
Closed

Get more than 20 results for popular, upcoming etc. #4

joshkremer opened this issue Mar 25, 2016 · 12 comments

Comments

@joshkremer
Copy link

Great gem, really useful! Can you tell me how I could receive more than 20 results when using popular, upcoming etc? I assume I need to paginate, but I can't find where to do that in your gem. Thanks!

@samuelebistoletti
Copy link
Contributor

Thanks. You can pass the param "page" to all methods that supports such paramater, for example you could write
Tmdb::Movie.popular page: 2
to get the second page of results.

@joshkremer
Copy link
Author

Thanks for the reply. I'm unable to make that work. I receive a "wrong number of arguments (1 for 0)" error. Is there something I need to set up first?

@samuelebistoletti
Copy link
Contributor

What method are you calling with param page?

@joshkremer
Copy link
Author

Here is what I'm trying:

toprated = Tmdb::Movie.top_rated page: 2
puts toprated

@samuelebistoletti
Copy link
Contributor

I tried the same exact call and it's working for me, no exeception is raised.

Are you using the last available version of the gem? What ruby version are you on?

@joshkremer
Copy link
Author

Interesting. I'm running ruby 2.2.1p85. I have updated all of my gems and still have the same problem.

@samuelebistoletti
Copy link
Contributor

Ok, Ruby version should be ok. Can you please send me the full stack trace of the exception raised?

@joshkremer
Copy link
Author

Sure, is this what you are looking for?

/Users/joshkremer/.rvm/gems/ruby-2.2.1/gems/themoviedb-1.0.1/lib/themoviedb/movie.rb:71:in `top_rated': wrong number of arguments (1 for 0) (ArgumentError)
    from rebuild.rb:10:in `<main>'

@samuelebistoletti
Copy link
Contributor

Yes. As I can see from this output the error seams to be on line 10 of
rebuild.rb, maybe you are calling the method on tmdb gem from that file in
the wrong way. I tried from irb and top_rated method works as usual. Can
you publish a short gist of your code in order to reproduce the problem?
Il 05 apr 2016 14:03, "joshkremer" notifications@github.com ha scritto:

Sure, is this what you are looking for?

/Users/joshkremer/.rvm/gems/ruby-2.2.1/gems/themoviedb-1.0.1/lib/themoviedb/movie.rb:71:in
top_rated': wrong number of arguments (1 for 0) (ArgumentError)
from rebuild.rb:10:in
'


You are receiving this because you modified the open/close state.
Reply to this email directly or view it on GitHub
#4 (comment)

@joshkremer
Copy link
Author

@druzn3k
Copy link
Contributor

druzn3k commented Apr 5, 2016

I just tryed too and I get the expected results.

 ~/workspace/ruby/scripts $ ruby -v 
> ruby 2.2.1p85 (2015-02-26 revision 49769) [x86_64-linux]
 ~/workspace/ruby/scripts $ ruby tmdb_issue_4_ruby_2.1.1.rb
> #<Tmdb::Movie page=2, results=[#<Tmdb::Movie poster_path="/yRXTVpDRBA3983C3HjoY0SO4dV6.jpg", [...]

But I had to correct the require, as it wasn't loading the correct gem, themoviedb-api, but it was loading themoviedb. Those are two different gems, with two different interfaces (but similar class names): themoviedb and themoviedb-api.

Hope this solves the mistery! 👍

@joshkremer
Copy link
Author

That was it! Thanks so much for the help!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants