Class: Impac::Widget

Inherits:
BaseResource
  • Object
show all
Defined in:
app/models/mno_enterprise/impac/widget.rb

Instance Method Summary collapse

Instance Method Details

#organizations(orgs = nil) ⇒ Object



19
20
21
22
23
24
25
# File 'app/models/mno_enterprise/impac/widget.rb', line 19

def organizations(orgs = nil)
  if orgs.present?
    orgs.select { |org| organization_ids.include?(org.uid) }.to_a
  else
    MnoEnterprise::Organization.where('uid.in' => organization_ids).to_a
  end
end

#to_audit_eventObject



10
11
12
13
14
15
16
17
# File 'app/models/mno_enterprise/impac/widget.rb', line 10

def to_audit_event
  if organization_ids.present?
    organization = MnoEnterprise::Organization.find_by(uid: organization_ids.first)
    { name: name, organization_id: organization.id }
  else
    { name: name }
  end
end