aptible-auth 0.3.2 → 0.4.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.
- checksums.yaml +4 -4
- data/aptible-auth.gemspec +1 -1
- data/lib/aptible/auth/client.rb +1 -0
- data/lib/aptible/auth/membership.rb +2 -0
- data/lib/aptible/auth/resource.rb +16 -5
- data/lib/aptible/auth/role.rb +2 -0
- data/lib/aptible/auth/session.rb +1 -0
- data/spec/aptible/auth/resource_spec.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ac454bc3eef567b367a3eaa632816d61c2d15eb1
|
4
|
+
data.tar.gz: 060414e6cd796507a114fec0da56b739e3c263fc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c3e20eb1f2657602b71b3f957b29beb37f47b09f92d8948914d10a298b94decc987909e6918d3a8fa719da5d7e1ba55e18fd9a78b7b1ac7faa904e853d2d1bcc
|
7
|
+
data.tar.gz: 0f419c0662ff23d311fb5251d4bb65f835f9406fd88153b3ee1b8fe87df373f115b6bbad034d27202507bfe7f8484323ea6c995f241afc85f55c28b97dafc4b7
|
data/aptible-auth.gemspec
CHANGED
@@ -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.
|
9
|
+
spec.version = '0.4.0'
|
10
10
|
spec.authors = ['Frank Macreery']
|
11
11
|
spec.email = ['frank@macreery.com']
|
12
12
|
spec.description = 'Ruby client for auth.aptible.com'
|
data/lib/aptible/auth/client.rb
CHANGED
@@ -12,17 +12,17 @@ module Aptible
|
|
12
12
|
end
|
13
13
|
|
14
14
|
def self.all(options = {})
|
15
|
-
resource =
|
15
|
+
resource = find_by_url(collection_url, options)
|
16
16
|
resource.send(basename).entries
|
17
17
|
end
|
18
18
|
|
19
|
-
def self.find(id)
|
20
|
-
find_by_url("#{collection_url}/#{id}")
|
19
|
+
def self.find(id, options = {})
|
20
|
+
find_by_url("#{collection_url}/#{id}", options)
|
21
21
|
end
|
22
22
|
|
23
|
-
def self.find_by_url(url)
|
23
|
+
def self.find_by_url(url, options = {})
|
24
24
|
# REVIEW: Should exception be raised if return type mismatch?
|
25
|
-
new.find_by_url(url)
|
25
|
+
new(options).find_by_url(url)
|
26
26
|
rescue
|
27
27
|
nil
|
28
28
|
end
|
@@ -40,6 +40,17 @@ module Aptible
|
|
40
40
|
end
|
41
41
|
# rubocop:enable PredicateName
|
42
42
|
|
43
|
+
def self.belongs_to(relation)
|
44
|
+
define_method relation do
|
45
|
+
get unless loaded
|
46
|
+
if (memoized = instance_variable_get("@#{relation}"))
|
47
|
+
memoized
|
48
|
+
else
|
49
|
+
instance_variable_set("@#{relation}", links[relation].get)
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
43
54
|
private
|
44
55
|
|
45
56
|
def self.define_has_many_getter(relation)
|
data/lib/aptible/auth/role.rb
CHANGED
data/lib/aptible/auth/session.rb
CHANGED
@@ -11,7 +11,7 @@ describe Aptible::Auth::Resource do
|
|
11
11
|
describe '.find' do
|
12
12
|
it 'should call find_by_url' do
|
13
13
|
url = 'https://auth.aptible.com/roles/42'
|
14
|
-
expect(Aptible::Auth::Role).to receive(:find_by_url).with url
|
14
|
+
expect(Aptible::Auth::Role).to receive(:find_by_url).with url, {}
|
15
15
|
Aptible::Auth::Role.find(42)
|
16
16
|
end
|
17
17
|
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.
|
4
|
+
version: 0.4.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-03-
|
11
|
+
date: 2014-03-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: gem_config
|