Class: ESP::Suppression
- Inherits:
-
Resource
- Object
- ActiveResource::Base
- Resource
- ESP::Suppression
- Defined in:
- lib/esp/resources/suppression.rb,
lib/esp/resources/suppression/region.rb,
lib/esp/resources/suppression/signature.rb,
lib/esp/resources/suppression/unique_identifier.rb
Defined Under Namespace
Classes: Region, Signature, UniqueIdentifier
Class Method Summary collapse
-
.all ⇒ ActiveResource::PaginatedCollection<ESP::Suppression>
Return a paginated Suppression list.
-
.find(id, options = {}) ⇒ ESP::Suppression
Find a Suppression by id.
-
.where(clauses = {}) ⇒ ActiveResource::PaginatedCollection<ESP::Suppression>
Return a paginated Suppression list filtered by search parameters.
Instance Method Summary collapse
-
#created_by ⇒ ESP::User
The user who created the suppression.
-
#custom_signatures ⇒ ActiveResource::PaginatedCollection<ESP::CustomSignature>
The custom signatures being suppressed.
-
#deactivate ⇒ Net::HTTPSuccess, false
Deactivate the current suppression instance.
-
#deactivate! ⇒ void
Deactivate the current suppression instance.
-
#destroy ⇒ void
Not Implemented.
-
#external_accounts ⇒ ActiveResource::PaginatedCollection<ESP::ExternalAccount>
The external accounts affected by this suppression.
-
#organization ⇒ ESP::Organization
The organization this sub organization belongs to.
-
#regions ⇒ ActiveResource::PaginatedCollection<ESP::Region>
The regions affected by this suppression.
-
#save ⇒ void
Not Implemented.
-
#signatures ⇒ ActiveResource::PaginatedCollection<ESP::Signature>
The signatures being suppressed.
Methods included from Dirty
#changed_attributes, #original_attributes, #original_attributes=
Methods included from LoadWithOriginalAttributes
Class Method Details
.all ⇒ ActiveResource::PaginatedCollection<ESP::Suppression>
Return a paginated Suppression list
|
# File 'lib/esp/resources/suppression.rb', line 134
|
.find(id, options = {}) ⇒ ESP::Suppression
Find a Suppression by id
call-seq -> super.find(id, options = {})
|
# File 'lib/esp/resources/suppression.rb', line 118
|
.where(clauses = {}) ⇒ ActiveResource::PaginatedCollection<ESP::Suppression>
Return a paginated Suppression list filtered by search parameters
call-seq -> super.where(clauses = {})
|
# File 'lib/esp/resources/suppression.rb', line 107
|
Instance Method Details
#created_by ⇒ ESP::User
The user who created the suppression.
15 |
# File 'lib/esp/resources/suppression.rb', line 15 belongs_to :created_by, class_name: 'ESP::User' |
#custom_signatures ⇒ ActiveResource::PaginatedCollection<ESP::CustomSignature>
The custom signatures being suppressed.
50 51 52 53 54 55 |
# File 'lib/esp/resources/suppression.rb', line 50 def custom_signatures # When custom_signatures come back in an include, the method still gets called, to return the object from the attributes. return attributes['custom_signatures'] if attributes['custom_signatures'].present? return [] unless respond_to? :custom_signature_ids ESP::CustomSignature.where(id_in: custom_signature_ids) end |
#deactivate ⇒ Net::HTTPSuccess, false
Deactivate the current suppression instance. The current object will be updated with the new status if successful. If not successful, populates its errors object.
Once deactivated the suppression cannot be reactivated.
97 98 99 100 101 102 103 104 105 |
# File 'lib/esp/resources/suppression.rb', line 97 def deactivate patch(:deactivate).tap do |response| load_attributes_from_response(response) end rescue ActiveResource::BadRequest, ActiveResource::ResourceInvalid, ActiveResource::UnauthorizedAccess, ActiveResource::ForbiddenAccess => error load_remote_errors(error, true) self.code = error.response.code false end |
#deactivate! ⇒ void
This method returns an undefined value.
Deactivate the current suppression instance. The current object will be updated with the new status if successful. Throws an error if not successful.
Once deactivated the suppression cannot be reactivated.
85 86 87 88 89 |
# File 'lib/esp/resources/suppression.rb', line 85 def deactivate! return self if deactivate self. = errors..join(' ') fail(ActiveResource::ResourceInvalid.new(self)) # rubocop:disable Style/RaiseArgs end |
#destroy ⇒ void
This method returns an undefined value.
Not Implemented. You cannot destroy a Suppression.
74 75 76 |
# File 'lib/esp/resources/suppression.rb', line 74 def destroy fail ESP::NotImplementedError end |
#external_accounts ⇒ ActiveResource::PaginatedCollection<ESP::ExternalAccount>
The external accounts affected by this suppression.
30 31 32 33 34 35 |
# File 'lib/esp/resources/suppression.rb', line 30 def external_accounts # When external_accounts come back in an include, the method still gets called, to return the object from the attributes. return attributes['external_accounts'] if attributes['external_accounts'].present? return [] unless respond_to? :external_account_ids ESP::ExternalAccount.where(id_in: external_account_ids) end |
#organization ⇒ ESP::Organization
The organization this sub organization belongs to.
10 |
# File 'lib/esp/resources/suppression.rb', line 10 belongs_to :organization, class_name: 'ESP::Organization' |
#regions ⇒ ActiveResource::PaginatedCollection<ESP::Region>
The regions affected by this suppression.
20 21 22 23 24 25 |
# File 'lib/esp/resources/suppression.rb', line 20 def regions # When regions come back in an include, the method still gets called, to return the object from the attributes. return attributes['regions'] if attributes['regions'].present? return [] unless respond_to? :region_ids ESP::Region.where(id_in: region_ids) end |
#save ⇒ void
This method returns an undefined value.
Not Implemented. You cannot create or update a Suppression.
67 68 69 |
# File 'lib/esp/resources/suppression.rb', line 67 def save fail ESP::NotImplementedError end |
#signatures ⇒ ActiveResource::PaginatedCollection<ESP::Signature>
The signatures being suppressed.
40 41 42 43 44 45 |
# File 'lib/esp/resources/suppression.rb', line 40 def signatures # When signatures come back in an include, the method still gets called, to return the object from the attributes. return attributes['signatures'] if attributes['signatures'].present? return [] unless respond_to? :signature_ids ESP::Signature.where(id_in: signature_ids) end |