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.41 lib/access/filter.rb
access-2.0.40 lib/access/filter.rb
access-2.0.39 lib/access/filter.rb
access-2.0.38 lib/access/filter.rb
access-2.0.37 lib/access/filter.rb
access-2.0.36 lib/access/filter.rb
access-2.0.34 lib/access/filter.rb
access-2.0.33 lib/access/filter.rb
access-2.0.32 lib/access/filter.rb
access-2.0.31 lib/access/filter.rb
access-2.0.30 lib/access/filter.rb
access-2.0.29 lib/access/filter.rb
access-2.0.28 lib/access/filter.rb
access-2.0.27 lib/access/filter.rb
access-2.0.26 lib/access/filter.rb
access-2.0.25 lib/access/filter.rb
access-2.0.24 lib/access/filter.rb
access-2.0.23 lib/access/filter.rb
access-2.0.22 lib/access/filter.rb
access-2.0.21 lib/access/filter.rb