onlyoffice_digitalocean_wrapper 0.6.0 → 0.7.0

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: 2a48169cbc53f211b24f0956d8591465c7569450a04fa7f38a4614d004f7e748
4
- data.tar.gz: aeda8616dfbc66abe0674cd79daf564b1aa98941b1eb66cc08aa03c9af831282
3
+ metadata.gz: 722a209dd7c530acc9eca5dc95af3482ce07b031f1d60458f0fd4f60d68d97f1
4
+ data.tar.gz: 2176a7c8518150703d75437360e757e2be7e6ed770affb877fb02dfc362f2124
5
5
  SHA512:
6
- metadata.gz: 05c74d20d448499946ef83c8710aed8f7fcdf2bebd65b6f522c672f602956868920b4377056fc505ce5ac6b0a6fef364f9a0a23547cdab43713cbc24112a4902
7
- data.tar.gz: 7da944f64237a89ecf4bc966099c8ab102e783ca5d262075159bb8e5b2fbf37c44e2379ed6307d0c3880bdbbd361eb2b40787527b66139df3b910ab099cfe8e6
6
+ metadata.gz: efec409153d5b1d2c94d8ef541ed957f708869b5096c42371224d389adab3d7282d0eccb0e56bb40a30dc6e5a43989eae1c2aeb73830346138f9f20511424e31
7
+ data.tar.gz: 5680e5bc73b4fd25f402fa18de9b788008710ef00fac98dff796e958e1e3e45c682563eeeb169a5b2871af8898a7247e975c81b5f1bf91fe793cb5448714bf6e
@@ -16,7 +16,7 @@ module OnlyofficeDigitaloceanWrapper
16
16
  rescue exception => e
17
17
  try += 1
18
18
  logger.error("Error '#{exception}, #{e}' happened during "\
19
- "operation. Retrying #{try} of #{retries}")
19
+ "operation. Retrying #{try} of #{retries}")
20
20
  sleep timeout # Time to cooldown error
21
21
  try <= retries ? retry : raise
22
22
  end
@@ -22,9 +22,33 @@ module OnlyofficeDigitaloceanWrapper
22
22
  end
23
23
  end
24
24
 
25
+ # Get project by name
26
+ # @param [String] project_name
27
+ # @return [DropletKit::Project] object representing a project
28
+ def project_by_name(project_name)
29
+ retry_exception do
30
+ projects = @client.projects.all
31
+ projects.find { |x| x.name == project_name }
32
+ end
33
+ end
34
+
35
+ # Get project id by name
36
+ # @param [String] project_name
37
+ # @return [nil, String] id of current project or nil is no project found
38
+ def get_project_id_by_name(project_name)
39
+ project = project_by_name(project_name)
40
+ if project.nil?
41
+ logger.info("get_project_id_by_name(#{project_name}): not found any projects")
42
+ nil
43
+ else
44
+ logger.info("get_project_id_by_name(#{project_name}): #{project.id}")
45
+ project.id
46
+ end
47
+ end
48
+
25
49
  # Return droplet id by it's name
26
50
  # @param droplet_name [String] name of droplet
27
- # @return [Integer] id of droplet
51
+ # @return [nil, Integer] id of droplet or nil is no one droplet found
28
52
  def get_droplet_id_by_name(droplet_name)
29
53
  droplet = droplet_by_name(droplet_name)
30
54
  if droplet.nil?
@@ -25,7 +25,7 @@ module OnlyofficeDigitaloceanWrapper
25
25
  File.read(token_file_path).delete("\n")
26
26
  rescue Errno::ENOENT
27
27
  raise Errno::ENOENT, "No access token found in #{token_file_path}. " \
28
- "Please create file #{token_file_path} with token"
28
+ "Please create file #{token_file_path} with token"
29
29
  end
30
30
  end
31
31
  end
@@ -2,7 +2,7 @@
2
2
 
3
3
  module OnlyofficeDigitaloceanWrapper
4
4
  # @return [String] version of gem
5
- VERSION = '0.6.0'
5
+ VERSION = '0.7.0'
6
6
  # @return [String] name of gem
7
7
  NAME = 'onlyoffice_digitalocean_wrapper'
8
8
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: onlyoffice_digitalocean_wrapper
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.0
4
+ version: 0.7.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - ONLYOFFICE
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2021-02-12 00:00:00.000000000 Z
13
+ date: 2021-07-29 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: droplet_kit
@@ -193,7 +193,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
193
193
  - !ruby/object:Gem::Version
194
194
  version: '0'
195
195
  requirements: []
196
- rubygems_version: 3.2.9
196
+ rubygems_version: 3.2.22
197
197
  signing_key:
198
198
  specification_version: 4
199
199
  summary: Wrapper gem for DigitalOcean