class TMDb::Changes

Constants

ATTRIBUTES

Public Class Methods

movies(options = {}) click to toggle source

Public: Get a list of movie ids that have been edited. By default we show the last 24 hours and only 100 items per page. The maximum number of days that can be returned in a single request is 14.

options - The hash options used to filter the search (default: {}).

:page - Page. Minimum 1, maximum 1000.
:start_date - Start date (YYYY-MM-DD).
:end_date - End date (YYYY-MM-DD).

Examples

TMDb::Changes.movies
TMDb::Changes.movies(page: 1, start_date: '2013-03-22')
# File lib/tmdb-api/changes.rb, line 20
def self.movies(options = {})
  res = get('/movie/changes', query: options)
  res.success? ? Changes.new(res) : bad_response(res)
end
people(options = {}) click to toggle source

Public: Get a list of people ids that have been edited. The rules of movie changes are also valid here.

options - The hash options used to filter the search (default: {}).

:page - Page. Minimum 1, maximum 1000.
:start_date - Start date (YYYY-MM-DD).
:end_date - End date (YYYY-MM-DD).

Examples

TMDb::Changes.people
TMDb::Changes.people(page: 3, start_date: '2013-03-23')
# File lib/tmdb-api/changes.rb, line 37
def self.people(options = {})
  res = get('/person/changes', query: options)
  res.success? ? Changes.new(res) : bad_response(res)
end

Private Instance Methods

results_ids(changes) click to toggle source

Internal: Extract only the IDs from the result.

changes - The `results` key returned from the API.

# File lib/tmdb-api/changes.rb, line 57
def results_ids(changes)
  changes.map do |item|
    item['id']
  end
end
set_attributes(attributes) click to toggle source

Internal: sets the fetched result to the instance variables.

attributes - Returned attributes from the API.

# File lib/tmdb-api/changes.rb, line 47
def set_attributes(attributes)
  @changes = results_ids(attributes['results'])
  @page = attributes['page']
  @total_pages = attributes['total_pages']
  @total_results = attributes['total_results']
end