Sha256: 24e53e74b8b759c9dd20a7ec4af060744567042d030c08df66eda848105e4e83

Contents?: true

Size: 782 Bytes

Versions: 1

Compression:

Stored size: 782 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
  # List all shows in this genre
  #
  # @param args [Hash] (see Hooloo#request)
  # @return [Enumerator<Hooloo::Show>] List of shows
  def shows(args={})
    Hooloo.paginated_request('shows', {
      genre: canonical_name,
      sort: 'release_with_popularity'
    }.merge(args), 80) { |g, x| g << 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

1 entries across 1 versions & 1 rubygems

Version Path
hooloo-0.3.2 lib/hooloo/genre.rb