ggarnier / dailymotion-api-client

DailyMotion API Ruby client

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

How to change 'limit' and 'page' default values?

remivigan opened this issue · comments

Hello Guilherme,

First of all, thanks you very much for the work done on dailymotion-api-client !

I would request your help to understand how to change the default value set on "limit" and "page" parameters. As you should know, limit value is set to 10 by default, and page to 1. How could I change that?

As per Dailymotion documentation, we could be able to change these default values: https://developer.dailymotion.com/api#response-lists

Unfortunately, I'm not able to make it work...

I would really appreciate your help 😄

I finally got it!

To change the default value of parameters from "get_authenticated_user_videos" method, the idea is to add the expected parameter with its value from URL:

Source:

HTTMultiParty.get("#{API_URL}/me/videos", headers: { "Authorization" => "Bearer #{@access_token}" })

Target:

HTTMultiParty.get("#{API_URL}/me/videos?limit=20", headers: { "Authorization" => "Bearer #{@access_token}" })["list"]

Easy :)

@remivigan that's right, and page parameter works the same way:

"#{API_URL}/me/videos?limit=20&page=3"