cloudpassage 0.0.13 → 0.0.14

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: 3e92cb4059f477571d964f49fd2735f21fa121be
4
- data.tar.gz: 1c8bc29d6f6066131997878759fb8f59dc2051dd
3
+ metadata.gz: bcbae6fe51aad88f8f65f058a5d8ecb22a207bc2
4
+ data.tar.gz: 1eef871955974d8dec4a3a896548fa3e71304309
5
5
  SHA512:
6
- metadata.gz: ac02633823a20bf061125ac4f417f450057ca385552a7d2815f80613f46ea8331c7ecb913ff7ad28bc07ab31531a846be9f23b3fecbe9366fe98d865a89f5553
7
- data.tar.gz: fe1098d718b49f46534bb8d9ce88ab1caa8b0200ad47255130a692b0aa9da3aea46bdeac2afdd1431115bbe899a5ed9601f052b2ec0b9ab8c09564c150e6b31d
6
+ metadata.gz: b1acde19f515a84d298708829300d7d961de54b8e9746dd771b2a51d4fca90de1bd0cb3b75a27498392af8771d2034ded3114b04fa9e666f3932c770eb350738
7
+ data.tar.gz: c3f4ff6e6e2706d819e7342d863c3bdcac4efe6c38997f4e5b797109f5258316975e3746939cd1488ba04ebf54e74e0ac3a56697341b31b0a81d9bf53e73e5b7
@@ -71,12 +71,19 @@ module Cloudpassage
71
71
  class_name[index + 2 .. -1].underscore.to_sym
72
72
  end
73
73
 
74
+ # Return true if object exists in the cloudpassage API, false otherwise.
75
+ def exists?
76
+ @base_resource.get(headers)
77
+ true
78
+ rescue RestClient::ResourceNotFound
79
+ false
80
+ end
81
+
74
82
  # Wait for block to evaluate to true.
75
83
  # If specified, options can be used to override default options.
76
84
  # Options should conform to https://rubygems.org/gems/wait
77
85
  def wait_for(options={}, &block)
78
86
  Wait.new(Cloudpassage::wait_options.merge(options)).until do
79
- reload
80
87
  instance_eval &block
81
88
  end
82
89
  end
@@ -98,16 +98,16 @@ module Cloudpassage
98
98
 
99
99
  def disable_account(username)
100
100
  payload = {:account => {:active=>false}}
101
- @server.commands.get(JSON.parse(@base_resource[username].put(payload.to_json, headers))['command']['id'])
101
+ @server..get(JSON.parse(@base_resource[username].put(payload.to_json, headers))['command']['id'])
102
102
  end
103
103
 
104
104
  def reset(username, opts = {})
105
105
  payload = {'password' => password_opts.merge(opts)}
106
- JSON.parse @base_resource[username]['password'].put(payload.to_json, headers)
106
+ @server.commands.get(JSON.parse(@base_resource[username]['password'].put(payload.to_json, headers))['command']['id'])
107
107
  end
108
108
 
109
109
  def remove(username)
110
- JSON.parse @base_resource[username].delete(headers)
110
+ @server.commands.get(JSON.parse(@base_resource[username].delete(headers))['command']['id'])
111
111
  end
112
112
 
113
113
  def headers
@@ -149,8 +149,12 @@ module Cloudpassage
149
149
 
150
150
  class Command < Single
151
151
  def done?
152
- self.reload
153
- %w'completed failed'.include? self.status
152
+ reload
153
+ fail Error.new(self.result) if status == 'failed'
154
+ 'completed' == status
155
+ end
156
+
157
+ class Error < StandardError
154
158
  end
155
159
  end
156
160
 
@@ -1,4 +1,4 @@
1
1
  module Cloudpassage
2
2
  # Version
3
- VERSION = '0.0.13'
3
+ VERSION = '0.0.14'
4
4
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cloudpassage
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.13
4
+ version: 0.0.14
5
5
  platform: ruby
6
6
  authors:
7
7
  - mshea
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-06-05 00:00:00.000000000 Z
11
+ date: 2014-06-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake