ruby_api_pack_cloudways 0.2.0 → 0.3.0
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 +4 -4
- data/README.md +2 -1
- data/lib/ruby_api_pack_cloudways/api/cw_lists.rb +60 -11
- data/lib/ruby_api_pack_cloudways/api/cw_server.rb +6 -6
- data/lib/ruby_api_pack_cloudways/connection/cw_connect.rb +1 -1
- data/lib/ruby_api_pack_cloudways/connection/cw_token.rb +1 -1
- data/lib/ruby_api_pack_cloudways/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 55bab48c0d619f7918865a2a4e3f73a8384253844892e29231fe00843e4168b2
|
4
|
+
data.tar.gz: 44054862918fd30db13413b2b8d344e59a44e7f522add84b13d31c93afa5d9e5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 97fbbb96b0ebc20a12ce6af6912e08f1a9962d95c319fe40a6f48c3a4de41c1d45b66ad2fa3b1b2a17402051e700df54f4eb2500664cee3182871b80705f40c9
|
7
|
+
data.tar.gz: 0b85aeeb9211ffab7c946fdf219a4015f8ab3c937274700f356f0e39d5e769e77588a0c172d608e7e05628b5ee6abbed4d98b2f2f82385c19b2713fea555732a
|
data/README.md
CHANGED
@@ -61,7 +61,8 @@ $ gem install ruby_api_pack_cloudways
|
|
61
61
|
# Documentation Wiki
|
62
62
|
|
63
63
|
- [Home](https://github.com/phcdevworks/ruby_api_pack_cloudways/wiki)
|
64
|
-
- [
|
64
|
+
- [List Endpoints](https://github.com/phcdevworks/ruby_api_pack_cloudways/wiki/Cloudways-Ruby-List-Endpoints)
|
65
|
+
- [Server Endpoints](https://github.com/phcdevworks/ruby_api_pack_cloudways/wiki/Cloudways-Ruby-Server-Endpoints)
|
65
66
|
|
66
67
|
## Contributing
|
67
68
|
|
@@ -3,27 +3,76 @@
|
|
3
3
|
module RubyApiPackCloudways
|
4
4
|
module Api
|
5
5
|
class CwLists
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
6
|
+
# List endpoints
|
7
|
+
ENDPOINTS = {
|
8
|
+
apps: '/apps',
|
9
|
+
backup_frequencies: '/backup-frequencies',
|
10
|
+
countries: '/countries',
|
11
|
+
monitor_durations: '/monitoring/durations',
|
12
|
+
monitor_targets: '/monitoring/targets',
|
13
|
+
packages: '/packages',
|
14
|
+
providers: '/providers',
|
15
|
+
regions: '/regions',
|
16
|
+
server_sizes: '/server_sizes',
|
17
|
+
settings: '/settings'
|
18
|
+
}.freeze
|
19
|
+
|
20
|
+
# Fetch list of applications available
|
21
|
+
def self.app_list
|
22
|
+
fetch_resource(ENDPOINTS[:apps])['apps']
|
11
23
|
end
|
12
24
|
|
25
|
+
# Fetch list of available backup frequencies
|
26
|
+
def self.backup_frequency_list
|
27
|
+
fetch_resource(ENDPOINTS[:backup_frequencies])['frequencies']
|
28
|
+
end
|
29
|
+
|
30
|
+
# Fetch list of supported countries
|
31
|
+
def self.country_list
|
32
|
+
fetch_resource(ENDPOINTS[:countries])['countries']
|
33
|
+
end
|
34
|
+
|
35
|
+
# Fetch list of monitoring durations
|
36
|
+
def self.monitor_duration_list
|
37
|
+
fetch_resource(ENDPOINTS[:monitor_durations])['durations']
|
38
|
+
end
|
39
|
+
|
40
|
+
# Fetch list of monitoring targets
|
41
|
+
def self.monitor_target_list
|
42
|
+
fetch_resource(ENDPOINTS[:monitor_targets])['targets']
|
43
|
+
end
|
44
|
+
|
45
|
+
# Fetch list of available packages
|
46
|
+
def self.package_list
|
47
|
+
fetch_resource(ENDPOINTS[:packages])['packages']
|
48
|
+
end
|
49
|
+
|
50
|
+
# Fetch list of providers
|
13
51
|
def self.provider_list
|
14
|
-
fetch_resource(
|
52
|
+
fetch_resource(ENDPOINTS[:providers])['providers']
|
53
|
+
end
|
54
|
+
|
55
|
+
# Fetch list of regions
|
56
|
+
def self.region_list
|
57
|
+
fetch_resource(ENDPOINTS[:regions])['regions']
|
15
58
|
end
|
16
59
|
|
60
|
+
# Fetch list of server sizes
|
17
61
|
def self.server_size_list
|
18
|
-
fetch_resource(
|
62
|
+
fetch_resource(ENDPOINTS[:server_sizes])['sizes']
|
19
63
|
end
|
20
64
|
|
21
|
-
|
22
|
-
|
65
|
+
# Fetch list of available settings
|
66
|
+
def self.setting_list
|
67
|
+
fetch_resource(ENDPOINTS[:settings])['settings']
|
23
68
|
end
|
24
69
|
|
25
|
-
|
26
|
-
|
70
|
+
# Private method to fetch resources from a specified endpoint
|
71
|
+
private_class_method def self.fetch_resource(endpoint)
|
72
|
+
Connection::CwConnect.new(
|
73
|
+
RubyApiPackCloudways.configuration.api_url,
|
74
|
+
endpoint
|
75
|
+
).cloudways_api_connection
|
27
76
|
end
|
28
77
|
end
|
29
78
|
end
|
@@ -6,11 +6,11 @@ module RubyApiPackCloudways
|
|
6
6
|
# Server endpoints
|
7
7
|
ENDPOINTS = {
|
8
8
|
list: '/server',
|
9
|
-
details: '/server/details',
|
10
9
|
attach_block_storage: '/server/attach_block_storage',
|
11
10
|
clone: '/server/clone',
|
12
11
|
create: '/server/create',
|
13
12
|
delete: '/server/delete',
|
13
|
+
details: '/server/details',
|
14
14
|
disk_usage: '/server/disk_usage',
|
15
15
|
restart: '/server/restart',
|
16
16
|
scale_block_storage: '/server/scale_block_storage',
|
@@ -26,11 +26,6 @@ module RubyApiPackCloudways
|
|
26
26
|
fetch_list(ENDPOINTS[:list])['servers']
|
27
27
|
end
|
28
28
|
|
29
|
-
# Get server details
|
30
|
-
def self.server_details(server_id)
|
31
|
-
fetch_with_id(ENDPOINTS[:details], server_id)
|
32
|
-
end
|
33
|
-
|
34
29
|
# Attach block storage to a server
|
35
30
|
def self.attach_block_storage(server_id, params)
|
36
31
|
post_with_id(ENDPOINTS[:attach_block_storage], server_id, params)
|
@@ -61,6 +56,11 @@ module RubyApiPackCloudways
|
|
61
56
|
fetch_with_id(ENDPOINTS[:restart], server_id)
|
62
57
|
end
|
63
58
|
|
59
|
+
# Get server details
|
60
|
+
def self.server_details(server_id)
|
61
|
+
fetch_with_id(ENDPOINTS[:details], server_id)
|
62
|
+
end
|
63
|
+
|
64
64
|
# Scale block storage of a server
|
65
65
|
def self.scale_block_storage(server_id, params)
|
66
66
|
post_with_id(ENDPOINTS[:scale_block_storage], server_id, params)
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ruby_api_pack_cloudways
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- PHCDevworks
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2024-
|
12
|
+
date: 2024-11-01 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: httparty
|