Class: Hooloo::Show

Inherits:
MozartHash show all
Defined in:
lib/hooloo/show.rb

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from MozartHash

bool, cast, date, field_mapping, float, #inspect, #method_missing, #respond_to?, uri

Constructor Details

#initialize(id) ⇒ Show

Returns a new instance of Show.



7
8
9
10
11
12
13
14
# File 'lib/hooloo/show.rb', line 7

def initialize(id)
  super
  if id.is_a? Fixnum
    @obj = Hooloo.request("shows/#{id}")['data'][0]['show']
  elsif id.is_a? Hash
    @obj = id
  end
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Hooloo::MozartHash

Class Method Details



2
3
4
5
6
# File 'lib/hooloo/show.rb', line 2

def self.popular_today(args={})
  Hooloo.paginated_request('shows', {
    sort: 'popular_today'
  }.merge(args), 30) { |g, x| g << Hooloo::Show.new(x['show']) }
end

Instance Method Details

#videos(season = 1, args = {}) ⇒ Object



15
16
17
18
19
# File 'lib/hooloo/show.rb', line 15

def videos(season=1, args={})
  Hooloo.paginated_request("shows/#{id}/episodes", {
    season_number: season
  }.merge(args), 30) { |g, x| g << Hooloo::Video.new(x['video']) }
end