Class: Access::Filter

Inherits:
Object
  • Object
show all
Defined in:
lib/access/filter.rb

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(values) ⇒ Filter

Returns a new instance of Filter.



18
19
20
21
22
23
# File 'lib/access/filter.rb', line 18

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

Class Method Details

.find(filter_key, options = {}) ⇒ Object



9
10
11
12
# File 'lib/access/filter.rb', line 9

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

.process_batch(chunk) ⇒ Object



14
15
16
# File 'lib/access/filter.rb', line 14

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

.search(options = {}) ⇒ Object



4
5
6
7
# File 'lib/access/filter.rb', line 4

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

Instance Method Details

#filter_keyObject



25
26
27
# File 'lib/access/filter.rb', line 25

def filter_key
  @filter_id
end

#nameObject



29
30
31
# File 'lib/access/filter.rb', line 29

def name
  @filter_name
end