esp_sdk 2.3.0 → 2.4.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 5f7250441652b3030ad983a15076317a4f23f514
4
- data.tar.gz: 20d7beccfa0aac2dcb56e27c3b636ef4360a4f25
3
+ metadata.gz: eb2adf95c6d86093eac45d8f35aba16bfc4b92fd
4
+ data.tar.gz: 866a1a8d25f13d6c948cf2c5763d32733c488706
5
5
  SHA512:
6
- metadata.gz: 89a03a0391777f8cbde9292ab9a44ed087046e19794caf5e8f8353670da41e5433a9ee14ef17d0853e9e389942ec67ef20dbb782f322d9ac3fc9778987d630fc
7
- data.tar.gz: ff17a934abe8abac1a91eaff1e936902d24d69bbcffbce5e4195793bd2e652abd66ac29c3616a488438ac32033007e5dcd8e1c766b5d0d8e451482c2d9ed23a3
6
+ metadata.gz: 8c956e5ead24371596d4b00c95d2d4a60d385a51c6ffc7fb1df4cfac3b3b73eff6ada2ee93bb36741eb54c12ee4a8c2f75d8c6d5e894b1f6b8291c063302d7e0
7
+ data.tar.gz: b4bde23260e83f6819e757c86bb10b720a6378895885e2d806058ae9ea68e93519a1ca1d7ff6639d8265717378c3b864268610c5be78c7db877687386f2ee3e2
@@ -1,6 +1,13 @@
1
1
  ## Unreleased
2
2
 
3
- ## 2.2.3 - 2016-05-16
3
+ ## 2.4.0 - 2016-06-30
4
+ ### Added
5
+ - Report relationship to ExternalAccount
6
+ - ExternalAccount relationship to Report
7
+ ### Changed
8
+ - Upgrade api-auth to 2.0.
9
+
10
+ ## 2.3.0 - 2016-05-16
4
11
  ### Changed
5
12
  - Some error messages changed a little bit on the API. Specifically, on region suppression, signature suppress, and custom signature suppression objects. Now when a validation trips on the related suppression object, the error message reflects that. "Reason can't be blank" changed to "Suppression region can't be blank". The message is built from the attribute which is in error, which changed from "Reason" to "Suppression.reason". Had to gsub the "." to a space to make it message friendly.
6
13
  - Add the teams relation to custom signature, and the custom signatures relation to team.
@@ -1,9 +1,9 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- esp_sdk (2.3.0)
4
+ esp_sdk (2.4.0)
5
5
  activeresource (~> 4.0.0)
6
- api-auth
6
+ api-auth (~> 2.0.0)
7
7
  rack
8
8
 
9
9
  GEM
@@ -24,7 +24,7 @@ GEM
24
24
  tzinfo (~> 1.1)
25
25
  addressable (2.3.8)
26
26
  ansi (1.5.0)
27
- api-auth (1.3.2)
27
+ api-auth (2.0.0)
28
28
  ast (2.0.0)
29
29
  astrolabe (1.3.1)
30
30
  parser (~> 2.2)
@@ -167,4 +167,4 @@ DEPENDENCIES
167
167
  webmock
168
168
 
169
169
  BUNDLED WITH
170
- 1.11.2
170
+ 1.12.5
@@ -38,6 +38,6 @@ Gem::Specification.new do |spec|
38
38
  spec.add_development_dependency 'aws-sdk'
39
39
 
40
40
  spec.add_dependency 'activeresource', '~> 4.0.0'
41
- spec.add_dependency 'api-auth'
41
+ spec.add_dependency 'api-auth', '~> 2.0.0'
42
42
  spec.add_dependency 'rack'
43
43
  end
@@ -12,6 +12,10 @@ module ESP
12
12
  # The team the external account belongs to.
13
13
  belongs_to :team, class_name: 'ESP::Team'
14
14
 
15
+ ##
16
+ # The collection of reports that belong to the team.
17
+ has_many :reports, class_name: 'ESP::Report'
18
+
15
19
  # Helper to generate an external id.
16
20
  # Called automatically when creating an ExternalAccount if +external_id+ is not already set.
17
21
  def generate_external_id
@@ -12,6 +12,10 @@ module ESP
12
12
  # The team the report belongs to.
13
13
  belongs_to :team, class_name: 'ESP::Team'
14
14
 
15
+ ##
16
+ # The external_account the report belongs to.
17
+ belongs_to :external_account, class_name: 'ESP::ExternalAccount'
18
+
15
19
  # Not Implemented. You cannot create or update a Report.
16
20
  def update
17
21
  fail ESP::NotImplementedError
@@ -1,3 +1,3 @@
1
1
  module ESP
2
- VERSION = '2.3.0'
2
+ VERSION = '2.4.0'.freeze
3
3
  end
@@ -33,6 +33,14 @@ module ESP::Integration
33
33
  end
34
34
  end
35
35
 
36
+ context '#reports' do
37
+ should 'return an array of reports' do
38
+ reports = @external_account.reports
39
+
40
+ assert_equal ESP::Report, reports.resource_class
41
+ end
42
+ end
43
+
36
44
  context '.where' do
37
45
  should 'return external_account objects' do
38
46
  external_accounts = ESP::ExternalAccount.where(id_eq: @external_account.id)
@@ -33,6 +33,14 @@ module ESP::Integration
33
33
  end
34
34
  end
35
35
 
36
+ context '#external_account' do
37
+ should 'return a external_account' do
38
+ external_account = @report.external_account
39
+
40
+ assert_equal ESP::ExternalAccount, external_account.class
41
+ end
42
+ end
43
+
36
44
  context '#alerts' do
37
45
  should 'return an array of alerts' do
38
46
  alerts = @report.alerts
@@ -26,7 +26,9 @@ module ESP::Integration
26
26
  sub_orgs = @user.sub_organizations
27
27
 
28
28
  assert_equal @user.sub_organization_ids.count, sub_orgs.count
29
- assert_equal @user.sub_organization_ids, sub_orgs.map(&:id)
29
+ sub_orgs.map(&:id).each do |id|
30
+ assert_contains @user.sub_organization_ids, id
31
+ end
30
32
  end
31
33
  end
32
34
 
@@ -36,6 +36,19 @@ module ESP
36
36
  end
37
37
  end
38
38
 
39
+ context '#reports' do
40
+ should 'call the api' do
41
+ external_account = build(:external_account)
42
+ stub_request(:get, /reports.json*/).to_return(body: json_list(:report, 2))
43
+
44
+ external_account.reports
45
+
46
+ assert_requested(:get, /reports.json*/) do |req|
47
+ assert_equal "filter[external_account_id_eq]=#{external_account.id}", URI.unescape(req.uri.query)
48
+ end
49
+ end
50
+ end
51
+
39
52
  context '#scan_intervals' do
40
53
  should 'call the api for the external_account and the passed in params' do
41
54
  external_account = build(:external_account)
@@ -57,6 +57,17 @@ module ESP
57
57
  end
58
58
  end
59
59
 
60
+ context '#external_account' do
61
+ should 'call the api' do
62
+ report = build(:report, external_account_id: 4)
63
+ stub_external_account = stub_request(:get, %r{external_accounts/#{report.external_account_id}.json*}).to_return(body: json(:external_account))
64
+
65
+ report.external_account
66
+
67
+ assert_requested(stub_external_account)
68
+ end
69
+ end
70
+
60
71
  context '#alerts' do
61
72
  should 'call the api for the report and the passed in params' do
62
73
  report = build(:report)
@@ -35,6 +35,15 @@ FactoryGirl.define do
35
35
  related: "http://localhost:3000/api/v2/teams/1.json"
36
36
  }
37
37
  },
38
+ external_account: {
39
+ data: {
40
+ type: "external_accounts",
41
+ id: "1"
42
+ },
43
+ links: {
44
+ related: "http://localhost:3000/api/v2/external_accounts/1.json"
45
+ }
46
+ },
38
47
  alerts: {
39
48
  data: [
40
49
  {
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: esp_sdk
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.3.0
4
+ version: 2.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Evident.io
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-05-16 00:00:00.000000000 Z
11
+ date: 2016-06-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -266,16 +266,16 @@ dependencies:
266
266
  name: api-auth
267
267
  requirement: !ruby/object:Gem::Requirement
268
268
  requirements:
269
- - - '>='
269
+ - - ~>
270
270
  - !ruby/object:Gem::Version
271
- version: '0'
271
+ version: 2.0.0
272
272
  type: :runtime
273
273
  prerelease: false
274
274
  version_requirements: !ruby/object:Gem::Requirement
275
275
  requirements:
276
- - - '>='
276
+ - - ~>
277
277
  - !ruby/object:Gem::Version
278
- version: '0'
278
+ version: 2.0.0
279
279
  - !ruby/object:Gem::Dependency
280
280
  name: rack
281
281
  requirement: !ruby/object:Gem::Requirement