Class: ESP::ExternalAccount
- Defined in:
- lib/esp/resources/external_account.rb
Constant Summary
Constants inherited from Resource
Instance Method Summary collapse
-
#create ⇒ Object
This instance method is called by the #save method when new? is true.
-
#generate_external_id ⇒ Object
Helper to generate an external id.
-
#organization ⇒ Object
The organization the external account belongs to.
-
#reports ⇒ Object
The collection of reports that belong to the team.
-
#scan_intervals ⇒ Object
Returns a collection of scan_intervals for the external account.
-
#sub_organization ⇒ Object
The sub_organization the external account belongs to.
-
#team ⇒ Object
The team the external account belongs to.
Methods inherited from Resource
arrange_options, filters, find, make_pageable, #serializable_hash, where
Instance Method Details
#create ⇒ Object
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_id ⇒ Object
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 |
#organization ⇒ Object
The organization the external account belongs to.
5 |
# File 'lib/esp/resources/external_account.rb', line 5 belongs_to :organization, class_name: 'ESP::Organization' |
#reports ⇒ Object
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_intervals ⇒ Object
Returns a collection of scan_intervals for the external account
Example
external_account = ESP::ExternalAccount.find(345)
scan_intervals = external_account.scan_intervals
37 38 39 |
# File 'lib/esp/resources/external_account.rb', line 37 def scan_intervals ESP::ScanInterval.for_external_account(id) end |
#sub_organization ⇒ Object
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' |
#team ⇒ Object
The team the external account belongs to.
13 |
# File 'lib/esp/resources/external_account.rb', line 13 belongs_to :team, class_name: 'ESP::Team' |