aptible-auth 0.11.14 → 0.11.15

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: 2ae1142ccc8452357d6b8b8a52aee0e22b003d18
4
- data.tar.gz: 459bba89be563ffa9742d04cc8cb910b0cf923d5
3
+ metadata.gz: 988f035b08404c743665c27fc943def97d1ef3ce
4
+ data.tar.gz: 1542ad296a37085507dbcfff254bb36914d7988f
5
5
  SHA512:
6
- metadata.gz: 3bd1195ad354991695e1bb6d0647e25f7718a256b2428f4037003b84d0146ffff938e2c90a8219566e1834cc414a04e4556dc5d94ea14ae378e0395320b2e9de
7
- data.tar.gz: f0a4b858b3c86d69608b4db73e2e1e9c7f2b375fe8aac579165e19e90b9f8be2d466ddf4d9d41298c5825c3bce939461aa0ef2244b0810672d80a1a6adfe4cef
6
+ metadata.gz: ecb2f54c418c34412ab0d154f931134698f92d49c3762f9fcfd2d565d65b1ff38d886d595c8c3f81f4f4d7e3b3d39ac1b528181196c5a4df374f371dde809edc
7
+ data.tar.gz: 750343384012634983eb521d2a2c0d53ed22036aaf3f9d08db2b3c94edff6109ca76575be183fd1a4360dc1fe5e38438cb3319ed6c49a7fb9f4f35122b978d59
@@ -2,7 +2,7 @@ module Aptible
2
2
  module Auth
3
3
  class Membership < Resource
4
4
  belongs_to :role
5
- belongs_to :user
5
+ embeds_one :user
6
6
 
7
7
  field :id
8
8
  field :created_at, type: Time
@@ -14,7 +14,9 @@ module Aptible
14
14
  field :updated_at, type: Time
15
15
 
16
16
  def organizations
17
- roles.map(&:organization).uniq(&:id)
17
+ # Establish uniqueness of requests before loading all organizations
18
+ # We can do this by reading the `organization` link for each role
19
+ roles.map(&:links).map(&:organization).uniq(&:href).map(&:get)
18
20
  end
19
21
 
20
22
  def operations
@@ -1,5 +1,5 @@
1
1
  module Aptible
2
2
  module Auth
3
- VERSION = '0.11.14'.freeze
3
+ VERSION = '0.11.15'.freeze
4
4
  end
5
5
  end
@@ -2,14 +2,22 @@ require 'spec_helper'
2
2
 
3
3
  describe Aptible::Auth::User do
4
4
  describe '#organizations' do
5
+ let(:org_id) { 1 }
5
6
  let(:so) { double 'Aptible::Auth::Role' }
6
7
  let(:owner) { double 'Aptible::Auth::Role' }
7
8
  let(:org) { double 'Aptible::Auth::Organization' }
9
+ let(:organization_link) do
10
+ double('Aptible::Auth::Organization::Link', href: '/organizations/1')
11
+ end
12
+ let(:role_link) { double('Aptible::Auth::Role::Link') }
8
13
 
9
14
  before do
10
- org.stub(:id) { 1 }
11
- so.stub(:organization) { org }
12
- owner.stub(:organization) { org }
15
+ role_link.stub(:organization) { organization_link }
16
+ organization_link.stub(:get) { org }
17
+
18
+ org.stub(:id) { org_id }
19
+ so.stub(:links) { role_link }
20
+ owner.stub(:links) { role_link }
13
21
  end
14
22
 
15
23
  it 'should return empty if no organizations' do
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: aptible-auth
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.11.14
4
+ version: 0.11.15
5
5
  platform: ruby
6
6
  authors:
7
7
  - Frank Macreery
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-07-03 00:00:00.000000000 Z
11
+ date: 2017-07-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: aptible-billing
@@ -221,7 +221,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
221
221
  version: '0'
222
222
  requirements: []
223
223
  rubyforge_project:
224
- rubygems_version: 2.4.5.1
224
+ rubygems_version: 2.4.8
225
225
  signing_key:
226
226
  specification_version: 4
227
227
  summary: Ruby client for auth.aptible.com