Class: Hooloo::Show
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.
6
7
8
9
10
11
12
13
|
# File 'lib/hooloo/show.rb', line 6
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
.popular_today(args = {limit: 10, position: 0}) ⇒ Object
2
3
4
5
|
# File 'lib/hooloo/show.rb', line 2
def self.popular_today(args={limit: 10, position: 0})
args.merge!({sort: 'popular_today'})
Hooloo.request('shows', args)['data'].map { |x| new x['show'] }
end
|
Instance Method Details
#videos(season = 1) ⇒ Object
14
15
16
17
18
19
|
# File 'lib/hooloo/show.rb', line 14
def videos(season=1)
Hooloo.request("shows/#{id}/episodes", {
items_per_page: 128,
season_number: season
})['data'].map { |x| Hooloo::Video.new x['video'] }
end
|