class ESP::Suppression
Public Class Methods
Overriden so the correct param is sent on the has_many relationships. API needs this one to be plural.
@private
# File lib/esp/resources/suppression.rb, line 60 def self.element_name 'suppressions' end
Public Instance Methods
The custom signatures being suppressed.
@return [ActiveResource::PaginatedCollection<ESP::CustomSignature>]
# 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 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.¶ ↑
@return [Net::HTTPSuccess, false]
# 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 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.¶ ↑
@return [void] @raise [ActiveResource::ResourceInvalid] if unsuccessful.
# File lib/esp/resources/suppression.rb, line 85 def deactivate! return self if deactivate self.message = errors.full_messages.join(' ') fail(ActiveResource::ResourceInvalid.new(self)) # rubocop:disable Style/RaiseArgs end
Not Implemented. You cannot destroy a Suppression
.
@return [void]
# File lib/esp/resources/suppression.rb, line 74 def destroy fail ESP::NotImplementedError end
The external accounts affected by this suppression.
@return [ActiveResource::PaginatedCollection<ESP::ExternalAccount>]
# 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
The regions affected by this suppression.
@return [ActiveResource::PaginatedCollection<ESP::Region>]
# 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
Not Implemented. You cannot create or update a Suppression
.
@return [void]
# File lib/esp/resources/suppression.rb, line 67 def save fail ESP::NotImplementedError end
The signatures being suppressed.
@return [ActiveResource::PaginatedCollection<ESP::Signature>]
# 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