Class: Invoicexpress::Models::Filter

Inherits:
BaseModel
  • Object
show all
Includes:
HappyMapper
Defined in:
lib/invoicexpress/models/filter.rb

Instance Method Summary collapse

Constructor Details

#initialize(args = {}) ⇒ Filter

Returns a new instance of Filter.



32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
# File 'lib/invoicexpress/models/filter.rb', line 32

def initialize(args = {})
  if args[:status] && args[:status].is_a?(Array)
    o = FilterStatus.new
    o.options = []
    o.options = args[:status].map(&:to_s)

    self.status = o
  end

  if args[:by_type] && args[:by_type].is_a?(Array)
    o = FilterByType.new
    o.options = []
    o.options = args[:by_type].map(&:to_s)

    self.by_type = o
  end

  if args[:archived] && args[:archived].is_a?(Array)
    o = FilterArchived.new
    o.options = []
    o.options = args[:archived].map(&:to_s)

    self.archived = o
  end

end