class TVDB::Series

Attributes

code[R]
connection[RW]
data[R]
params[R]
route[R]
series_id[R]

Public Class Methods

new( connection, series_id, options = {} ) click to toggle source
# File lib/tvdb_client/series.rb, line 6
def initialize( connection, series_id, options = {} )
  @connection = connection
  @series_id  = series_id
  @route      = "/series/#{series_id}"

  set_subtype_parameters
  get_series( series_id, options )
end

Public Instance Methods

all_episodes() click to toggle source
# File lib/tvdb_client/series.rb, line 33
def all_episodes
  tr = TVDB::Service::Threading::ThreadedRequest.new( connection: connection )
  tr.make_request( "#{route}/episodes" )
end
episodes( options = {} ) click to toggle source
# File lib/tvdb_client/series.rb, line 15
def episodes( options = {} )
  set_subtype_parameters( options )

  TVDB::Series::Episodes.new( params )
end
filter( options = {} ) click to toggle source
# File lib/tvdb_client/series.rb, line 27
def filter( options = {} )
  set_subtype_parameters( options )

  TVDB::Series::Filter.new( params )
end
images( options = {} ) click to toggle source
# File lib/tvdb_client/series.rb, line 21
def images( options = {} )
  set_subtype_parameters( options )

  TVDB::Series::Images.new( params )
end

Private Instance Methods

get_series( series_id, options = {} ) click to toggle source
# File lib/tvdb_client/series.rb, line 40
def get_series( series_id, options = {} )
  series = connection.get( route, options )
  @data  = series.body
  @code  = series.code
end
set_subtype_parameters( options = {} ) click to toggle source
# File lib/tvdb_client/series.rb, line 46
def set_subtype_parameters( options = {} )
  @params = {
    connection: connection, 
    series_id: series_id,
    params: options
  }      
end