apitool-client 0.0.7 → 0.0.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: 1436a4436c3445aa3062f20ffd8a701192febfed
4
- data.tar.gz: b132f7a155b6d1fc64d557b5249eb4d9b2db01c2
3
+ metadata.gz: 982bcc4537ef0c8b636ce0f5476b38b216b39083
4
+ data.tar.gz: 4373f8945e34579d81baa58d349633846ccd9eff
5
5
  SHA512:
6
- metadata.gz: f86d0a689638f4bb2dab947e04922a3385888b4e07acdca1175e01f2fa4e243899a43c34c117d833e0fb3388c5c78130fd1095bcd5218e7a4fa7fa38073f453c
7
- data.tar.gz: 7c14f658502e6a8d1e21167127299cbb598c8e521479dd86132b79402330c7e872bc35e838bd80606c8e33ffb1f9f71cef6dedde03aad252301c5514f705f820
6
+ metadata.gz: d6e19433063e23bcbb5bf218a6906ad1c367bf611571d49961979b051dc0065798b46d3f78cbc06dfc60ba91277f7eab317ae7ca229d164c082aafc9bd21080a
7
+ data.tar.gz: ba12824bf41234972729b5cb647148acb9b7416944268081763aaa07eb6645e57f5d295336881436050a211addffbc2f00c43775672911295c93f961881dca05
@@ -1,5 +1,9 @@
1
1
  class Apitool::Client::Backup < Apitool::Client::ApitoolClient
2
2
 
3
+ def path_to_b64_path(path)
4
+ Base64.strict_encode64(path)
5
+ end
6
+
3
7
  def index
4
8
  get('/backups') do |response, request, result|
5
9
  if response.code == 200
@@ -10,8 +14,8 @@ class Apitool::Client::Backup < Apitool::Client::ApitoolClient
10
14
  end
11
15
  end
12
16
 
13
- def show(uuid)
14
- get("/backups/#{uuid}") do |response|
17
+ def show(path)
18
+ get("/backups/#{path_to_b64_path(path)}") do |response|
15
19
  if response.code == 200
16
20
  parse(response)
17
21
  else
@@ -20,10 +24,10 @@ class Apitool::Client::Backup < Apitool::Client::ApitoolClient
20
24
  end
21
25
  end
22
26
 
23
- def create(uuid = nil)
27
+ def create(path = '')
24
28
  parameters = {
25
29
  backup: {
26
- uuid: uuid
30
+ b64_path: path_to_b64_path(path)
27
31
  }
28
32
  }
29
33
  post("/backups", parameters) do |response|
@@ -35,8 +39,8 @@ class Apitool::Client::Backup < Apitool::Client::ApitoolClient
35
39
  end
36
40
  end
37
41
 
38
- def destroy(uuid)
39
- delete("/backups/#{uuid}") do |response|
42
+ def destroy(path)
43
+ delete("/backups/#{path_to_b64_path(path)}") do |response|
40
44
  if response.code == 200
41
45
  parse(response)
42
46
  else
@@ -1,5 +1,5 @@
1
1
  module Apitool
2
2
  module Client
3
- VERSION = "0.0.7"
3
+ VERSION = "0.0.8"
4
4
  end
5
5
  end
@@ -14,16 +14,18 @@ describe Apitool::Client::Backup, order: :defined do
14
14
  it "should be possible to crud backups" do
15
15
  expect(@client.index.class).to be Array
16
16
  uuid = SecureRandom.uuid
17
+ backup = "david"
18
+ path = [uuid, backup].join('/')
17
19
 
18
- backup = @client.create(uuid)
20
+ backup = @client.create(path)
19
21
  expect(@client.result).to be 200
20
- expect(backup[:backup][:uuid]).to eq uuid
22
+ expect(backup[:backup][:path]).to eq path
21
23
 
22
- loaded_backup = @client.show(uuid)
24
+ loaded_backup = @client.show(path)
23
25
  expect(@client.result).to be 200
24
- expect(loaded_backup[:backup][:uuid]).to eq uuid
26
+ expect(loaded_backup[:backup][:path]).to eq path
25
27
 
26
- @client.destroy(uuid)
28
+ @client.destroy(path)
27
29
  expect(@client.result).to be 200
28
30
  end
29
31
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: apitool-client
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.7
4
+ version: 0.0.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Terranova David
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-05-19 00:00:00.000000000 Z
11
+ date: 2015-05-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler