Sha256: 4df5ac0960add50db524c53e98f53b5212c48c799048504fc44dbbaca1a00def

Contents?: true

Size: 660 Bytes

Versions: 3

Compression:

Stored size: 660 Bytes

Contents

class Hooloo::Genre < Hooloo::MozartHash
  def initialize(obj)
    super
    if obj.is_a? String
      @obj = {'canonical_name' => obj}
    else
      @obj = obj
    end
  end
  def shows(args={items_per_page: 10, position: 0})
    args.merge!({genre: canonical_name, sort: 'release_with_popularity'})
    Hooloo.request('shows', args)['data'].map { |x| Hooloo::Show.new x['show'] }
  end
  # List all genres known to Hulu
  #
  # @param args [Hash] (see Hooloo#request)
  # @return [Array<Hooloo::Genre>] List of genres
  def self.list(args={})
    Hooloo.request("shows/genres")['data'].map do |item|
      Hooloo::Genre.new(item['genre'])
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
hooloo-0.2.1 lib/hooloo/genre.rb
hooloo-0.2.0 lib/hooloo/genre.rb
hooloo-0.1.1 lib/hooloo/genre.rb