Class: ESP::ExternalAccount

Inherits:
Resource
  • Object
show all
Defined in:
lib/esp/resources/external_account.rb

Constant Summary

Constants inherited from Resource

Resource::PREDICATES

Instance Method Summary collapse

Methods inherited from Resource

arrange_options, filters, find, make_pageable, #serializable_hash, where

Instance Method Details

#createObject

This instance method is called by the #save method when new? is true.



26
27
28
29
# File 'lib/esp/resources/external_account.rb', line 26

def create # :nodoc:
  attributes['external_id'] ||= generate_external_id
  super
end

#generate_external_idObject

Helper to generate an external id. Called automatically when creating an ExternalAccount if external_id is not already set.



21
22
23
# File 'lib/esp/resources/external_account.rb', line 21

def generate_external_id
  SecureRandom.uuid
end

#organizationObject

The organization the external account belongs to.



5
# File 'lib/esp/resources/external_account.rb', line 5

belongs_to :organization, class_name: 'ESP::Organization'

#reportsObject

The collection of reports that belong to the team.



17
# File 'lib/esp/resources/external_account.rb', line 17

has_many :reports, class_name: 'ESP::Report'

#scan_intervalsObject

Returns a collection of scan_intervals for the external account

Example

 = ESP::ExternalAccount.find(345)
scan_intervals = .scan_intervals


37
38
39
# File 'lib/esp/resources/external_account.rb', line 37

def scan_intervals
  ESP::ScanInterval.(id)
end

#sub_organizationObject

The sub_organization the external account belongs to.



9
# File 'lib/esp/resources/external_account.rb', line 9

belongs_to :sub_organization, class_name: 'ESP::SubOrganization'

#teamObject

The team the external account belongs to.



13
# File 'lib/esp/resources/external_account.rb', line 13

belongs_to :team, class_name: 'ESP::Team'