esp_sdk 2.5.0 → 2.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (59) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +2 -0
  3. data/.yardopts +1 -0
  4. data/CHANGELOG.md +8 -0
  5. data/Gemfile.lock +5 -3
  6. data/Guardfile +3 -1
  7. data/esp_sdk.gemspec +2 -1
  8. data/lib/esp/aws_clients.rb +2 -1
  9. data/lib/esp/commands/commands_tasks.rb +2 -1
  10. data/lib/esp/commands/console.rb +4 -0
  11. data/lib/esp/exceptions.rb +1 -0
  12. data/lib/esp/extensions/active_resource/dirty.rb +51 -0
  13. data/lib/esp/extensions/active_resource/formats/json_api_format.rb +5 -3
  14. data/lib/esp/extensions/active_resource/paginated_collection.rb +71 -38
  15. data/lib/esp/extensions/active_resource/validations.rb +4 -2
  16. data/lib/esp/external_account_creator.rb +4 -1
  17. data/lib/esp/resources/alert.rb +53 -42
  18. data/lib/esp/resources/cloud_trail_event.rb +18 -12
  19. data/lib/esp/resources/concerns/stat_totals.rb +70 -67
  20. data/lib/esp/resources/contact_request.rb +17 -14
  21. data/lib/esp/resources/custom_signature/definition.rb +46 -51
  22. data/lib/esp/resources/custom_signature/result/alert.rb +13 -5
  23. data/lib/esp/resources/custom_signature/result.rb +49 -53
  24. data/lib/esp/resources/custom_signature.rb +52 -61
  25. data/lib/esp/resources/dashboard.rb +11 -5
  26. data/lib/esp/resources/external_account.rb +59 -58
  27. data/lib/esp/resources/metadata.rb +21 -11
  28. data/lib/esp/resources/organization.rb +49 -39
  29. data/lib/esp/resources/region.rb +25 -28
  30. data/lib/esp/resources/report.rb +46 -44
  31. data/lib/esp/resources/reports/export/integration.rb +22 -13
  32. data/lib/esp/resources/resource.rb +4 -3
  33. data/lib/esp/resources/scan_interval.rb +19 -13
  34. data/lib/esp/resources/service.rb +17 -11
  35. data/lib/esp/resources/signature.rb +43 -53
  36. data/lib/esp/resources/stat.rb +72 -55
  37. data/lib/esp/resources/stat_custom_signature.rb +73 -65
  38. data/lib/esp/resources/stat_region.rb +76 -65
  39. data/lib/esp/resources/stat_service.rb +76 -65
  40. data/lib/esp/resources/stat_signature.rb +76 -65
  41. data/lib/esp/resources/sub_organization.rb +51 -60
  42. data/lib/esp/resources/suppression/region.rb +35 -30
  43. data/lib/esp/resources/suppression/signature.rb +35 -29
  44. data/lib/esp/resources/suppression/unique_identifier.rb +27 -22
  45. data/lib/esp/resources/suppression.rb +45 -34
  46. data/lib/esp/resources/tag.rb +20 -11
  47. data/lib/esp/resources/team.rb +56 -58
  48. data/lib/esp/resources/user.rb +35 -32
  49. data/lib/esp/version.rb +1 -1
  50. data/lib/esp.rb +39 -16
  51. data/lib/esp_sdk.rb +1 -0
  52. data/test/esp/extensions/active_resource/dirty_test.rb +81 -0
  53. data/test/esp/extensions/active_resource/formats/json_api_format_test.rb +8 -0
  54. data/test/esp/extensions/active_resource/paginated_collection_test.rb +7 -0
  55. data/test/esp/integration/json_api_format_integration_test.rb +5 -2
  56. data/test/esp/integration/organization_integration_test.rb +1 -1
  57. data/test/esp/resources/custom_signature_test.rb +15 -0
  58. data/test/factories/custom_signatures.rb +0 -10
  59. metadata +21 -3
@@ -1,93 +1,84 @@
1
1
  module ESP
2
2
  class SubOrganization < ESP::Resource
3
- ##
4
3
  # The organization this sub organization belongs to.
4
+ #
5
+ # @return [ESP::Organization]
5
6
  belongs_to :organization, class_name: 'ESP::Organization'
6
7
 
7
- ##
8
8
  # The collection of teams that belong to the sub organization.
9
+ #
10
+ # @return [ActiveResource::PaginatedCollection<ESP::Team>]
9
11
  has_many :teams, class_name: 'ESP::Team'
10
12
 
11
- ##
12
13
  # The collection of external_accounts that belong to the sub organization.
14
+ #
15
+ # @return [ActiveResource::PaginatedCollection<ESP::ExternalAccount>]
13
16
  has_many :external_accounts, class_name: 'ESP::ExternalAccount'
14
17
 
15
- ##
16
18
  # The collection of reports that belong to the sub organization.
19
+ #
20
+ # @return [ActiveResource::PaginatedCollection<ESP::Report>]
17
21
  has_many :reports, class_name: 'ESP::Report'
18
22
 
19
- # :singleton-method: where
20
- # Return a paginated SubOrganization list filtered by search parameters
21
- #
22
- # ==== Parameters
23
+ # @!method self.where(clauses = {}
24
+ # Return a paginated SubOrganization list filtered by search parameters
23
25
  #
24
- # +clauses+ | Hash of attributes with appended predicates to search, sort and include.
26
+ # *call-seq* -> +super.where(clauses = {})+
25
27
  #
26
- # ===== Valid Clauses
28
+ # @param clauses [Hash] A hash of attributes with appended predicates to search, sort and include.
29
+ # ===== Valid Clauses
27
30
  #
28
- # See {API documentation}[http://api-docs.evident.io?ruby#sub-organization-attributes] for valid arguments
29
- #
30
- # :call-seq:
31
- # where(clauses = {})
31
+ # See {API documentation}[http://api-docs.evident.io?ruby#sub-organization-attributes] for valid arguments
32
+ # @return [ActiveResource::PaginatedCollection<ESP::SubOrganization>]
32
33
 
33
- ##
34
- # :singleton-method: find
35
- # Find a SubOrganization by id
36
- #
37
- # ==== Parameter
38
- #
39
- # +id+ | Required | The ID of the sub organization to retrieve
34
+ # @!method self.find(id, options = {})
35
+ # Find a SubOrganization by id
40
36
  #
41
- # +options+ | Optional | A hash of options
37
+ # *call-seq* -> +super.find(id, options = {})+
42
38
  #
43
- # ===== Valid Options
39
+ # @param id [Integer, Numeric, #to_i] Required ID of the sub organization to retrieve.
40
+ # @param options [Hash] Optional hash of options.
41
+ # ===== Valid Options
44
42
  #
45
- # +include+ | The list of associated objects to return on the initial request.
43
+ # +include+ | The list of associated objects to return on the initial request.
46
44
  #
47
- # ===== Valid Includable Associations
45
+ # ===== Valid Includable Associations
48
46
  #
49
- # See {API documentation}[http://api-docs.evident.io?ruby#sub-organization-attributes] for valid arguments
50
- #
51
- # :call-seq:
52
- # find(id, options = {})
53
-
54
- # :singleton-method: all
55
- # Return a paginated SubOrganization list
47
+ # See {API documentation}[http://api-docs.evident.io?ruby#sub-organization-attributes] for valid arguments
48
+ # @return [ESP::SubOrganization]
56
49
 
57
- # :singleton-method: create
58
- # Create a SubOrganization.
59
- # :call-seq:
60
- # create(attributes={})
50
+ # @!method self.all
51
+ # Return a paginated SubOrganization list
61
52
  #
62
- # ==== Parameters
63
- #
64
- # +attributes+ | Required | A hash of run arguments
65
- #
66
- # ===== Valid Attributes
67
- #
68
- # See {API documentation}[http://api-docs.evident.io?ruby#sub-organization-create] for valid arguments
69
- #
70
- # ==== Example
71
- #
72
- # sub_organization = ESP::SubOrganization.create(name: "Sub Organization Name")
53
+ # @return [ActiveResource::PaginatedCollection<ESP::SubOrganization>]
73
54
 
74
- # :method: save
75
- # Create and update a SubOrganization.
55
+ # @!method self.create(attributes = {})
56
+ # Create a SubOrganization.
57
+ # *call-seq* -> +super.create(attributes={})+
76
58
  #
77
- # ==== Parameters
59
+ # @param attributes [Hash] Required hash of run arguments.
60
+ # ===== Valid Attributes
78
61
  #
79
- # +attributes+ | Required | A hash of run arguments
80
- #
81
- # ===== Valid Attributes
82
- #
83
- # See {API documentation}[http://api-docs.evident.io?ruby#sub-organization-create] for valid arguments
62
+ # See {API documentation}[http://api-docs.evident.io?ruby#sub-organization-create] for valid arguments
63
+ # @return [ESP::SubOrganization]
64
+ # @example
65
+ # sub_organization = ESP::SubOrganization.create(name: "Sub Organization Name")
66
+
67
+ # @!method save(attributes = {})
68
+ # Create and update a SubOrganization.
84
69
  #
85
- # ==== Example
70
+ # @param attributes [Hash] Required hash of run arguments.
71
+ # ===== Valid Attributes
86
72
  #
87
- # sub_organization = ESP::SubOrganization.new(name: "Sub Organization Name")
88
- # sub_organization.save
73
+ # See {API documentation}[http://api-docs.evident.io?ruby#sub-organization-create] for valid arguments
74
+ # @return [Boolean]
75
+ # @example
76
+ # sub_organization = ESP::SubOrganization.new(name: "Sub Organization Name")
77
+ # sub_organization.save
89
78
 
90
- # :method: destroy
91
- # Delete a SubOrganization.
79
+ # @!method destroy
80
+ # Delete a SubOrganization.
81
+ #
82
+ # @return [self]
92
83
  end
93
84
  end
@@ -5,6 +5,8 @@ module ESP
5
5
  # Not Implemented. You cannot search for Suppression::Region.
6
6
  #
7
7
  # Regular ARELlike methods are disabled. Use the ESP::Suppression object to search suppressions.
8
+ #
9
+ # @return [void]
8
10
  def self.where(*)
9
11
  fail ESP::NotImplementedError, 'Regular ARELlike methods are disabled. Use the ESP::Suppression object to search suppressions'
10
12
  end
@@ -12,22 +14,30 @@ module ESP
12
14
  # Not Implemented. You cannot search for Suppression::Region.
13
15
  #
14
16
  # Regular ARELlike methods are disabled. Use the ESP::Suppression object to search suppressions.
17
+ #
18
+ # @return [void]
15
19
  def self.find(*)
16
20
  fail ESP::NotImplementedError, 'Regular ARELlike methods are disabled. Use the ESP::Suppression object to search suppressions'
17
21
  end
18
22
 
19
23
  # Not Implemented. You cannot update a Suppression::Region.
24
+ #
25
+ # @return [void]
20
26
  def update
21
27
  fail ESP::NotImplementedError
22
28
  end
23
29
 
24
30
  # Not Implemented. You cannot destroy a Suppression::Region.
31
+ #
32
+ # @return [void]
25
33
  def destroy
26
34
  fail ESP::NotImplementedError
27
35
  end
28
36
 
29
37
  # This instance method is called by the #save method when new? is true.
30
- def create # :nodoc:
38
+ #
39
+ # @private
40
+ def create
31
41
  original_prefix = self.class.prefix
32
42
  if attributes[:alert_id]
33
43
  self.class.prefix += "alert/:alert_id/"
@@ -38,44 +48,39 @@ module ESP
38
48
  self.class.prefix = original_prefix
39
49
  end
40
50
 
41
- # :singleton-method: create
42
- # Create a suppression for a region.
51
+ # @!method self.create(attributes = {})
52
+ # Create a suppression for a region.
43
53
  #
44
- # If you pass an +alert_id+, include the +reason+ and all other params will be ignored, and the suppression will be created based on that alert.
54
+ # If you pass an +alert_id+, include the +reason+ and all other params will be ignored, and the suppression will be created based on that alert.
45
55
  #
46
- # :call-seq:
47
- # create(attributes={})
56
+ # *call-seq* -> +super.create(attributes={})+
48
57
  #
49
- # ==== Parameter
58
+ # @param attributes [Hash] Required hash of region suppression attributes.
59
+ # ===== Valid Attributes
50
60
  #
51
- # +attributes+ | Required | A hash of region suppression attributes
52
- #
53
- # ===== Valid Attributes
54
- #
55
- # See {API documentation}[http://api-docs.evident.io?ruby#suppression-region-create] for valid arguments
56
- #
57
- # ==== Example When Not Creating for Alert
58
- # create(regions: ['us_east_1'], external_account_ids: [5], reason: 'My very good reason for creating this suppression')
59
- #
60
- # ==== Example When Creating for Alert
61
- # create(alert_id: 5, reason: 'My very good reason for creating this suppression')
61
+ # See {API documentation}[http://api-docs.evident.io?ruby#suppression-region-create] for valid arguments
62
+ # @return [ESP::Suppression::Region>]
63
+ # @example When Not Creating for Alert
64
+ # create(regions: ['us_east_1'], external_account_ids: [5], reason: 'My very good reason for creating this suppression')
65
+ # @example When Creating for Alert
66
+ # create(alert_id: 5, reason: 'My very good reason for creating this suppression')
62
67
 
63
- # :method: save
64
- # Create a suppression for a region.
65
- #
66
- # If you set an +alert_id+, set the +reason+ and all other params will be ignored, and the suppression will be created based on that alert.
68
+ # @!method save
69
+ # Create a suppression for a region.
67
70
  #
68
- # ===== Valid Attributes
71
+ # If you set an +alert_id+, set the +reason+ and all other params will be ignored, and the suppression will be created based on that alert.
69
72
  #
70
- # See {API documentation}[http://api-docs.evident.io?ruby#suppression-region-create] for valid arguments
73
+ # ===== Valid Attributes
71
74
  #
72
- # ==== Example When Not Creating for Alert
73
- # suppression = new(regions: ['us_east_1'], external_account_ids: [5], reason: 'My very good reason for creating this suppression')
74
- # suppression.save
75
+ # See {API documentation}[http://api-docs.evident.io?ruby#suppression-region-create] for valid arguments
75
76
  #
76
- # ==== Example When Creating for Alert
77
- # suppression = new(alert_id: 5, reason: 'My very good reason for creating this suppression')
78
- # suppression.save
77
+ # @return [Boolean]
78
+ # @example When Not Creating for Alert
79
+ # suppression = new(regions: ['us_east_1'], external_account_ids: [5], reason: 'My very good reason for creating this suppression')
80
+ # suppression.save
81
+ # @example When Creating for Alert
82
+ # suppression = new(alert_id: 5, reason: 'My very good reason for creating this suppression')
83
+ # suppression.save
79
84
  end
80
85
  end
81
86
  end
@@ -5,6 +5,8 @@ module ESP
5
5
  # Not Implemented. You cannot search for Suppression::Signature.
6
6
  #
7
7
  # Regular ARELlike methods are disabled. Use the ESP::Suppression object to search suppressions.
8
+ #
9
+ # @return [void]
8
10
  def self.where(*)
9
11
  fail ESP::NotImplementedError, 'Regular ARELlike methods are disabled. Use the ESP::Suppression object to search suppressions'
10
12
  end
@@ -12,22 +14,30 @@ module ESP
12
14
  # Not Implemented. You cannot search for Suppression::Signature.
13
15
  #
14
16
  # Regular ARELlike methods are disabled. Use the ESP::Suppression object to search suppressions.
17
+ #
18
+ # @return [void]
15
19
  def self.find(*)
16
20
  fail ESP::NotImplementedError, 'Regular ARELlike methods are disabled. Use the ESP::Suppression object to search suppressions'
17
21
  end
18
22
 
19
23
  # Not Implemented. You cannot update a Suppression::Signature.
24
+ #
25
+ # @return [void]
20
26
  def update
21
27
  fail ESP::NotImplementedError
22
28
  end
23
29
 
24
30
  # Not Implemented. You cannot destroy a Suppression::Signature.
31
+ #
32
+ # @return [void]
25
33
  def destroy
26
34
  fail ESP::NotImplementedError
27
35
  end
28
36
 
29
37
  # This instance method is called by the #save method when new? is true.
30
- def create # :nodoc:
38
+ #
39
+ # @private
40
+ def create
31
41
  original_prefix = self.class.prefix
32
42
  if attributes[:alert_id]
33
43
  self.class.prefix += "alert/:alert_id/"
@@ -38,44 +48,40 @@ module ESP
38
48
  self.class.prefix = original_prefix
39
49
  end
40
50
 
41
- # :singleton-method: create
42
- # Create a suppression for a signature or custom signature.
43
- #
44
- # If you pass an +alert_id+, include the +reason+ and all other params will be ignored, and the suppression will be created based on that alert.
45
- #
46
- # :call-seq:
47
- # create(attributes={})
48
- #
49
- # ==== Parameter
50
- #
51
- # +attributes+ | Required | A hash of signature suppression attributes
51
+ # @!method self.create(attributes = {})
52
+ # Create a suppression for a signature or custom signature.
52
53
  #
53
- # ===== Valid Attributes
54
+ # If you pass an +alert_id+, include the +reason+ and all other params will be ignored, and the suppression will be created based on that alert.
54
55
  #
55
- # See {API documentation}[http://api-docs.evident.io?ruby#suppression-signature-create] for valid arguments
56
+ # *call-seq* -> +super.create(attributes={})+
56
57
  #
57
- # ==== Example When Not Creating for Alert
58
- # create(signature_ids: [4, 2], regions: ['us_east_1'], external_account_ids: [5], reason: 'My very good reason for creating this suppression')
58
+ # @param attributes [Hash] Required hash of signature suppression attributes.
59
+ # ===== Valid Attributes
59
60
  #
60
- # ==== Example When Creating for Alert
61
- # create(alert_id: 5, reason: 'My very good reason for creating this suppression')
61
+ # See {API documentation}[http://api-docs.evident.io?ruby#suppression-signature-create] for valid arguments
62
+ # @return [ESP::Suppression::Signature>]
63
+ # @example When Not Creating for Alert
64
+ # create(signature_ids: [4, 2], regions: ['us_east_1'], external_account_ids: [5], reason: 'My very good reason for creating this suppression')
65
+ # @example When Creating for Alert
66
+ # create(alert_id: 5, reason: 'My very good reason for creating this suppression')
62
67
 
63
- # :method: save
64
- # Create a suppression for a signature or custom signature.
68
+ # @!method save
69
+ # Create a suppression for a signature or custom signature.
65
70
  #
66
- # If you set an +alert_id+, set the +reason+ and all other params will be ignored, and the suppression will be created based on that alert.
71
+ # If you set an +alert_id+, set the +reason+ and all other params will be ignored, and the suppression will be created based on that alert.
67
72
  #
68
- # ===== Valid Attributes
73
+ # ===== Valid Attributes
69
74
  #
70
- # See {API documentation}[http://api-docs.evident.io?ruby#suppression-signature-create] for valid arguments
75
+ # See {API documentation}[http://api-docs.evident.io?ruby#suppression-signature-create] for valid arguments
71
76
  #
72
- # ==== Example When Not Creating for Alert
73
- # suppression = new(signature_ids: [4, 2], regions: ['us_east_1'], external_account_ids: [5], reason: 'My very good reason for creating this suppression')
74
- # suppression.save
77
+ # @return [Boolean]
78
+ # @example When Not Creating for Alert
79
+ # suppression = new(signature_ids: [4, 2], regions: ['us_east_1'], external_account_ids: [5], reason: 'My very good reason for creating this suppression')
80
+ # suppression.save
75
81
  #
76
- # ==== Example When Creating for Alert
77
- # suppression = new(alert_id: 5, reason: 'My very good reason for creating this suppression')
78
- # suppression.save
82
+ # @example When Creating for Alert
83
+ # suppression = new(alert_id: 5, reason: 'My very good reason for creating this suppression')
84
+ # suppression.save
79
85
  end
80
86
  end
81
87
  end
@@ -5,6 +5,8 @@ module ESP
5
5
  # Not Implemented. You cannot search for Suppression::UniqueIdentifier.
6
6
  #
7
7
  # Regular ARELlike methods are disabled. Use the ESP::Suppression object to search suppressions.
8
+ #
9
+ # @return [void]
8
10
  def self.where(*)
9
11
  fail ESP::NotImplementedError, 'Regular ARELlike methods are disabled. Use the ESP::Suppression object to search suppressions'
10
12
  end
@@ -12,51 +14,54 @@ module ESP
12
14
  # Not Implemented. You cannot search for Suppression::UniqueIdentifier.
13
15
  #
14
16
  # Regular ARELlike methods are disabled. Use the ESP::Suppression object to search suppressions.
17
+ #
18
+ # @return [void]
15
19
  def self.find(*)
16
20
  fail ESP::NotImplementedError, 'Regular ARELlike methods are disabled. Use the ESP::Suppression object to search suppressions'
17
21
  end
18
22
 
19
23
  # Not Implemented. You cannot update a Suppression::UniqueIdentifier.
24
+ #
25
+ # @return [void]
20
26
  def update
21
27
  fail ESP::NotImplementedError
22
28
  end
23
29
 
24
30
  # Not Implemented. You cannot destroy a Suppression::UniqueIdentifier.
31
+ #
32
+ # @return [void]
25
33
  def destroy
26
34
  fail ESP::NotImplementedError
27
35
  end
28
36
 
29
- # :singleton-method: create
30
- # Create a suppression for a unique identifier.
31
- #
32
- # Pass an +alert_id+, the suppression will be created based on that alert.
33
- #
34
- # :call-seq:
35
- # create(attributes={})
36
- #
37
- # ==== Parameter
37
+ # @!method self.create(attributes = {})
38
+ # Create a suppression for a unique identifier.
38
39
  #
39
- # +attributes+ | Required | A hash of unique identifier suppression attributes
40
+ # Pass an +alert_id+, the suppression will be created based on that alert.
40
41
  #
41
- # ==== Attributes
42
+ # *call-seq* -> +super.create(attributes={})+
42
43
  #
43
- # See {API documentation}[http://api-docs.evident.io?ruby#suppression-unique-identifier-create] for valid arguments
44
+ # @param attributes [Hash] Required hash of unique identifier suppression attributes.
45
+ # ==== Attributes
44
46
  #
45
- # ==== Example
46
- # create(alert_id: 5, reason: 'My very good reason for creating this suppression')
47
+ # See {API documentation}[http://api-docs.evident.io?ruby#suppression-unique-identifier-create] for valid arguments
48
+ # @return [ESP::Suppression::UniqueIdentifier>]
49
+ # @example
50
+ # create(alert_id: 5, reason: 'My very good reason for creating this suppression')
47
51
 
48
- # :method: save
49
- # Create a suppression for a unique identifier.
52
+ # @!method save
53
+ # Create a suppression for a unique identifier.
50
54
  #
51
- # Set an +alert_id+, the suppression will be created based on that alert.
55
+ # Set an +alert_id+, the suppression will be created based on that alert.
52
56
  #
53
- # ==== Attributes
57
+ # ==== Attributes
54
58
  #
55
- # See {API documentation}[http://api-docs.evident.io?ruby#suppression-unique-identifier-create] for valid arguments
59
+ # See {API documentation}[http://api-docs.evident.io?ruby#suppression-unique-identifier-create] for valid arguments
56
60
  #
57
- # ==== Example
58
- # suppression = new(alert_id: 5, reason: 'My very good reason for creating this suppression')
59
- # suppression.save
61
+ # @return [Boolean]
62
+ # @example
63
+ # suppression = new(alert_id: 5, reason: 'My very good reason for creating this suppression')
64
+ # suppression.save
60
65
  end
61
66
  end
62
67
  end
@@ -4,16 +4,19 @@ module ESP
4
4
  autoload :Signature, File.expand_path(File.dirname(__FILE__) + '/suppression/signature')
5
5
  autoload :Region, File.expand_path(File.dirname(__FILE__) + '/suppression/region')
6
6
 
7
- ##
8
7
  # The organization this sub organization belongs to.
8
+ #
9
+ # @return [ESP::Organization]
9
10
  belongs_to :organization, class_name: 'ESP::Organization'
10
11
 
11
- ##
12
12
  # The user who created the suppression.
13
+ #
14
+ # @return [ESP::User]
13
15
  belongs_to :created_by, class_name: 'ESP::User'
14
16
 
15
- ##
16
17
  # The regions affected by this suppression.
18
+ #
19
+ # @return [ActiveResource::PaginatedCollection<ESP::Region>]
17
20
  def regions
18
21
  # When regions come back in an include, the method still gets called, to return the object from the attributes.
19
22
  return attributes['regions'] if attributes['regions'].present?
@@ -21,8 +24,9 @@ module ESP
21
24
  ESP::Region.where(id_in: region_ids)
22
25
  end
23
26
 
24
- ##
25
27
  # The external accounts affected by this suppression.
28
+ #
29
+ # @return [ActiveResource::PaginatedCollection<ESP::ExternalAccount>]
26
30
  def external_accounts
27
31
  # When external_accounts come back in an include, the method still gets called, to return the object from the attributes.
28
32
  return attributes['external_accounts'] if attributes['external_accounts'].present?
@@ -30,8 +34,9 @@ module ESP
30
34
  ESP::ExternalAccount.where(id_in: external_account_ids)
31
35
  end
32
36
 
33
- ##
34
37
  # The signatures being suppressed.
38
+ #
39
+ # @return [ActiveResource::PaginatedCollection<ESP::Signature>]
35
40
  def signatures
36
41
  # When signatures come back in an include, the method still gets called, to return the object from the attributes.
37
42
  return attributes['signatures'] if attributes['signatures'].present?
@@ -39,8 +44,9 @@ module ESP
39
44
  ESP::Signature.where(id_in: signature_ids)
40
45
  end
41
46
 
42
- ##
43
47
  # The custom signatures being suppressed.
48
+ #
49
+ # @return [ActiveResource::PaginatedCollection<ESP::CustomSignature>]
44
50
  def custom_signatures
45
51
  # When custom_signatures come back in an include, the method still gets called, to return the object from the attributes.
46
52
  return attributes['custom_signatures'] if attributes['custom_signatures'].present?
@@ -49,16 +55,22 @@ module ESP
49
55
  end
50
56
 
51
57
  # Overriden so the correct param is sent on the has_many relationships. API needs this one to be plural.
52
- def self.element_name # :nodoc:
58
+ #
59
+ # @private
60
+ def self.element_name
53
61
  'suppressions'
54
62
  end
55
63
 
56
64
  # Not Implemented. You cannot create or update a Suppression.
65
+ #
66
+ # @return [void]
57
67
  def save
58
68
  fail ESP::NotImplementedError
59
69
  end
60
70
 
61
71
  # Not Implemented. You cannot destroy a Suppression.
72
+ #
73
+ # @return [void]
62
74
  def destroy
63
75
  fail ESP::NotImplementedError
64
76
  end
@@ -67,6 +79,9 @@ module ESP
67
79
  # The current object will be updated with the new status if successful.
68
80
  # Throws an error if not successful.
69
81
  # === Once deactivated the suppression cannot be reactivated.
82
+ #
83
+ # @return [void]
84
+ # @raise [ActiveResource::ResourceInvalid] if unsuccessful.
70
85
  def deactivate!
71
86
  return self if deactivate
72
87
  self.message = errors.full_messages.join(' ')
@@ -77,6 +92,8 @@ module ESP
77
92
  # The current object will be updated with the new status if successful.
78
93
  # If not successful, populates its errors object.
79
94
  # === Once deactivated the suppression cannot be reactivated.
95
+ #
96
+ # @return [Net::HTTPSuccess, false]
80
97
  def deactivate
81
98
  patch(:deactivate).tap do |response|
82
99
  load_attributes_from_response(response)
@@ -87,42 +104,36 @@ module ESP
87
104
  false
88
105
  end
89
106
 
90
- # :singleton-method: where
91
- # Return a paginated Suppression list filtered by search parameters
92
- #
93
- # ==== Parameters
94
- #
95
- # +clauses+ | Hash of attributes with appended predicates to search, sort and include.
107
+ # @!method self.where(clauses = {})
108
+ # Return a paginated Suppression list filtered by search parameters
96
109
  #
97
- # ===== Valid Clauses
110
+ # *call-seq* -> +super.where(clauses = {})+
98
111
  #
99
- # See {API documentation}[http://api-docs.evident.io?ruby#suppression-attributes] for valid arguments
112
+ # @param clauses [Hash] A hash of attributes with appended predicates to search, sort and include.
113
+ # ===== Valid Clauses
100
114
  #
101
- # :call-seq:
102
- # where(clauses = {})
115
+ # See {API documentation}[http://api-docs.evident.io?ruby#suppression-attributes] for valid arguments
116
+ # @return [ActiveResource::PaginatedCollection<ESP::Suppression>]
103
117
 
104
- ##
105
- # :singleton-method: find
106
- # Find a Suppression by id
118
+ # @!method self.find(id, options = {})
119
+ # Find a Suppression by id
107
120
  #
108
- # ==== Parameter
121
+ # *call-seq* -> +super.find(id, options = {})+
109
122
  #
110
- # +id+ | Required | The ID of the suppression to retrieve
123
+ # @param id [Integer, Numeric, #to_i] Required ID of the suppression to retrieve.
124
+ # @param options [Hash] Optional hash of options.
125
+ # ===== Valid Options
111
126
  #
112
- # +options+ | Optional | A hash of options
127
+ # +include+ | The list of associated objects to return on the initial request.
113
128
  #
114
- # ===== Valid Options
129
+ # ===== Valid Includable Associations
115
130
  #
116
- # +include+ | The list of associated objects to return on the initial request.
117
- #
118
- # ===== Valid Includable Associations
119
- #
120
- # See {API documentation}[http://api-docs.evident.io?ruby#suppression-attributes] for valid arguments
121
- #
122
- # :call-seq:
123
- # find(id, options = {})
131
+ # See {API documentation}[http://api-docs.evident.io?ruby#suppression-attributes] for valid arguments
132
+ # @return [ESP::Suppression]
124
133
 
125
- # :singleton-method: all
126
- # Return a paginated Suppression list
134
+ # @!method self.all
135
+ # Return a paginated Suppression list
136
+ #
137
+ # @return [ActiveResource::PaginatedCollection<ESP::Suppression>]
127
138
  end
128
139
  end