apitool-client 0.0.6 → 0.0.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c7f0ceb4e1b3b73014303266288e09799e21a0e2
4
- data.tar.gz: 63ec9ff5bd01230f15a4f53b8cffb020c8b7208b
3
+ metadata.gz: 1436a4436c3445aa3062f20ffd8a701192febfed
4
+ data.tar.gz: b132f7a155b6d1fc64d557b5249eb4d9b2db01c2
5
5
  SHA512:
6
- metadata.gz: e821ded86c5c8a63a752724316738e8012a7644df72abd7963ca7e9c64b8f9ad332c610833724a52945853ec09b53c60b80dd33558d89659de62b346790dbb83
7
- data.tar.gz: 99448657fe92f97e964275aad2fd38900a795698eb0676378346f0274fceaf1744603697a9316ec134d1f264e8995b961abef37ff9c57739cc94329107692af6
6
+ metadata.gz: f86d0a689638f4bb2dab947e04922a3385888b4e07acdca1175e01f2fa4e243899a43c34c117d833e0fb3388c5c78130fd1095bcd5218e7a4fa7fa38073f453c
7
+ data.tar.gz: 7c14f658502e6a8d1e21167127299cbb598c8e521479dd86132b79402330c7e872bc35e838bd80606c8e33ffb1f9f71cef6dedde03aad252301c5514f705f820
@@ -8,6 +8,7 @@ require "apitool/client/apitool_client"
8
8
  require "apitool/client/role"
9
9
  require "apitool/client/api_key"
10
10
  require "apitool/client/vpn"
11
+ require "apitool/client/backup"
11
12
 
12
13
  module Apitool
13
14
  module Client
@@ -0,0 +1,48 @@
1
+ class Apitool::Client::Backup < Apitool::Client::ApitoolClient
2
+
3
+ def index
4
+ get('/backups') do |response, request, result|
5
+ if response.code == 200
6
+ parse(response)
7
+ else
8
+ nil
9
+ end
10
+ end
11
+ end
12
+
13
+ def show(uuid)
14
+ get("/backups/#{uuid}") do |response|
15
+ if response.code == 200
16
+ parse(response)
17
+ else
18
+ nil
19
+ end
20
+ end
21
+ end
22
+
23
+ def create(uuid = nil)
24
+ parameters = {
25
+ backup: {
26
+ uuid: uuid
27
+ }
28
+ }
29
+ post("/backups", parameters) do |response|
30
+ if response.code == 200
31
+ parse(response)
32
+ else
33
+ nil
34
+ end
35
+ end
36
+ end
37
+
38
+ def destroy(uuid)
39
+ delete("/backups/#{uuid}") do |response|
40
+ if response.code == 200
41
+ parse(response)
42
+ else
43
+ nil
44
+ end
45
+ end
46
+ end
47
+
48
+ end
@@ -1,5 +1,5 @@
1
1
  module Apitool
2
2
  module Client
3
- VERSION = "0.0.6"
3
+ VERSION = "0.0.7"
4
4
  end
5
5
  end
@@ -6,7 +6,7 @@ describe Apitool::Client::ApiKey, order: :defined do
6
6
  host: "127.0.0.1",
7
7
  port: 3001,
8
8
  ssl: false,
9
- token: "ef253c1cb7f379095e3cc2b8dbfceb72",
9
+ token: API_KEY,
10
10
  version: "v1"
11
11
  })
12
12
  end
@@ -6,7 +6,7 @@ describe Apitool::Client::ApitoolClient do
6
6
  host: "127.0.0.1",
7
7
  port: 3001,
8
8
  ssl: false,
9
- token: "ef253c1cb7f379095e3cc2b8dbfceb72",
9
+ token: API_KEY,
10
10
  version: "v1"
11
11
  })
12
12
  end
@@ -0,0 +1,30 @@
1
+ require 'spec_helper'
2
+
3
+ describe Apitool::Client::Backup, order: :defined do
4
+ before(:context) do
5
+ @client = Apitool::Client::Backup.new({
6
+ host: "127.0.0.1",
7
+ port: 3001,
8
+ ssl: false,
9
+ token: API_KEY,
10
+ version: "v1"
11
+ })
12
+ end
13
+
14
+ it "should be possible to crud backups" do
15
+ expect(@client.index.class).to be Array
16
+ uuid = SecureRandom.uuid
17
+
18
+ backup = @client.create(uuid)
19
+ expect(@client.result).to be 200
20
+ expect(backup[:backup][:uuid]).to eq uuid
21
+
22
+ loaded_backup = @client.show(uuid)
23
+ expect(@client.result).to be 200
24
+ expect(loaded_backup[:backup][:uuid]).to eq uuid
25
+
26
+ @client.destroy(uuid)
27
+ expect(@client.result).to be 200
28
+ end
29
+
30
+ end
@@ -6,7 +6,7 @@ describe Apitool::Client::Role, order: :defined do
6
6
  host: "127.0.0.1",
7
7
  port: 3001,
8
8
  ssl: false,
9
- token: "ef253c1cb7f379095e3cc2b8dbfceb72",
9
+ token: API_KEY,
10
10
  version: "v1"
11
11
  })
12
12
  end
@@ -1,3 +1,5 @@
1
1
  require 'debugger'
2
2
 
3
3
  require 'apitool/client'
4
+
5
+ API_KEY="d0125c4e8b43d789a0a0245ea9196701"
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.6
4
+ version: 0.0.7
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-11 00:00:00.000000000 Z
11
+ date: 2015-05-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -110,6 +110,7 @@ files:
110
110
  - lib/apitool/client.rb
111
111
  - lib/apitool/client/api_key.rb
112
112
  - lib/apitool/client/apitool_client.rb
113
+ - lib/apitool/client/backup.rb
113
114
  - lib/apitool/client/logger.rb
114
115
  - lib/apitool/client/role.rb
115
116
  - lib/apitool/client/version.rb
@@ -117,6 +118,7 @@ files:
117
118
  - log/.gitignore
118
119
  - spec/apitool/client/api_key_spec.rb
119
120
  - spec/apitool/client/apitool_client_spec.rb
121
+ - spec/apitool/client/backup_spec.rb
120
122
  - spec/apitool/client/role_spec.rb
121
123
  - spec/apitool/client_spec.rb
122
124
  - spec/spec_helper.rb
@@ -147,6 +149,7 @@ summary: APITool client.
147
149
  test_files:
148
150
  - spec/apitool/client/api_key_spec.rb
149
151
  - spec/apitool/client/apitool_client_spec.rb
152
+ - spec/apitool/client/backup_spec.rb
150
153
  - spec/apitool/client/role_spec.rb
151
154
  - spec/apitool/client_spec.rb
152
155
  - spec/spec_helper.rb