lib/powertrack/streaming/stream.rb
# Retrieves all existing rules for a stream.
#
# Returns an array of PowerTrack::Rule objects when the response permits so.
#
# <tt>GET /rules</tt>
#
# See http://support.gnip.com/apis/powertrack/api_reference.html#ListRules
Retrieves all existing rules for a stream.
Returns an array of PowerTrack::Rule objects when the response permits so.

GET /rules


Retrieves all existing rules for a stream . Returns an array of PowerTrack :: Rule objects when the response permits so . GET / rules
def list_rules(options=nil)
      options = DEFAULT_LIST_RULES_OPTIONS.merge(options || {})
      res = make_rules_request(:get, headers: gzip_compressed_header(options[:compressed]))
      if options[:objectify] &&
         res.is_a?(Hash) &&
         (rules = res['rules']).is_a?(Array) &&
         rules.all? { |rule| rule.is_a?(Hash) && rule.key?('value') }
        rules.map do |rule|
          PowerTrack::Rule.new(rule['value'], tag: rule['tag'], id: rule['id'])
        end
      else
        res
      end
    end
def list_rules ( options = nil ) options = DEFAULT_LIST_RULES_OPTIONS . merge ( options || { } ) res = make_rules_request ( :get , headers : gzip_compressed_header ( options [ :compressed ] ) ) if options [ :objectify ] && res . is_a? ( Hash ) && ( rules = res [ 'rules' ] ) . is_a? ( Array ) && rules . all? { | rule | rule . is_a? ( Hash ) && rule . key? ( 'value' ) } rules . map do | rule | PowerTrack :: Rule . new ( rule [ 'value' ] , tag : rule [ 'tag' ] , id : rule [ 'id' ] ) end else res end end
Retrieves all existing rules for a stream.
Retrieves all existing rules for a stream .
# return Rule objects when required and feasible/appropriate
options