aptible-api 0.4.7 → 0.4.8
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/resource.rb +11 -7
- 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: 0ab1bcb0612ddbf2b9e2ea12406797703a4c4e7c
|
4
|
+
data.tar.gz: f3e98b601229d8fc44ccdc469d2cf46fab5e0688
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0021904bd30563932be95c34e0e6f3dd4ae181239605124dcc8bbe9281b35a64ed0bec033287ac01c49f64fd598166a9ad2b1bdfc643ab1ca247733b932e2eb2
|
7
|
+
data.tar.gz: 5b31fcbf867dd06c1dbf8b6367392e2f2dddc48e1c0f9c9f87d1c3b542460d88c14e5773ac694cb41f872c83270802f384d587210f3700d0d84aefabc467f2c1
|
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.4.
|
9
|
+
spec.version = '0.4.8'
|
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/resource.rb
CHANGED
@@ -41,10 +41,10 @@ module Aptible
|
|
41
41
|
end
|
42
42
|
end
|
43
43
|
|
44
|
-
def self.create(
|
45
|
-
token =
|
44
|
+
def self.create(params)
|
45
|
+
token = params.delete(:token)
|
46
46
|
auth = Api.new(token: token)
|
47
|
-
auth.send(basename).create(
|
47
|
+
auth.send(basename).create(normalize_params(params))
|
48
48
|
end
|
49
49
|
|
50
50
|
# rubocop:disable PredicateName
|
@@ -84,17 +84,21 @@ module Aptible
|
|
84
84
|
end
|
85
85
|
|
86
86
|
def self.define_has_many_setter(relation)
|
87
|
-
define_method "create_#{relation.to_s.singularize}" do |
|
87
|
+
define_method "create_#{relation.to_s.singularize}" do |params = {}|
|
88
88
|
get unless loaded
|
89
|
-
links[relation].create(
|
89
|
+
links[relation].create(self.class.normalize_params(params))
|
90
90
|
end
|
91
91
|
end
|
92
92
|
|
93
|
-
def
|
93
|
+
def self.normalize_params(params = {})
|
94
94
|
params_array = params.map do |key, value|
|
95
95
|
value.is_a?(HyperResource) ? [key, value.href] : [key, value]
|
96
96
|
end
|
97
|
-
|
97
|
+
Hash[params_array]
|
98
|
+
end
|
99
|
+
|
100
|
+
def update(params)
|
101
|
+
super(self.class.normalize_params(params))
|
98
102
|
end
|
99
103
|
|
100
104
|
# NOTE: The following does not update the object in-place
|
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.
|
4
|
+
version: 0.4.8
|
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-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: gem_config
|