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.
-
#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.
22 23 24 25 |
# File 'lib/esp/resources/external_account.rb', line 22 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.
17 18 19 |
# File 'lib/esp/resources/external_account.rb', line 17 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' |
#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
33 34 35 |
# File 'lib/esp/resources/external_account.rb', line 33 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' |