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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 21dda808f111d1dae07f217fd2c8bcd4c3c5437b
4
- data.tar.gz: f5da147bd9fb8c6b8ef14fbfe08cebe0a34aad87
3
+ metadata.gz: 0ab1bcb0612ddbf2b9e2ea12406797703a4c4e7c
4
+ data.tar.gz: f3e98b601229d8fc44ccdc469d2cf46fab5e0688
5
5
  SHA512:
6
- metadata.gz: 8e1397c007cd92cfe2cbca0c108385d2a85f40002fc530d626151f67176e9c9936219ae5a7801b89adec4616cd06551b7c338af3fe040e7002d883cbf2bd1d37
7
- data.tar.gz: 3208c71d1e5f701e2c061bf367d37d52de6080fc141699069e5a52d37a7d91196ce28a1ddd60b9b6be741e618fd553fa54d583f60f5d9fed40901e34fac77eac
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.7'
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)
@@ -41,10 +41,10 @@ module Aptible
41
41
  end
42
42
  end
43
43
 
44
- def self.create(options)
45
- token = options.delete(:token)
44
+ def self.create(params)
45
+ token = params.delete(:token)
46
46
  auth = Api.new(token: token)
47
- auth.send(basename).create(options)
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 |options = {}|
87
+ define_method "create_#{relation.to_s.singularize}" do |params = {}|
88
88
  get unless loaded
89
- links[relation].create(options)
89
+ links[relation].create(self.class.normalize_params(params))
90
90
  end
91
91
  end
92
92
 
93
- def update(params)
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
- super(Hash[params_array])
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.7
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-12 00:00:00.000000000 Z
11
+ date: 2014-04-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: gem_config