ruby_api_pack_cloudways 0.1.0.beta.3 → 0.1.0.beta.4

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: 84ed368537251509cd33c2cf69f7f7d8af19f7e6607fabe0baab58e513d643d1
4
- data.tar.gz: 2c1508fd079522587b62e19dd5c673503bdd249eadb8c339478f640ce1304b0e
3
+ metadata.gz: db1288eea59a36999604a6631193db43845dab0a9299ec33f87a61bdd1d897bd
4
+ data.tar.gz: 70e8d8d972691b9fb8f57deaa143ee72db9f98172125922ff13cfdb6ce1d170f
5
5
  SHA512:
6
- metadata.gz: 8bb21d5433f72efd774473b7218b093a0eedc3b0ec11507dae1a59e5e1920aabb4c5e5f0be51edc97db9315d12441569cfa526e25284b7aa9f7284bdaa7b97b2
7
- data.tar.gz: 14f7dfaed2d7a8c0300ca0edb66ef3a0679d58110cc2be667be62edc359d3e2d40bdcd1902f3f0929cf3f9a8f2d2d9f62c99d685029ef5a2853348b688416661
6
+ metadata.gz: 6d6d8eeeea9a28ee4417041efb7dc79757bdbb7a3f3ffe3d143964784ad0d44a2c5d7760f7eff9ba2a6660c1cab52c49526862bcce32e02b0a5591bad4743135
7
+ data.tar.gz: 54ccc64de9ca972724e363c0623363dc9cff411ce23c839926dd673116c4e743f50a0e91985df8d31628fd14bfa9b12d1b87b6f6ccbc1c86b17110447c165483
@@ -2,5 +2,6 @@ require "ruby_api_pack_cloudways/version"
2
2
 
3
3
  module RubyApiPackCloudways
4
4
  class Error < StandardError; end
5
- # Your code goes here...
5
+
6
+ require_relative "ruby_api_pack_cloudways/cw_client"
6
7
  end
@@ -0,0 +1,17 @@
1
+ module RubyApiPackCloudways
2
+ module Api
3
+ class CwLists
4
+
5
+ def self.cw_server_list
6
+ cw_api_list_server = Connection::CwConnect.new(CW_API_URL, "/server")
7
+ return cw_api_list_server.cloudways_api_connection.body
8
+ end
9
+
10
+ def self.cw_providers_list
11
+ providers_lists = Connection::CwConnect.new(CW_API_URL, "/providers")
12
+ return Oj.load(providers_lists.cloudways_api_connection.body)["providers"]
13
+ end
14
+
15
+ end
16
+ end
17
+ end
@@ -1,22 +1,24 @@
1
1
  module RubyApiPackCloudways
2
- module Main
2
+ module Connection
3
3
  class CwConnect
4
4
 
5
5
  # Connection - Attributes
6
6
  attr_accessor :cw_api_url_base, :cw_api_path
7
7
 
8
8
  # Connection - Init
9
- def initialize(cw_api_url_base, cw_api_path, cw_api_token)
9
+ def initialize(cw_api_url_base, cw_api_path)
10
10
  @cw_api_url_base = cw_api_url_base
11
11
  @cw_api_path = cw_api_path
12
- @cw_api_token = cw_api_token
13
12
  end
14
13
 
15
14
  # Connection - API Connection Call
16
15
  def cloudways_api_connection
17
16
 
17
+ cw_api_get_token_connection_request = Connection::CwToken.new(CW_API_URL, CW_API_PATH_TOKEN, CW_API_EMAIL, CW_API_KEY)
18
+ cw_api_get_token_connection_response = cw_api_get_token_connection_request.cw_api_token
19
+
18
20
  cw_api_connetion_response = Faraday.new(url: @cw_api_url_base) do |cw_api_connection|
19
- cw_api_connection.request :oauth2, @cw_api_token, token_type: :bearer
21
+ cw_api_connection.request :oauth2, cw_api_get_token_connection_response, token_type: :bearer
20
22
  cw_api_connection.response :logger
21
23
  cw_api_connection.adapter Faraday.default_adapter
22
24
  end
@@ -25,6 +27,6 @@ module RubyApiPackCloudways
25
27
 
26
28
  end
27
29
 
28
- end
29
- end
30
+ end
31
+ end
30
32
  end
@@ -1,7 +1,10 @@
1
1
  module RubyApiPackCloudways
2
- module Main
2
+ module Connection
3
3
  class CwToken
4
4
 
5
+ # Cloudways - Token - Attributes
6
+ attr_accessor :cw_api_url_base, :cw_url_path_auth, :cw_user_email, :cw_user_key
7
+
5
8
  # Cloudways - Token - Init
6
9
  def initialize(cw_api_url_base, cw_url_path_auth, cw_user_email, cw_user_key)
7
10
  @cw_api_url_base = cw_api_url_base
@@ -21,7 +24,7 @@ module RubyApiPackCloudways
21
24
  end
22
25
 
23
26
  end
24
-
27
+
25
28
  # Cloudways - Token - Request
26
29
  def cw_api_token
27
30
 
@@ -29,13 +32,13 @@ module RubyApiPackCloudways
29
32
  cloudways_token_request = cw_api_token_connection.post do |cw_token_request|
30
33
  cw_token_request.headers["Content-Type"] = "application/x-www-form-urlencoded"
31
34
  cw_token_request.body = {
32
- email: URI::encode(@cw_user_email),
33
- api_key: URI::encode(@cw_user_key)
35
+ email: @cw_user_email,
36
+ api_key: @cw_user_key
34
37
  }
35
38
  end
36
39
 
37
40
  # Cloudways - Token - Request Isolate and Get Token from Response via OJ
38
- return @cw_apit_token = Oj.load(cloudways_token_request.body)["access_token"]
41
+ return cw_api_token = Oj.load(cloudways_token_request.body)["access_token"]
39
42
 
40
43
  end
41
44
 
@@ -0,0 +1,23 @@
1
+ # Variables
2
+ CW_API_URL = "https://api.cloudways.com/api/v1"
3
+ CW_API_PATH_TOKEN = "/oauth/access_token"
4
+ CW_API_EMAIL = ENV["PHCDEV_API_CLOUDWAYS_EMAIL"]
5
+ CW_API_KEY = ENV["PHCDEV_API_CLOUDWAYS_KEY"]
6
+
7
+ module RubyApiPackCloudways
8
+ class CwClient
9
+
10
+ # Load Required Gems
11
+ require "faraday"
12
+ require "faraday_middleware"
13
+ require "oj"
14
+
15
+ # Load Main Files
16
+ require_relative "connection/cw_token"
17
+ require_relative "connection/cw_connect"
18
+
19
+ # Load API Files
20
+ require_relative "api/cw_lists"
21
+
22
+ end
23
+ end
@@ -1,3 +1,3 @@
1
1
  module RubyApiPackCloudways
2
- VERSION = "0.1.0.beta.3"
2
+ VERSION = "0.1.0.beta.4"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ruby_api_pack_cloudways
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0.beta.3
4
+ version: 0.1.0.beta.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - PHCDevworks
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-05-25 00:00:00.000000000 Z
11
+ date: 2021-06-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -28,16 +28,22 @@ dependencies:
28
28
  name: rake
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '13.0'
31
34
  - - ">="
32
35
  - !ruby/object:Gem::Version
33
- version: '0'
36
+ version: 13.0.3
34
37
  type: :runtime
35
38
  prerelease: false
36
39
  version_requirements: !ruby/object:Gem::Requirement
37
40
  requirements:
41
+ - - "~>"
42
+ - !ruby/object:Gem::Version
43
+ version: '13.0'
38
44
  - - ">="
39
45
  - !ruby/object:Gem::Version
40
- version: '0'
46
+ version: 13.0.3
41
47
  - !ruby/object:Gem::Dependency
42
48
  name: oj
43
49
  requirement: !ruby/object:Gem::Requirement
@@ -119,9 +125,10 @@ files:
119
125
  - README.md
120
126
  - Rakefile
121
127
  - lib/ruby_api_pack_cloudways.rb
122
- - lib/ruby_api_pack_cloudways/main/cw_client.rb
123
- - lib/ruby_api_pack_cloudways/main/cw_connect.rb
124
- - lib/ruby_api_pack_cloudways/main/cw_token.rb
128
+ - lib/ruby_api_pack_cloudways/api/cw_lists.rb
129
+ - lib/ruby_api_pack_cloudways/connection/cw_connect.rb
130
+ - lib/ruby_api_pack_cloudways/connection/cw_token.rb
131
+ - lib/ruby_api_pack_cloudways/cw_client.rb
125
132
  - lib/ruby_api_pack_cloudways/version.rb
126
133
  homepage: https://phcdevworks.com/
127
134
  licenses:
@@ -129,7 +136,7 @@ licenses:
129
136
  metadata:
130
137
  allowed_push_host: https://rubygems.org/
131
138
  homepage_uri: https://phcdevworks.com/
132
- source_code_uri: https://github.com/phcdevworks/universal_api_wrapper_pack
139
+ source_code_uri: https://github.com/phcdevworks/universal_api_wrapper_pack/
133
140
  changelog_uri: https://github.com/phcdevworks/universal_api_wrapper_pack/releases
134
141
  post_install_message:
135
142
  rdoc_options: []
@@ -146,7 +153,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
146
153
  - !ruby/object:Gem::Version
147
154
  version: 1.3.1
148
155
  requirements: []
149
- rubygems_version: 3.0.3
156
+ rubygems_version: 3.2.20
150
157
  signing_key:
151
158
  specification_version: 4
152
159
  summary: API Pack for Cloudways
@@ -1,27 +0,0 @@
1
- module RubyApiPackCloudways
2
- module Main
3
- class CwClient
4
-
5
- # Load Required Gems
6
- require "faraday"
7
- require "faraday_middleware"
8
- require "oj"
9
-
10
- # Variables
11
- CW_API_URL = "https://api.cloudways.com/api/v1"
12
- CW_API_PATH_TOKEN = "/oauth/access_token"
13
- CW_API_PATH = "/server"
14
- CW_API_EMAIL = ENV["PHCDEV_API_CLOUDWAYS_EMAIL"]
15
- CW_API_KEY = ENV["PHCDEV_API_CLOUDWAYS_KEY"]
16
-
17
- # Load Main Files
18
- require_relative "cw_token"
19
- require_relative "cw_connect"
20
-
21
- # Get Token Response
22
- cw_api_get_token = CwToken.new(CW_API_URL, CW_API_PATH_TOKEN, CW_API_EMAIL, CW_API_KEY)
23
- cw_api_connection = CwConnect.new(CW_API_URL, CW_API_PATH, cw_api_get_token.cw_api_token)
24
-
25
- end
26
- end
27
- end