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