aptible-auth 0.4.3 → 0.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/aptible-auth.gemspec +3 -4
- data/lib/aptible/auth.rb +3 -55
- data/lib/aptible/auth/agent.rb +6 -0
- data/lib/aptible/auth/client.rb +4 -3
- data/lib/aptible/auth/membership.rb +5 -4
- data/lib/aptible/auth/organization.rb +15 -14
- data/lib/aptible/auth/resource.rb +7 -86
- data/lib/aptible/auth/role.rb +6 -5
- data/lib/aptible/auth/session.rb +4 -3
- data/lib/aptible/auth/token.rb +62 -61
- data/lib/aptible/auth/user.rb +19 -18
- data/lib/aptible/auth/version.rb +5 -0
- data/spec/aptible/auth/agent_spec.rb +5 -0
- data/spec/aptible/auth/resource_spec.rb +9 -46
- data/spec/aptible/auth_spec.rb +4 -31
- metadata +11 -36
- data/lib/aptible/auth/adapter.rb +0 -22
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1d8c13460cf708f5e18e6eb88460d82e5198de56
|
4
|
+
data.tar.gz: 796d6154994eccc679d26147d16fe8c0e9a31952
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0c6be2c7ec992a4686aa7d790d3d5ec13b3e6169f236181399cd5d2427284f9105bdb0e3d360c0c1594c1668d0a0756b077ab5eb4c014c8e72e98931adcbe60b
|
7
|
+
data.tar.gz: 19391a96c1c2e1fd83e8096dcc13aa6fb3c86ae2c5a9a774d5ae970cde1136574dccc1866aadcce2298f3b75a0f4fe321ac9245ed372505c478a263ab43e601a
|
data/aptible-auth.gemspec
CHANGED
@@ -3,10 +3,11 @@ lib = File.expand_path('../lib', __FILE__)
|
|
3
3
|
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
4
|
|
5
5
|
require 'English'
|
6
|
+
require 'aptible/auth/version'
|
6
7
|
|
7
8
|
Gem::Specification.new do |spec|
|
8
9
|
spec.name = 'aptible-auth'
|
9
|
-
spec.version =
|
10
|
+
spec.version = Aptible::Auth::VERSION
|
10
11
|
spec.authors = ['Frank Macreery']
|
11
12
|
spec.email = ['frank@macreery.com']
|
12
13
|
spec.description = 'Ruby client for auth.aptible.com'
|
@@ -18,11 +19,9 @@ Gem::Specification.new do |spec|
|
|
18
19
|
spec.test_files = spec.files.grep(/^spec\//)
|
19
20
|
spec.require_paths = ['lib']
|
20
21
|
|
22
|
+
spec.add_dependency 'aptible-resource', '>= 0.1.1'
|
21
23
|
spec.add_dependency 'gem_config'
|
22
24
|
spec.add_dependency 'oauth2-aptible'
|
23
|
-
spec.add_dependency 'hyperresource-aptible', '>= 0.9.0'
|
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'
|
data/lib/aptible/auth.rb
CHANGED
@@ -1,13 +1,9 @@
|
|
1
1
|
require 'gem_config'
|
2
|
-
require 'hyperresource'
|
3
|
-
require 'fridge'
|
4
2
|
|
5
3
|
module Aptible
|
6
|
-
|
4
|
+
module Auth
|
7
5
|
include GemConfig::Base
|
8
6
|
|
9
|
-
attr_accessor :token, :config
|
10
|
-
|
11
7
|
with_configuration do
|
12
8
|
has :root_url,
|
13
9
|
classes: [String],
|
@@ -15,58 +11,10 @@ module Aptible
|
|
15
11
|
end
|
16
12
|
|
17
13
|
def self.public_key
|
18
|
-
|
19
|
-
end
|
20
|
-
|
21
|
-
def self.get_data_type_from_response(response)
|
22
|
-
return nil unless response && response.body
|
23
|
-
adapter.get_data_type_from_object(adapter.deserialize(response.body))
|
24
|
-
end
|
25
|
-
|
26
|
-
def self.adapter
|
27
|
-
Aptible::Auth::Adapter
|
28
|
-
end
|
29
|
-
|
30
|
-
def adapter
|
31
|
-
self.class.adapter
|
32
|
-
end
|
33
|
-
|
34
|
-
def initialize(options = {})
|
35
|
-
if options.is_a?(Hash)
|
36
|
-
self.token = options[:token]
|
37
|
-
|
38
|
-
options[:root] ||= config.root_url
|
39
|
-
options[:namespace] ||= 'Aptible::Auth'
|
40
|
-
options[:headers] ||= { 'Content-Type' => 'application/json' }
|
41
|
-
options[:headers].merge!(
|
42
|
-
'Authorization' => "Bearer #{bearer_token}"
|
43
|
-
) if options[:token]
|
44
|
-
end
|
45
|
-
|
46
|
-
super(options)
|
47
|
-
end
|
48
|
-
|
49
|
-
def find_by_url(url)
|
50
|
-
fail "URL must be rooted at #{root}" unless /^#{root}/.match url
|
51
|
-
|
52
|
-
resource = dup
|
53
|
-
resource.href = url.gsub(/^#{root}/, '')
|
54
|
-
resource.get
|
55
|
-
end
|
56
|
-
|
57
|
-
def bearer_token
|
58
|
-
case token
|
59
|
-
when Aptible::Auth::Token then token.access_token
|
60
|
-
when Fridge::AccessToken then token.to_s
|
61
|
-
when String then token
|
62
|
-
end
|
63
|
-
end
|
64
|
-
|
65
|
-
def config
|
66
|
-
@config ||= Aptible::Auth.configuration
|
14
|
+
Agent.new.public_key
|
67
15
|
end
|
68
16
|
end
|
69
17
|
end
|
70
18
|
|
71
|
-
require 'aptible/auth/adapter'
|
72
19
|
require 'aptible/auth/resource'
|
20
|
+
require 'aptible/auth/agent'
|
data/lib/aptible/auth/client.rb
CHANGED
@@ -1,21 +1,22 @@
|
|
1
|
-
# rubocop:disable ClassAndModuleChildren
|
2
1
|
module Aptible
|
3
|
-
|
4
|
-
|
2
|
+
module Auth
|
3
|
+
class Organization < Resource
|
4
|
+
has_many :roles
|
5
5
|
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
6
|
+
def security_officer
|
7
|
+
# REVIEW: Examine underlying data model for a less arbitrary solution
|
8
|
+
security_officers_role = roles.find do |role|
|
9
|
+
role.name == 'Security Officers'
|
10
|
+
end
|
11
|
+
security_officers_role.users.first if security_officers_role
|
10
12
|
end
|
11
|
-
security_officers_role.users.first if security_officers_role
|
12
|
-
end
|
13
13
|
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
14
|
+
def accounts
|
15
|
+
require 'aptible/api'
|
16
|
+
|
17
|
+
accounts = Aptible::Api::Account.all(token: token, headers: headers)
|
18
|
+
accounts.select { |account| account.organization.href == href }
|
19
|
+
end
|
19
20
|
end
|
20
21
|
end
|
21
22
|
end
|
@@ -1,93 +1,14 @@
|
|
1
|
-
require '
|
1
|
+
require 'aptible/resource'
|
2
2
|
|
3
|
-
# rubocop:disable ClassAndModuleChildren
|
4
3
|
module Aptible
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
def self.collection_url
|
11
|
-
config = Aptible::Auth.configuration
|
12
|
-
config.root_url.chomp('/') + "/#{basename}"
|
13
|
-
end
|
14
|
-
|
15
|
-
def self.all(options = {})
|
16
|
-
resource = find_by_url(collection_url, options)
|
17
|
-
return [] unless resource
|
18
|
-
resource.send(basename).entries
|
19
|
-
end
|
20
|
-
|
21
|
-
def self.find(id, options = {})
|
22
|
-
find_by_url("#{collection_url}/#{id}", options)
|
23
|
-
end
|
24
|
-
|
25
|
-
def self.find_by_url(url, options = {})
|
26
|
-
# REVIEW: Should exception be raised if return type mismatch?
|
27
|
-
new(options).find_by_url(url)
|
28
|
-
rescue HyperResource::ClientError => e
|
29
|
-
if e.response.status == 404
|
30
|
-
return nil
|
31
|
-
else
|
32
|
-
raise e
|
33
|
-
end
|
34
|
-
end
|
35
|
-
|
36
|
-
def self.create(params)
|
37
|
-
token = params.delete(:token)
|
38
|
-
auth = Auth.new(token: token)
|
39
|
-
auth.send(basename).create(normalize_params(params))
|
40
|
-
end
|
41
|
-
|
42
|
-
# rubocop:disable PredicateName
|
43
|
-
def self.has_many(relation)
|
44
|
-
define_has_many_getter(relation)
|
45
|
-
define_has_many_setter(relation)
|
46
|
-
end
|
47
|
-
# rubocop:enable PredicateName
|
48
|
-
|
49
|
-
def self.belongs_to(relation)
|
50
|
-
define_method relation do
|
51
|
-
get unless loaded
|
52
|
-
if (memoized = instance_variable_get("@#{relation}"))
|
53
|
-
memoized
|
54
|
-
else
|
55
|
-
instance_variable_set("@#{relation}", links[relation].get)
|
56
|
-
end
|
4
|
+
module Auth
|
5
|
+
class Resource < Aptible::Resource::Base
|
6
|
+
def namespace
|
7
|
+
'Aptible::Auth'
|
57
8
|
end
|
58
|
-
end
|
59
|
-
|
60
|
-
def self.normalize_params(params = {})
|
61
|
-
params_array = params.map do |key, value|
|
62
|
-
value.is_a?(HyperResource) ? [key, value.href] : [key, value]
|
63
|
-
end
|
64
|
-
Hash[params_array]
|
65
|
-
end
|
66
|
-
|
67
|
-
def update(params = {})
|
68
|
-
super(self.class.normalize_params(params))
|
69
|
-
end
|
70
|
-
|
71
|
-
# NOTE: The following does not update the object in-place
|
72
|
-
def reload
|
73
|
-
self.class.find_by_url(href, headers: headers)
|
74
|
-
end
|
75
|
-
|
76
|
-
def self.define_has_many_getter(relation)
|
77
|
-
define_method relation do
|
78
|
-
get unless loaded
|
79
|
-
if (memoized = instance_variable_get("@#{relation}"))
|
80
|
-
memoized
|
81
|
-
elsif links[relation]
|
82
|
-
instance_variable_set("@#{relation}", links[relation].entries)
|
83
|
-
end
|
84
|
-
end
|
85
|
-
end
|
86
9
|
|
87
|
-
|
88
|
-
|
89
|
-
get unless loaded
|
90
|
-
links[relation].create(self.class.normalize_params(params))
|
10
|
+
def root_url
|
11
|
+
Aptible::Auth.configuration.root_url
|
91
12
|
end
|
92
13
|
end
|
93
14
|
end
|
data/lib/aptible/auth/role.rb
CHANGED
@@ -1,10 +1,11 @@
|
|
1
|
-
# rubocop:disable ClassAndModuleChildren
|
2
1
|
module Aptible
|
3
|
-
|
4
|
-
|
2
|
+
module Auth
|
3
|
+
class Role < Resource
|
4
|
+
belongs_to :organization
|
5
5
|
|
6
|
-
|
7
|
-
|
6
|
+
def privileged?
|
7
|
+
!!attributes['privileged']
|
8
|
+
end
|
8
9
|
end
|
9
10
|
end
|
10
11
|
end
|
data/lib/aptible/auth/session.rb
CHANGED
data/lib/aptible/auth/token.rb
CHANGED
@@ -1,79 +1,80 @@
|
|
1
1
|
require 'oauth2'
|
2
2
|
|
3
|
-
# rubocop:disable ClassAndModuleChildren
|
4
3
|
module Aptible
|
5
|
-
|
6
|
-
|
4
|
+
module Auth
|
5
|
+
class Token < Resource
|
6
|
+
attr_accessor :access_token, :refresh_token, :expires_at
|
7
7
|
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
8
|
+
def self.create(options)
|
9
|
+
token = new
|
10
|
+
token.process_options(options)
|
11
|
+
token
|
12
|
+
end
|
13
13
|
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
14
|
+
def authenticate_user(email, password, options = {})
|
15
|
+
options[:scope] ||= 'manage'
|
16
|
+
response = oauth.password.get_token(email, password, options)
|
17
|
+
parse_oauth_response(response)
|
18
|
+
end
|
19
19
|
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
20
|
+
def authenticate_client(id, secret, subject, options = {})
|
21
|
+
options[:scope] ||= 'manage'
|
22
|
+
response = oauth.assertion.get_token({
|
23
|
+
iss: id,
|
24
|
+
sub: subject
|
25
|
+
}.merge(signing_params_from_secret(secret).merge(options)))
|
26
|
+
parse_oauth_response(response)
|
27
|
+
end
|
28
28
|
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
29
|
+
def oauth
|
30
|
+
options = { site: root_url, token_url: '/tokens' }
|
31
|
+
@oauth ||= OAuth2::Client.new(nil, nil, options)
|
32
|
+
end
|
33
33
|
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
34
|
+
def process_options(options)
|
35
|
+
if (email = options.delete(:email)) &&
|
36
|
+
(password = options.delete(:password))
|
37
|
+
authenticate_user(email, password, options)
|
38
|
+
elsif (client_id = options.delete(:client_id)) &&
|
39
|
+
(client_secret = options.delete(:client_secret)) &&
|
40
|
+
(subject = options.delete(:subject))
|
41
|
+
authenticate_client(client_id, client_secret, subject, options)
|
42
|
+
end
|
42
43
|
end
|
43
|
-
end
|
44
44
|
|
45
|
-
|
45
|
+
private
|
46
46
|
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
47
|
+
def parse_oauth_response(response)
|
48
|
+
@access_token = response.token
|
49
|
+
@refresh_token = response.refresh_token
|
50
|
+
@expires_at = Time.at(response.expires_at)
|
51
|
+
end
|
52
52
|
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
53
|
+
def signing_params_from_secret(secret)
|
54
|
+
private_key = parse_private_key(secret)
|
55
|
+
{
|
56
|
+
private_key: private_key,
|
57
|
+
algorithm: "RS#{key_length(private_key) / 2}"
|
58
|
+
}
|
59
|
+
end
|
60
60
|
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
61
|
+
def parse_private_key(string)
|
62
|
+
if string =~ /\A-----/
|
63
|
+
OpenSSL::PKey::RSA.new(string)
|
64
|
+
else
|
65
|
+
formatted_string = <<-PRIVATE_KEY.gsub(/^\s+/, '')
|
66
|
+
-----BEGIN RSA PRIVATE KEY-----
|
67
|
+
#{string.scan(/.{1,64}/).join("\n")}
|
68
|
+
-----END RSA PRIVATE KEY-----
|
69
|
+
PRIVATE_KEY
|
70
|
+
OpenSSL::PKey::RSA.new(formatted_string)
|
71
|
+
end
|
71
72
|
end
|
72
|
-
end
|
73
73
|
|
74
|
-
|
75
|
-
|
76
|
-
|
74
|
+
def key_length(private_key)
|
75
|
+
# http://stackoverflow.com/questions/13747212
|
76
|
+
private_key.n.num_bytes * 8
|
77
|
+
end
|
77
78
|
end
|
78
79
|
end
|
79
80
|
end
|
data/lib/aptible/auth/user.rb
CHANGED
@@ -1,27 +1,28 @@
|
|
1
|
-
# rubocop:disable ClassAndModuleChildren
|
2
1
|
module Aptible
|
3
|
-
|
4
|
-
|
2
|
+
module Auth
|
3
|
+
class User < Resource
|
4
|
+
has_many :roles
|
5
5
|
|
6
|
-
|
7
|
-
|
8
|
-
|
6
|
+
def verified?
|
7
|
+
!!attributes['verified']
|
8
|
+
end
|
9
9
|
|
10
|
-
|
11
|
-
|
12
|
-
|
10
|
+
def organizations
|
11
|
+
roles.map(&:organization)
|
12
|
+
end
|
13
13
|
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
14
|
+
def operations
|
15
|
+
# TODO: Implement query params for /operations
|
16
|
+
[]
|
17
|
+
end
|
18
18
|
|
19
|
-
|
20
|
-
|
21
|
-
|
19
|
+
def privileged_organizations
|
20
|
+
privileged_roles.map(&:organization)
|
21
|
+
end
|
22
22
|
|
23
|
-
|
24
|
-
|
23
|
+
def privileged_roles
|
24
|
+
@privileged_roles ||= roles.select(&:privileged?)
|
25
|
+
end
|
25
26
|
end
|
26
27
|
end
|
27
28
|
end
|
@@ -1,52 +1,15 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
3
|
describe Aptible::Auth::Resource do
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
url = 'https://auth.aptible.com/roles/42'
|
14
|
-
expect(Aptible::Auth::Role).to receive(:find_by_url).with url, {}
|
15
|
-
Aptible::Auth::Role.find(42)
|
16
|
-
end
|
17
|
-
end
|
18
|
-
|
19
|
-
describe '.all' do
|
20
|
-
let(:session) { double Aptible::Auth::Session }
|
21
|
-
let(:collection) { double Aptible::Auth }
|
22
|
-
|
23
|
-
before do
|
24
|
-
collection.stub(:sessions) { [session] }
|
25
|
-
Aptible::Auth::Session.any_instance.stub(:find_by_url) { collection }
|
26
|
-
end
|
27
|
-
|
28
|
-
it 'should be an array' do
|
29
|
-
expect(Aptible::Auth::Session.all).to be_a Array
|
30
|
-
end
|
31
|
-
|
32
|
-
it 'should return the root collection' do
|
33
|
-
expect(Aptible::Auth::Session.all).to eq [session]
|
34
|
-
end
|
35
|
-
|
36
|
-
it 'should pass options to the HyperResource initializer' do
|
37
|
-
klass = Aptible::Auth::Session
|
38
|
-
options = { token: 'token' }
|
39
|
-
expect(klass).to receive(:new).with(options).and_return klass.new
|
40
|
-
Aptible::Auth::Session.all(options)
|
41
|
-
end
|
42
|
-
end
|
43
|
-
|
44
|
-
describe '.create' do
|
45
|
-
it 'should create a new top-level resource' do
|
46
|
-
sessions = double Aptible::Auth
|
47
|
-
Aptible::Auth.stub_chain(:new, :sessions) { sessions }
|
48
|
-
expect(sessions).to receive(:create).with(foo: 'bar')
|
49
|
-
Aptible::Auth::Session.create(foo: 'bar')
|
4
|
+
its(:namespace) { should eq 'Aptible::Auth' }
|
5
|
+
its(:root_url) { should eq 'https://auth.aptible.com' }
|
6
|
+
|
7
|
+
describe '#bearer_token' do
|
8
|
+
it 'should accept an Aptible::Auth::Token' do
|
9
|
+
token = Aptible::Auth::Token.new
|
10
|
+
token.stub(:access_token) { 'aptible_auth_token' }
|
11
|
+
subject.stub(:token) { token }
|
12
|
+
expect(subject.bearer_token).to eq token.access_token
|
50
13
|
end
|
51
14
|
end
|
52
15
|
end
|
data/spec/aptible/auth_spec.rb
CHANGED
@@ -1,6 +1,8 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
3
|
describe Aptible::Auth do
|
4
|
+
subject { Aptible::Auth::User.new }
|
5
|
+
|
4
6
|
it 'should have a configurable root_url' do
|
5
7
|
config = described_class.configuration
|
6
8
|
expect(config).to be_a GemConfig::Configuration
|
@@ -16,36 +18,7 @@ describe Aptible::Auth do
|
|
16
18
|
end
|
17
19
|
|
18
20
|
it 'should expose the server public key' do
|
19
|
-
|
20
|
-
Aptible::Auth.
|
21
|
-
expect(get).to receive :public_key
|
22
|
-
described_class.public_key
|
23
|
-
end
|
24
|
-
|
25
|
-
describe '#initialize' do
|
26
|
-
it 'should be a HyperResource instance' do
|
27
|
-
expect(subject).to be_a HyperResource
|
28
|
-
end
|
29
|
-
end
|
30
|
-
|
31
|
-
describe '#bearer_token' do
|
32
|
-
it 'should accept an Aptible::Auth::Token' do
|
33
|
-
token = Aptible::Auth::Token.new
|
34
|
-
token.stub(:access_token) { 'abtible_auth_token' }
|
35
|
-
subject.stub(:token) { token }
|
36
|
-
expect(subject.bearer_token).to eq token.access_token
|
37
|
-
end
|
38
|
-
|
39
|
-
it 'should accept an Fridge::AccessToken' do
|
40
|
-
token = Fridge::AccessToken.new
|
41
|
-
token.stub(:to_s) { 'fridge_access_token' }
|
42
|
-
subject.stub(:token) { token }
|
43
|
-
expect(subject.bearer_token).to eq token.to_s
|
44
|
-
end
|
45
|
-
|
46
|
-
it 'should accept a String' do
|
47
|
-
subject.stub(:token) { 'token' }
|
48
|
-
expect(subject.bearer_token).to eq 'token'
|
49
|
-
end
|
21
|
+
Aptible::Auth::Agent.any_instance.should_receive :public_key
|
22
|
+
Aptible::Auth.public_key
|
50
23
|
end
|
51
24
|
end
|
metadata
CHANGED
@@ -1,59 +1,31 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: aptible-auth
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.5.0
|
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-04-
|
11
|
+
date: 2014-04-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
|
-
name:
|
15
|
-
requirement: !ruby/object:Gem::Requirement
|
16
|
-
requirements:
|
17
|
-
- - '>='
|
18
|
-
- !ruby/object:Gem::Version
|
19
|
-
version: '0'
|
20
|
-
type: :runtime
|
21
|
-
prerelease: false
|
22
|
-
version_requirements: !ruby/object:Gem::Requirement
|
23
|
-
requirements:
|
24
|
-
- - '>='
|
25
|
-
- !ruby/object:Gem::Version
|
26
|
-
version: '0'
|
27
|
-
- !ruby/object:Gem::Dependency
|
28
|
-
name: oauth2-aptible
|
14
|
+
name: aptible-resource
|
29
15
|
requirement: !ruby/object:Gem::Requirement
|
30
16
|
requirements:
|
31
17
|
- - '>='
|
32
18
|
- !ruby/object:Gem::Version
|
33
|
-
version:
|
19
|
+
version: 0.1.1
|
34
20
|
type: :runtime
|
35
21
|
prerelease: false
|
36
22
|
version_requirements: !ruby/object:Gem::Requirement
|
37
23
|
requirements:
|
38
24
|
- - '>='
|
39
25
|
- !ruby/object:Gem::Version
|
40
|
-
version:
|
26
|
+
version: 0.1.1
|
41
27
|
- !ruby/object:Gem::Dependency
|
42
|
-
name:
|
43
|
-
requirement: !ruby/object:Gem::Requirement
|
44
|
-
requirements:
|
45
|
-
- - '>='
|
46
|
-
- !ruby/object:Gem::Version
|
47
|
-
version: 0.9.0
|
48
|
-
type: :runtime
|
49
|
-
prerelease: false
|
50
|
-
version_requirements: !ruby/object:Gem::Requirement
|
51
|
-
requirements:
|
52
|
-
- - '>='
|
53
|
-
- !ruby/object:Gem::Version
|
54
|
-
version: 0.9.0
|
55
|
-
- !ruby/object:Gem::Dependency
|
56
|
-
name: fridge
|
28
|
+
name: gem_config
|
57
29
|
requirement: !ruby/object:Gem::Requirement
|
58
30
|
requirements:
|
59
31
|
- - '>='
|
@@ -67,7 +39,7 @@ dependencies:
|
|
67
39
|
- !ruby/object:Gem::Version
|
68
40
|
version: '0'
|
69
41
|
- !ruby/object:Gem::Dependency
|
70
|
-
name:
|
42
|
+
name: oauth2-aptible
|
71
43
|
requirement: !ruby/object:Gem::Requirement
|
72
44
|
requirements:
|
73
45
|
- - '>='
|
@@ -167,7 +139,7 @@ files:
|
|
167
139
|
- Rakefile
|
168
140
|
- aptible-auth.gemspec
|
169
141
|
- lib/aptible/auth.rb
|
170
|
-
- lib/aptible/auth/
|
142
|
+
- lib/aptible/auth/agent.rb
|
171
143
|
- lib/aptible/auth/client.rb
|
172
144
|
- lib/aptible/auth/membership.rb
|
173
145
|
- lib/aptible/auth/organization.rb
|
@@ -176,6 +148,8 @@ files:
|
|
176
148
|
- lib/aptible/auth/session.rb
|
177
149
|
- lib/aptible/auth/token.rb
|
178
150
|
- lib/aptible/auth/user.rb
|
151
|
+
- lib/aptible/auth/version.rb
|
152
|
+
- spec/aptible/auth/agent_spec.rb
|
179
153
|
- spec/aptible/auth/organization_spec.rb
|
180
154
|
- spec/aptible/auth/resource_spec.rb
|
181
155
|
- spec/aptible/auth/token_spec.rb
|
@@ -207,6 +181,7 @@ signing_key:
|
|
207
181
|
specification_version: 4
|
208
182
|
summary: Ruby client for auth.aptible.com
|
209
183
|
test_files:
|
184
|
+
- spec/aptible/auth/agent_spec.rb
|
210
185
|
- spec/aptible/auth/organization_spec.rb
|
211
186
|
- spec/aptible/auth/resource_spec.rb
|
212
187
|
- spec/aptible/auth/token_spec.rb
|
data/lib/aptible/auth/adapter.rb
DELETED
@@ -1,22 +0,0 @@
|
|
1
|
-
# rubocop:disable ClassAndModuleChildren
|
2
|
-
module Aptible
|
3
|
-
class Auth::Adapter < HyperResource::Adapter::HAL_JSON
|
4
|
-
class << self
|
5
|
-
# rubocop:disable MethodLength
|
6
|
-
def get_data_type_from_object(object)
|
7
|
-
return nil unless object
|
8
|
-
|
9
|
-
if (type = object['type'])
|
10
|
-
if type.respond_to?(:camelize)
|
11
|
-
type.camelize
|
12
|
-
else
|
13
|
-
type[0].upcase + type[1..-1]
|
14
|
-
end
|
15
|
-
else
|
16
|
-
'Resource'
|
17
|
-
end
|
18
|
-
end
|
19
|
-
# rubocop:enable MethodLength
|
20
|
-
end
|
21
|
-
end
|
22
|
-
end
|