civo 1.5.4 → 1.5.5

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
  SHA256:
3
- metadata.gz: 66ade81f651621df55e94e267d6b53056dda03d007a58f32ee3b70febf474989
4
- data.tar.gz: '085c5c51b3a7e2a70b69cfdf28e86e85a72ce402bcc5e80a39ce892453fdeb9b'
3
+ metadata.gz: 9ab48b29aaf69b2c3813afb09143b139774e0e55bc542243c5ca182fdaf7d707
4
+ data.tar.gz: 168d513969f901886fad9d64509d2f0c0b5b7ce1229973c8ac016765bb1a7f35
5
5
  SHA512:
6
- metadata.gz: 5617f6759823718d30b29bf0d0aed6b307edf0269d284b78b2585fa136d5a6d223ae95e7c39f7e665d45e9bbd8121dee38e5469107653a176c2803fda0a96741
7
- data.tar.gz: 2a23679344be30a3314a0ac008baa023926143ce4f035098473e658551a8dca3980bed65bd5f0409d0d5583e469921a2979a9d262c240f1486b536a7d9fd4030
6
+ metadata.gz: b9239f60e9060cfd1e2fed7bdd6140a005f3aa178e072abb62a6569cb585e6f553a1c4e9957311d5c4398497769af63c362d57d68d59d3890488ee133d8227c6
7
+ data.tar.gz: 6bf212e039c8a7daa86e9f2cc3f175088acc6af08099acc93f8854be2f170e1ed6b0340ec3caf07ad0784ed988f9dc8ab989a099c28bb3026ca7548d036d7134
@@ -1,17 +1,91 @@
1
1
  module Civo
2
2
  class Database < Base
3
- get :all, "/v#{ENV["CIVO_API_VERSION"] || "2"}/databases"
4
- post :create, "/v#{ENV["CIVO_API_VERSION"] || "2"}/databases", requires: [:name, :size, :region]
5
- get :find, "/v#{ENV["CIVO_API_VERSION"] || "2"}/databases/:id"
6
- put :update, "/v#{ENV["CIVO_API_VERSION"] || "2"}/databases/:id"
7
- delete :remove, "/v#{ENV["CIVO_API_VERSION"] || "2"}/databases/:id", requires: [:id]
8
- put :upgrade, "/v#{ENV["CIVO_API_VERSION"] || "2"}/databases/:id/resize", requires: [:size, :id]
9
- put :restore, "/v#{ENV["CIVO_API_VERSION"] || "2"}/databases/:id/restore", requires: [:snapshot_id]
10
- get :snapshots, "/v#{ENV["CIVO_API_VERSION"] || "2"}/databases/:id/snapshots"
11
- put :tags, "/v#{ENV["CIVO_API_VERSION"] || "2"}/databases/:id/tags"
3
+ get :all, "/v#{ENV["CIVO_API_VERSION"] || "2"}/databases", requires: [:region], fake: :databases
4
+ post :create, "/v#{ENV["CIVO_API_VERSION"] || "2"}/databases", requires: [:name, :size, :region, :software, :network_id], fake: :create_database
5
+ get :find, "/v#{ENV["CIVO_API_VERSION"] || "2"}/databases/:id", requires: [:region], fake: :get_database
6
+ patch :update, "/v#{ENV["CIVO_API_VERSION"] || "2"}/databases/:id", requires: [:region], fake: :update_database
7
+ delete :remove, "/v#{ENV["CIVO_API_VERSION"] || "2"}/databases/:id", requires: [:id, :region], fake: :delete_database
8
+ post :restore, "/v#{ENV["CIVO_API_VERSION"] || "2"}/databases/:id/restore", requires: [:region, :snapshot_id], fake: :restore_database
12
9
 
13
10
  def to_partial_path
14
11
  "civo/database"
15
12
  end
13
+
14
+ def databases
15
+ [
16
+ {
17
+ "id": "5cc0696d-6663-48a9-8123-87adb997138c",
18
+ "name": "Mysite-DB",
19
+ "replicas": 2,
20
+ "size": 10,
21
+ "software": "PostgreSQL",
22
+ "software_version": "10.1",
23
+ "public_ip": "84.127.44.100",
24
+ "network_id": "5be0646d-6e63-4aa9-8123-87adb447138c",
25
+ "snapshots": [
26
+ {
27
+ "id": "5cc0696d-6663-48a9-8123-87adb997138c",
28
+ "timestamp": "2021-12-04T10:00:28Z"
29
+ }
30
+ ]
31
+ }
32
+ ].to_json
33
+ end
34
+
35
+ def get_database
36
+ {
37
+ "id": "5cc0696d-6663-48a9-8123-87adb997138c",
38
+ "name": "Mysite-DB",
39
+ "replicas": 2,
40
+ "size": 10,
41
+ "software": "PostgreSQL",
42
+ "software_version": "10.1",
43
+ "public_ip": "84.127.44.100",
44
+ "network_id": "5be0646d-6e63-4aa9-8123-87adb447138c",
45
+ "snapshots": [
46
+ {
47
+ "id": "5cc0696d-6663-48a9-8123-87adb997138c",
48
+ "timestamp": "2021-12-04T10:00:28Z"
49
+ }
50
+ ]
51
+ }.to_json
52
+ end
53
+
54
+ def create_database
55
+ {
56
+ "id": "5cc0696d-6663-48a9-8123-87adb997138c",
57
+ "name": "Mysite-DB",
58
+ "replicas": 2,
59
+ "size": 10,
60
+ "software": "PostgreSQL",
61
+ "software_version": "10.1",
62
+ "public_ip": "84.127.44.100",
63
+ "network_id": "5be0646d-6e63-4aa9-8123-87adb447138c",
64
+ "snapshots": []
65
+ }.to_json
66
+ end
67
+
68
+ def update_database
69
+ {
70
+ "id": "5cc0696d-6663-48a9-8123-87adb997138c",
71
+ "name": "Mysite-DB-renamed",
72
+ "replicas": 3,
73
+ "size": 10,
74
+ "software": "PostgreSQL",
75
+ "software_version": "10.1",
76
+ "public_ip": "84.127.44.100",
77
+ "network_id": "5be0646d-6e63-4aa9-8123-87adb447138c",
78
+ "snapshots": []
79
+ }.to_json
80
+ end
81
+
82
+ def restore_database
83
+ { result: "OK" }.to_json
84
+ end
85
+
86
+ def delete_database
87
+ { result: "OK" }.to_json
88
+ end
89
+
16
90
  end
17
91
  end
@@ -1,13 +1,55 @@
1
1
  module Civo
2
2
  class LoadBalancer < Base
3
- get :all, "/v2/loadbalancers"
4
- get :find, "/v2/loadbalancers/:id"
5
- post :create, "/v2/loadbalancers", required: [:hostname]
6
- put :update, "/v2/loadbalancers/:id"
7
- delete :remove, "/v2/loadbalancers/:id", required: [:id]
3
+ get :all, "/v2/loadbalancers", fake: :loadbalancers
4
+ get :find, "/v2/loadbalancers/:id", fake: :get_loadbalancer
5
+ post :create, "/v2/loadbalancers", required: [:hostname], fake: :get_loadbalancer
6
+ put :update, "/v2/loadbalancers/:id", fake: :get_loadbalancer
7
+ delete :remove, "/v2/loadbalancers/:id", required: [:id], fake: :delete_loadbalancer
8
8
 
9
9
  def to_partial_path
10
10
  "civo/loadbalancer"
11
11
  end
12
+
13
+ def loadbalancers
14
+ [
15
+ {
16
+ id: 23,
17
+ name: "Johnny",
18
+ algorithm: "round_robin",
19
+ state: "available",
20
+ public_ipv4: "192.168.1.10",
21
+ private_ipv4: "10.10.10.10",
22
+ firewall_id: "86E2749F-8FA1-4D49-8833-299D02E585B8",
23
+ cluster_id: "96E2749F-8FA1-4D49-8833-299D02E585B8"
24
+ },
25
+ {
26
+ id: 223,
27
+ name: "Dep",
28
+ algorithm: "weighted_fixed",
29
+ state: "available",
30
+ public_ipv4: "192.168.1.30",
31
+ private_ipv4: "10.10.10.12",
32
+ firewall_id: "36E2749F-8FA1-4D49-8833-299D02E585B8",
33
+ cluster_id: "46E2749F-8FA1-4D49-8833-299D02E585B8"
34
+ }
35
+ ].to_json
36
+ end
37
+
38
+ def get_loadbalancer
39
+ {
40
+ id: 23,
41
+ name: "Johnny",
42
+ algorithm: "round_robin",
43
+ state: "available",
44
+ public_ipv4: "192.168.1.10",
45
+ private_ipv4: "10.10.10.10",
46
+ firewall_id: "86E2749F-8FA1-4D49-8833-299D02E585B8",
47
+ cluster_id: "96E2749F-8FA1-4D49-8833-299D02E585B8"
48
+ }.to_json
49
+ end
50
+
51
+ def delete_loadbalancer
52
+ { result: "Success" }.to_json
53
+ end
12
54
  end
13
55
  end
data/lib/civo/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Civo
2
- VERSION = "1.5.4"
2
+ VERSION = "1.5.5"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: civo
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.5.4
4
+ version: 1.5.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andy Jeffries
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-10-18 00:00:00.000000000 Z
11
+ date: 2021-12-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: flexirest