Sha256: 1054db8f768e19d6e51aeaa3385bec7681d2c7f85af815683ad04334fac92d8e

Contents?: true

Size: 827 Bytes

Versions: 1

Compression:

Stored size: 827 Bytes

Contents

module FilmOn

  module Services

    def channel(id, opts={})
      return @channel[id] if @channel[id]
      json = get("channel/#{id}")
      if opts[:json]
        @channel[id] = json
        return json
      end
      hash = JSON.parse(json)
      @channel[id] = FilmOn::Channel.new(hash)
    end

    def channels(opts={})
      return @channels if @channels
      json = get("channels")
      if opts[:json]
        @channels = json
        return json
      end
      hash = JSON.parse(json)
      @channels = hash.map{|ch| FilmOn::Channel.new(ch)}
    end

    def groups(opts={})
      return @groups if @groups
      json = get("groups")
      if opts[:json]
        @groups = json
        return json
      end
      hash = JSON.parse(json)
      @groups = hash.map{|gr| FilmOn::Group.new(gr)}
    end

  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
film_on-0.0.3 lib/film_on/services.rb