aptible-auth 0.2.0 → 0.2.1

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: 9ead7f15f6ad01c4a7b9b7bed9a8840b07afe5c2
4
- data.tar.gz: 34335f77ccea4353b373664ba3682d79c7fcbba1
3
+ metadata.gz: 05b6f13b708d4d05d8f553239c5ed83f6a41c2d2
4
+ data.tar.gz: fcf947d45817171ba9f2475eb02e7e2427d25d9f
5
5
  SHA512:
6
- metadata.gz: baa2716fc686c7adb7f45087b8ab63d0aadf82c8a392d5176a25d84cfc799e4d74660acc267e5e0d0cf146d058a810c7e31b816a5d3d5ebf345bc7f8ee680a04
7
- data.tar.gz: 4f73fa2447498ebaf7ea19373fbfc592fd6c320f7ed0f587212e759d50c71d10a4169f2e04d81a2ad8c868641f965a41799edb4ef2a9ab1a4f6d8be105f56b78
6
+ metadata.gz: eb8ed96ad97b48e2d9f3187ad25cf1958e07ebc76ca40a2b02ddc5c48138eacbf27cb2fdf948f4e3ea5d01e9dd517edd8ad3999a2d64189261c6dc1045173efb
7
+ data.tar.gz: c4915d38cc80121139bd52502f37d668dae10e7777bc0e33264fc5c447670bc57c6833851873c5a3d709b994a3e95887e75c27d04c49e7991e9ad9af2bf73ffb
@@ -6,7 +6,7 @@ require 'English'
6
6
 
7
7
  Gem::Specification.new do |spec|
8
8
  spec.name = 'aptible-auth'
9
- spec.version = '0.2.0'
9
+ spec.version = '0.2.1'
10
10
  spec.authors = ['Frank Macreery']
11
11
  spec.email = ['frank@macreery.com']
12
12
  spec.description = 'Ruby client for auth.aptible.com'
@@ -22,10 +22,10 @@ Gem::Specification.new do |spec|
22
22
  spec.add_dependency 'oauth2'
23
23
  spec.add_dependency 'hyperresource'
24
24
  spec.add_dependency 'fridge'
25
- spec.add_dependency 'activesupport'
26
25
 
27
26
  spec.add_development_dependency 'bundler', '~> 1.3'
28
27
  spec.add_development_dependency 'aptible-tasks', '>= 0.2.0'
28
+ spec.add_development_dependency 'activesupport'
29
29
  spec.add_development_dependency 'rake'
30
30
  spec.add_development_dependency 'rspec', '~> 2.0'
31
31
  spec.add_development_dependency 'pry'
@@ -54,10 +54,6 @@ module Aptible
54
54
  resource.get
55
55
  end
56
56
 
57
- def organizations
58
- orgs
59
- end
60
-
61
57
  def bearer_token
62
58
  case token
63
59
  when Aptible::Auth::Token then token.access_token
@@ -6,9 +6,7 @@ module Aptible
6
6
  return nil unless object
7
7
 
8
8
  if (type = object['type'])
9
- if type == 'org'
10
- 'Organization'
11
- elsif type.respond_to?(:camelize)
9
+ if type.respond_to?(:camelize)
12
10
  type.camelize
13
11
  else
14
12
  type[0].upcase + type[1..-1]
@@ -0,0 +1,4 @@
1
+ module Aptible
2
+ class Auth::Organization < Auth::Resource
3
+ end
4
+ end
@@ -9,6 +9,7 @@ end
9
9
 
10
10
  require 'aptible/auth/client'
11
11
  require 'aptible/auth/membership'
12
+ require 'aptible/auth/organization'
12
13
  require 'aptible/auth/role'
13
14
  require 'aptible/auth/session'
14
15
  require 'aptible/auth/token'
@@ -1,4 +1,7 @@
1
1
  module Aptible
2
2
  class Auth::Role < Auth::Resource
3
+ def privileged?
4
+ !!attributes['privileged']
5
+ end
3
6
  end
4
7
  end
@@ -3,5 +3,17 @@ module Aptible
3
3
  def verified?
4
4
  !!attributes['verified']
5
5
  end
6
+
7
+ def organizations
8
+ roles.map(&:organization)
9
+ end
10
+
11
+ def privileged_organizations
12
+ privileged_roles.map(&:organization)
13
+ end
14
+
15
+ def privileged_roles
16
+ @privileged_roles ||= roles.select(&:privileged?)
17
+ end
6
18
  end
7
19
  end
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.2.0
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Frank Macreery
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-03-03 00:00:00.000000000 Z
11
+ date: 2014-03-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: gem_config
@@ -66,20 +66,6 @@ dependencies:
66
66
  - - '>='
67
67
  - !ruby/object:Gem::Version
68
68
  version: '0'
69
- - !ruby/object:Gem::Dependency
70
- name: activesupport
71
- requirement: !ruby/object:Gem::Requirement
72
- requirements:
73
- - - '>='
74
- - !ruby/object:Gem::Version
75
- version: '0'
76
- type: :runtime
77
- prerelease: false
78
- version_requirements: !ruby/object:Gem::Requirement
79
- requirements:
80
- - - '>='
81
- - !ruby/object:Gem::Version
82
- version: '0'
83
69
  - !ruby/object:Gem::Dependency
84
70
  name: bundler
85
71
  requirement: !ruby/object:Gem::Requirement
@@ -108,6 +94,20 @@ dependencies:
108
94
  - - '>='
109
95
  - !ruby/object:Gem::Version
110
96
  version: 0.2.0
97
+ - !ruby/object:Gem::Dependency
98
+ name: activesupport
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - '>='
102
+ - !ruby/object:Gem::Version
103
+ version: '0'
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - '>='
109
+ - !ruby/object:Gem::Version
110
+ version: '0'
111
111
  - !ruby/object:Gem::Dependency
112
112
  name: rake
113
113
  requirement: !ruby/object:Gem::Requirement
@@ -170,6 +170,7 @@ files:
170
170
  - lib/aptible/auth/adapter.rb
171
171
  - lib/aptible/auth/client.rb
172
172
  - lib/aptible/auth/membership.rb
173
+ - lib/aptible/auth/organization.rb
173
174
  - lib/aptible/auth/resource.rb
174
175
  - lib/aptible/auth/role.rb
175
176
  - lib/aptible/auth/session.rb