aptible-api 0.2.2 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/aptible-api.gemspec +1 -1
- data/lib/aptible/api/app.rb +1 -0
- data/lib/aptible/api/attachment.rb +1 -0
- data/lib/aptible/api/configuration.rb +1 -0
- data/lib/aptible/api/container.rb +1 -0
- data/lib/aptible/api/disk.rb +1 -0
- data/lib/aptible/api/image.rb +1 -0
- data/lib/aptible/api/operation.rb +6 -0
- data/lib/aptible/api/permission.rb +1 -0
- data/lib/aptible/api/proxy.rb +1 -0
- data/lib/aptible/api/release.rb +1 -0
- data/lib/aptible/api/resource.rb +16 -5
- data/lib/aptible/api/service.rb +1 -0
- data/lib/aptible/api/vhost.rb +1 -0
- data/spec/aptible/api/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: 9ae1f234749249ba10c4e830f31cc403b78de9c8
|
4
|
+
data.tar.gz: a984b4d81ba494532f92a52090e067ff7aa5154d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e66e1bafd9405e86e9bbfda05b92ea533b726dab6c7dfe8b15f0c28774053ea3f04abaadbe836401f070dbabf3df2e9a45de9579ac5fb17282a02373f939255f
|
7
|
+
data.tar.gz: b39e936172ff7a45d2e24994f44f2caeff0519b0f970693876ea1e647b2ea952f4f921ac1d367cc41628fc18a0a7c60f494252c38f6070c9a1961bb8542a20b8
|
data/aptible-api.gemspec
CHANGED
@@ -6,7 +6,7 @@ require 'English'
|
|
6
6
|
|
7
7
|
Gem::Specification.new do |spec|
|
8
8
|
spec.name = 'aptible-api'
|
9
|
-
spec.version = '0.
|
9
|
+
spec.version = '0.3.0'
|
10
10
|
spec.authors = ['Frank Macreery']
|
11
11
|
spec.email = ['frank@macreery.com']
|
12
12
|
spec.description = %q{Ruby client for api.aptible.com}
|
data/lib/aptible/api/app.rb
CHANGED
data/lib/aptible/api/disk.rb
CHANGED
data/lib/aptible/api/image.rb
CHANGED
data/lib/aptible/api/proxy.rb
CHANGED
data/lib/aptible/api/release.rb
CHANGED
data/lib/aptible/api/resource.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/api/service.rb
CHANGED
data/lib/aptible/api/vhost.rb
CHANGED
@@ -11,7 +11,7 @@ describe Aptible::Api::Resource do
|
|
11
11
|
describe '.find' do
|
12
12
|
it 'should call find_by_url' do
|
13
13
|
url = 'https://api.aptible.com/disks/42'
|
14
|
-
expect(Aptible::Api::Disk).to receive(:find_by_url).with url
|
14
|
+
expect(Aptible::Api::Disk).to receive(:find_by_url).with url, {}
|
15
15
|
Aptible::Api::Disk.find(42)
|
16
16
|
end
|
17
17
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: aptible-api
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.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
|