Sha256: 9b99443ac20fb27c774f255d6f942389aa56606da4212a884621d73d99982eeb

Contents?: true

Size: 850 Bytes

Versions: 38

Compression:

Stored size: 850 Bytes

Contents

module Access
  class Filter

    def self.search(options = {})
      # Internal Admin only Call
      Access::Api.new.search_filters options
    end

    def self.find(filter_key, options = {})
      # Internal Admin only Call
      Access::Api.new.find_filter filter_key, options
    end

    def self.process_batch(chunk)
      chunk.map { |filter| new(filter) }
    end

    def initialize(values)
      self.class.class_eval { attr_reader *values.keys }
      values.each do |attribute_name, attribute_value|
        self.instance_variable_set("@#{attribute_name}", attribute_value)
      end
    end

    def filter_key
      @filter_id
    end

    def name
      @filter_name
    end

    def json_filter
      YAML::load(@filter).to_json if @filter
    end

    def hash_filter
      YAML::load(@filter).to_hash if @filter
    end
  end
end

Version data entries

38 entries across 38 versions & 1 rubygems

Version Path
access-2.0.20 lib/access/filter.rb
access-2.0.19 lib/access/filter.rb
access-2.0.18 lib/access/filter.rb
access-2.0.17 lib/access/filter.rb
access-2.0.15 lib/access/filter.rb
access-2.0.14 lib/access/filter.rb
access-2.0.13 lib/access/filter.rb
access-2.0.11 lib/access/filter.rb
access-2.0.10 lib/access/filter.rb
access-2.0.9 lib/access/filter.rb
access-2.0.8 lib/access/filter.rb
access-2.0.7 lib/access/filter.rb
access-2.0.5 lib/access/filter.rb
access-2.0.4 lib/access/filter.rb
access-2.0.3 lib/access/filter.rb
access-2.0.2 lib/access/filter.rb
access-2.0.1 lib/access/filter.rb
access-2.0.0 lib/access/filter.rb