qas_dock_gem 0.1.32 → 0.1.37

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
  SHA256:
3
- metadata.gz: 7be1ea87019b230b1dda3e97ea6e8f8e65b442a888c4fc8a79d1da7e5a1bc6f2
4
- data.tar.gz: 3aeb5f69d389fe9c0dc99bd619a8149e88b86db27261592c9f060451664d3707
3
+ metadata.gz: d22d0c549e7f3ef33c22a58c14584fd17b9f0c80107d9bcbf4bb4da9bee50715
4
+ data.tar.gz: 6e86575a0db0d3dca7e35996fe0b444b7703091be40296cb5922d87eb08640a0
5
5
  SHA512:
6
- metadata.gz: 7caeec4e016350dc1c1cf659069614c2745222c1172d81f591c6ce4ce8e5e5aee9b224e61dddc246c1c0fbc4d70477f023533cda06bb5a298a19398a34eb2bcc
7
- data.tar.gz: 65914761ecbcba773a93859a4b94ca15a9798a23c6bf32dd37a6c46d49e59c1e881c131c4a96ade8b6adee2c1573d8fab7e6ad4bab1966e225de5ff3bef788a9
6
+ metadata.gz: 44415a2c9a5851dd6b94f2a98c3ddd7075a9da639aa4c4fcdba96d5bccb45c481fe89ec50c896a3d4a5e4c942787c2f5410893dd94d75671dee0289b13421fa1
7
+ data.tar.gz: 4cd62611e2391b10d04570df4548447ff32d5a10ead5a3b9ffa68559970afc81dbd3e90101478ab6163dc39ced4c983e9238f03ef6e7e8195479aedfc6c3e14a
data/.gitignore CHANGED
@@ -1,9 +1,10 @@
1
- /.bundle/
2
- /.yardoc
3
- /_yardoc/
4
- /coverage/
5
- /doc/
6
- /pkg/
7
- /spec/reports/
8
- /tmp/
9
- /.idea/
1
+ /.bundle/
2
+ /.yardoc
3
+ /_yardoc/
4
+ /coverage/
5
+ /doc/
6
+ /pkg/
7
+ /spec/reports/
8
+ /tmp/
9
+ /.idea/
10
+ Gemfile.lock
data/CHANGELOG.md CHANGED
@@ -1,5 +1,5 @@
1
- ## [Unreleased]
2
-
3
- ## [0.1.0] - 2021-05-06
4
-
5
- - Initial release
1
+ ## [Unreleased]
2
+
3
+ ## [0.1.0] - 2021-05-06
4
+
5
+ - Initial release
data/CODE_OF_CONDUCT.md CHANGED
@@ -1,102 +1,102 @@
1
- # Contributor Covenant Code of Conduct
2
-
3
- ## Our Pledge
4
-
5
- We as members, contributors, and leaders pledge to make participation in our community a harassment-free experience for
6
- everyone, regardless of age, body size, visible or invisible disability, ethnicity, sex characteristics, gender identity
7
- and expression, level of experience, education, socio-economic status, nationality, personal appearance, race, religion,
8
- or sexual identity and orientation.
9
-
10
- We pledge to act and interact in ways that contribute to an open, welcoming, diverse, inclusive, and healthy community.
11
-
12
- ## Our Standards
13
-
14
- Examples of behavior that contributes to a positive environment for our community include:
15
-
16
- * Demonstrating empathy and kindness toward other people
17
- * Being respectful of differing opinions, viewpoints, and experiences
18
- * Giving and gracefully accepting constructive feedback
19
- * Accepting responsibility and apologizing to those affected by our mistakes, and learning from the experience
20
- * Focusing on what is best not just for us as individuals, but for the overall community
21
-
22
- Examples of unacceptable behavior include:
23
-
24
- * The use of sexualized language or imagery, and sexual attention or advances of any kind
25
- * Trolling, insulting or derogatory comments, and personal or political attacks
26
- * Public or private harassment
27
- * Publishing others' private information, such as a physical or email address, without their explicit permission
28
- * Other conduct which could reasonably be considered inappropriate in a professional setting
29
-
30
- ## Enforcement Responsibilities
31
-
32
- Community leaders are responsible for clarifying and enforcing our standards of acceptable behavior and will take
33
- appropriate and fair corrective action in response to any behavior that they deem inappropriate, threatening, offensive,
34
- or harmful.
35
-
36
- Community leaders have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits,
37
- issues, and other contributions that are not aligned to this Code of Conduct, and will communicate reasons for
38
- moderation decisions when appropriate.
39
-
40
- ## Scope
41
-
42
- This Code of Conduct applies within all community spaces, and also applies when an individual is officially representing
43
- the community in public spaces. Examples of representing our community include using an official e-mail address, posting
44
- via an official social media account, or acting as an appointed representative at an online or offline event.
45
-
46
- ## Enforcement
47
-
48
- Instances of abusive, harassing, or otherwise unacceptable behavior may be reported to the community leaders responsible
49
- for enforcement at lucas.gimenes23@gmail.com. All complaints will be reviewed and investigated promptly and fairly.
50
-
51
- All community leaders are obligated to respect the privacy and security of the reporter of any incident.
52
-
53
- ## Enforcement Guidelines
54
-
55
- Community leaders will follow these Community Impact Guidelines in determining the consequences for any action they deem
56
- in violation of this Code of Conduct:
57
-
58
- ### 1. Correction
59
-
60
- **Community Impact**: Use of inappropriate language or other behavior deemed unprofessional or unwelcome in the
61
- community.
62
-
63
- **Consequence**: A private, written warning from community leaders, providing clarity around the nature of the violation
64
- and an explanation of why the behavior was inappropriate. A public apology may be requested.
65
-
66
- ### 2. Warning
67
-
68
- **Community Impact**: A violation through a single incident or series of actions.
69
-
70
- **Consequence**: A warning with consequences for continued behavior. No interaction with the people involved, including
71
- unsolicited interaction with those enforcing the Code of Conduct, for a specified period of time. This includes avoiding
72
- interactions in community spaces as well as external channels like social media. Violating these terms may lead to a
73
- temporary or permanent ban.
74
-
75
- ### 3. Temporary Ban
76
-
77
- **Community Impact**: A serious violation of community standards, including sustained inappropriate behavior.
78
-
79
- **Consequence**: A temporary ban from any sort of interaction or public communication with the community for a specified
80
- period of time. No public or private interaction with the people involved, including unsolicited interaction with those
81
- enforcing the Code of Conduct, is allowed during this period. Violating these terms may lead to a permanent ban.
82
-
83
- ### 4. Permanent Ban
84
-
85
- **Community Impact**: Demonstrating a pattern of violation of community standards, including sustained inappropriate
86
- behavior, harassment of an individual, or aggression toward or disparagement of classes of individuals.
87
-
88
- **Consequence**: A permanent ban from any sort of public interaction within the community.
89
-
90
- ## Attribution
91
-
92
- This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 2.0, available
93
- at https://www.contributor-covenant.org/version/2/0/code_of_conduct.html.
94
-
95
- Community Impact Guidelines were inspired
96
- by [Mozilla's code of conduct enforcement ladder](https://github.com/mozilla/diversity).
97
-
98
- [homepage]: https://www.contributor-covenant.org
99
-
100
- For answers to common questions about this code of conduct, see the FAQ at
101
- https://www.contributor-covenant.org/faq. Translations are available
102
- at https://www.contributor-covenant.org/translations.
1
+ # Contributor Covenant Code of Conduct
2
+
3
+ ## Our Pledge
4
+
5
+ We as members, contributors, and leaders pledge to make participation in our community a harassment-free experience for
6
+ everyone, regardless of age, body size, visible or invisible disability, ethnicity, sex characteristics, gender identity
7
+ and expression, level of experience, education, socio-economic status, nationality, personal appearance, race, religion,
8
+ or sexual identity and orientation.
9
+
10
+ We pledge to act and interact in ways that contribute to an open, welcoming, diverse, inclusive, and healthy community.
11
+
12
+ ## Our Standards
13
+
14
+ Examples of behavior that contributes to a positive environment for our community include:
15
+
16
+ * Demonstrating empathy and kindness toward other people
17
+ * Being respectful of differing opinions, viewpoints, and experiences
18
+ * Giving and gracefully accepting constructive feedback
19
+ * Accepting responsibility and apologizing to those affected by our mistakes, and learning from the experience
20
+ * Focusing on what is best not just for us as individuals, but for the overall community
21
+
22
+ Examples of unacceptable behavior include:
23
+
24
+ * The use of sexualized language or imagery, and sexual attention or advances of any kind
25
+ * Trolling, insulting or derogatory comments, and personal or political attacks
26
+ * Public or private harassment
27
+ * Publishing others' private information, such as a physical or email address, without their explicit permission
28
+ * Other conduct which could reasonably be considered inappropriate in a professional setting
29
+
30
+ ## Enforcement Responsibilities
31
+
32
+ Community leaders are responsible for clarifying and enforcing our standards of acceptable behavior and will take
33
+ appropriate and fair corrective action in response to any behavior that they deem inappropriate, threatening, offensive,
34
+ or harmful.
35
+
36
+ Community leaders have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits,
37
+ issues, and other contributions that are not aligned to this Code of Conduct, and will communicate reasons for
38
+ moderation decisions when appropriate.
39
+
40
+ ## Scope
41
+
42
+ This Code of Conduct applies within all community spaces, and also applies when an individual is officially representing
43
+ the community in public spaces. Examples of representing our community include using an official e-mail address, posting
44
+ via an official social media account, or acting as an appointed representative at an online or offline event.
45
+
46
+ ## Enforcement
47
+
48
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be reported to the community leaders responsible
49
+ for enforcement at lucas.gimenes23@gmail.com. All complaints will be reviewed and investigated promptly and fairly.
50
+
51
+ All community leaders are obligated to respect the privacy and security of the reporter of any incident.
52
+
53
+ ## Enforcement Guidelines
54
+
55
+ Community leaders will follow these Community Impact Guidelines in determining the consequences for any action they deem
56
+ in violation of this Code of Conduct:
57
+
58
+ ### 1. Correction
59
+
60
+ **Community Impact**: Use of inappropriate language or other behavior deemed unprofessional or unwelcome in the
61
+ community.
62
+
63
+ **Consequence**: A private, written warning from community leaders, providing clarity around the nature of the violation
64
+ and an explanation of why the behavior was inappropriate. A public apology may be requested.
65
+
66
+ ### 2. Warning
67
+
68
+ **Community Impact**: A violation through a single incident or series of actions.
69
+
70
+ **Consequence**: A warning with consequences for continued behavior. No interaction with the people involved, including
71
+ unsolicited interaction with those enforcing the Code of Conduct, for a specified period of time. This includes avoiding
72
+ interactions in community spaces as well as external channels like social media. Violating these terms may lead to a
73
+ temporary or permanent ban.
74
+
75
+ ### 3. Temporary Ban
76
+
77
+ **Community Impact**: A serious violation of community standards, including sustained inappropriate behavior.
78
+
79
+ **Consequence**: A temporary ban from any sort of interaction or public communication with the community for a specified
80
+ period of time. No public or private interaction with the people involved, including unsolicited interaction with those
81
+ enforcing the Code of Conduct, is allowed during this period. Violating these terms may lead to a permanent ban.
82
+
83
+ ### 4. Permanent Ban
84
+
85
+ **Community Impact**: Demonstrating a pattern of violation of community standards, including sustained inappropriate
86
+ behavior, harassment of an individual, or aggression toward or disparagement of classes of individuals.
87
+
88
+ **Consequence**: A permanent ban from any sort of public interaction within the community.
89
+
90
+ ## Attribution
91
+
92
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 2.0, available
93
+ at https://www.contributor-covenant.org/version/2/0/code_of_conduct.html.
94
+
95
+ Community Impact Guidelines were inspired
96
+ by [Mozilla's code of conduct enforcement ladder](https://github.com/mozilla/diversity).
97
+
98
+ [homepage]: https://www.contributor-covenant.org
99
+
100
+ For answers to common questions about this code of conduct, see the FAQ at
101
+ https://www.contributor-covenant.org/faq. Translations are available
102
+ at https://www.contributor-covenant.org/translations.
data/Gemfile CHANGED
@@ -1,8 +1,8 @@
1
- # frozen_string_literal: true
2
-
3
- source 'https://rubygems.org'
4
-
5
- # Specify your gem's dependencies in qas_dock_gem.gemspec
6
- gemspec
7
-
8
- gem 'rake', '~> 13.0'
1
+ # frozen_string_literal: true
2
+
3
+ source 'https://rubygems.org'
4
+
5
+ # Specify your gem's dependencies in qas_dock_gem.gemspec
6
+ gemspec
7
+
8
+ gem 'rake', '~> 13.0'
data/LICENSE.txt CHANGED
@@ -1,21 +1,21 @@
1
- The MIT License (MIT)
2
-
3
- Copyright (c) 2021 LucasKoritar23
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in
13
- all copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
- THE SOFTWARE.
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2021 LucasKoritar23
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
data/README.md CHANGED
@@ -1,51 +1,51 @@
1
- # QasDockGem
2
-
3
- Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library
4
- into a gem. Put your Ruby code in the file `lib/qas_dock_gem`. To experiment with that code, run `bin/console` for an
5
- interactive prompt.
6
-
7
- TODO: Delete this and the text above, and describe your gem
8
-
9
- ## Installation
10
-
11
- Add this line to your application's Gemfile:
12
-
13
- ```ruby
14
- gem 'qas_dock_gem'
15
- ```
16
-
17
- And then execute:
18
-
19
- $ bundle install
20
-
21
- Or install it yourself as:
22
-
23
- $ gem install qas_dock_gem
24
-
25
- ## Usage
26
-
27
- TODO: Write usage instructions here
28
-
29
- ## Development
30
-
31
- After checking out the repo, run `bin/setup` to install dependencies. You can also run `bin/console` for an interactive
32
- prompt that will allow you to experiment.
33
-
34
- To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the
35
- version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version,
36
- push git commits and the created tag, and push the `.gem` file to [rubygems.org](https://rubygems.org).
37
-
38
- ## Contributing
39
-
40
- Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/qas_dock_gem. This project is
41
- intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to
42
- the [code of conduct](https://github.com/[USERNAME]/qas_dock_gem/blob/master/CODE_OF_CONDUCT.md).
43
-
44
- ## License
45
-
46
- The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
47
-
48
- ## Code of Conduct
49
-
50
- Everyone interacting in the QasDockGem project's codebases, issue trackers, chat rooms and mailing lists is expected to
51
- follow the [code of conduct](https://github.com/[USERNAME]/qas_dock_gem/blob/master/CODE_OF_CONDUCT.md).
1
+ # QasDockGem
2
+
3
+ Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library
4
+ into a gem. Put your Ruby code in the file `lib/qas_dock_gem`. To experiment with that code, run `bin/console` for an
5
+ interactive prompt.
6
+
7
+ TODO: Delete this and the text above, and describe your gem
8
+
9
+ ## Installation
10
+
11
+ Add this line to your application's Gemfile:
12
+
13
+ ```ruby
14
+ gem 'qas_dock_gem'
15
+ ```
16
+
17
+ And then execute:
18
+
19
+ $ bundle install
20
+
21
+ Or install it yourself as:
22
+
23
+ $ gem install qas_dock_gem
24
+
25
+ ## Usage
26
+
27
+ TODO: Write usage instructions here
28
+
29
+ ## Development
30
+
31
+ After checking out the repo, run `bin/setup` to install dependencies. You can also run `bin/console` for an interactive
32
+ prompt that will allow you to experiment.
33
+
34
+ To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the
35
+ version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version,
36
+ push git commits and the created tag, and push the `.gem` file to [rubygems.org](https://rubygems.org).
37
+
38
+ ## Contributing
39
+
40
+ Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/qas_dock_gem. This project is
41
+ intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to
42
+ the [code of conduct](https://github.com/[USERNAME]/qas_dock_gem/blob/master/CODE_OF_CONDUCT.md).
43
+
44
+ ## License
45
+
46
+ The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
47
+
48
+ ## Code of Conduct
49
+
50
+ Everyone interacting in the QasDockGem project's codebases, issue trackers, chat rooms and mailing lists is expected to
51
+ follow the [code of conduct](https://github.com/[USERNAME]/qas_dock_gem/blob/master/CODE_OF_CONDUCT.md).
data/Rakefile CHANGED
@@ -1,4 +1,4 @@
1
- # frozen_string_literal: true
2
-
3
- require "bundler/gem_tasks"
4
- task default: %i[]
1
+ # frozen_string_literal: true
2
+
3
+ require "bundler/gem_tasks"
4
+ task default: %i[]
data/bin/console CHANGED
@@ -1,15 +1,15 @@
1
- #!/usr/bin/env ruby
2
- # frozen_string_literal: true
3
-
4
- require "bundler/setup"
5
- require "qas_dock_gem"
6
-
7
- # You can add fixtures and/or initialization code here to make experimenting
8
- # with your gem easier. You can also use a different console, if you like.
9
-
10
- # (If you use this, don't forget to add pry to your Gemfile!)
11
- # require "pry"
12
- # Pry.start
13
-
14
- require "irb"
15
- IRB.start(__FILE__)
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ require "bundler/setup"
5
+ require "qas_dock_gem"
6
+
7
+ # You can add fixtures and/or initialization code here to make experimenting
8
+ # with your gem easier. You can also use a different console, if you like.
9
+
10
+ # (If you use this, don't forget to add pry to your Gemfile!)
11
+ # require "pry"
12
+ # Pry.start
13
+
14
+ require "irb"
15
+ IRB.start(__FILE__)
data/bin/setup CHANGED
@@ -1,8 +1,8 @@
1
- #!/usr/bin/env bash
2
- set -euo pipefail
3
- IFS=$'\n\t'
4
- set -vx
5
-
6
- bundle install
7
-
8
- # Do any other automated setup that you need to do here
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here
data/lib/qas_dock_gem.rb CHANGED
@@ -1,9 +1,9 @@
1
- # frozen_string_literal: true
2
-
3
- require_relative 'qas_dock_gem/version'
4
- require_relative 'qas_dock_gem/services/aws_services'
5
- require_relative 'qas_dock_gem/services/redis_services'
6
- require_relative 'qas_dock_gem/services/requests_api_services'
7
-
8
- module QasDockGem
9
- end
1
+ # frozen_string_literal: true
2
+
3
+ require_relative 'qas_dock_gem/version'
4
+ require_relative 'qas_dock_gem/services/aws_services'
5
+ require_relative 'qas_dock_gem/services/redis_services'
6
+ require_relative 'qas_dock_gem/services/requests_api_services'
7
+
8
+ module QasDockGem
9
+ end
@@ -1,23 +1,23 @@
1
- # frozen_string_literal: true
2
-
3
- module QasDockGem
4
- class AwsServices
5
- def credentials_aws(access_key_id, secret_access_key_id, region)
6
- {
7
- access_key_id: access_key_id,
8
- secret_access_key: secret_access_key_id,
9
- region: region
10
- }
11
- end
12
-
13
- def init_secrets_manager(credentials)
14
- require 'aws-sdk-secretsmanager'
15
- Aws::SecretsManager::Client.new(credentials)
16
- end
17
-
18
- def get_sm_secret_value(credentials, secret_name)
19
- secret = init_secrets_manager(credentials).get_secret_value(secret_id: secret_name.to_s)
20
- JSON.parse(secret.secret_string)
21
- end
22
- end
23
- end
1
+ # frozen_string_literal: true
2
+
3
+ module QasDockGem
4
+ class AwsServices
5
+ def credentials_aws(access_key_id, secret_access_key_id, region)
6
+ {
7
+ access_key_id: access_key_id,
8
+ secret_access_key: secret_access_key_id,
9
+ region: region
10
+ }
11
+ end
12
+
13
+ def init_secrets_manager(credentials)
14
+ require 'aws-sdk-secretsmanager'
15
+ Aws::SecretsManager::Client.new(credentials)
16
+ end
17
+
18
+ def get_sm_secret_value(credentials, secret_name)
19
+ secret = init_secrets_manager(credentials).get_secret_value(secret_id: secret_name.to_s)
20
+ JSON.parse(secret.secret_string)
21
+ end
22
+ end
23
+ end
@@ -1,47 +1,52 @@
1
- # frozen_string_literal: true
2
-
3
- module QasDockGem
4
- class RedisService
5
- def initialize
6
- require 'logger'
7
- require 'redis'
8
- @logger = Logger.new($stdout)
9
- end
10
-
11
- def initialize_redis
12
- redis_params = { host: ENV['uri_redis'], port: 6379, connect_timeout: 0.5, read_timeout: 1.0, write_timeout: 1.0 }
13
- @redis = Redis.new(redis_params) # Realiza a tentativa de conexão com o redis com os params informados
14
- begin
15
- @redis.ping
16
- @redis
17
- rescue StandardError => e
18
- @redis = nil
19
- @logger.error("Params Redis: #{JSON.pretty_generate(JSON.parse(redis_params.to_json))}")
20
- @logger.error("Exceção retornada do Redis: #{e.inspect} - Mensagem: #{e.message}")
21
- end
22
- end
23
-
24
- def get_key_redis(key)
25
- @logger.info("Buscando chave #{key} no Redis")
26
- @redis = initialize_redis if @redis.nil?
27
- begin
28
- @redis.get(key)
29
- rescue StandardError => e
30
- @logger.error("Exceção retornada do redis ao consultar a chave: #{e}")
31
- nil
32
- end
33
- end
34
-
35
- def set_key_redis(key, value, ttl)
36
- @logger.info("Cadastrando chave #{key} com valor: #{value} e tempo de duração: #{ttl}")
37
- @redis = initialize_redis if @redis.nil?
38
- begin
39
- set_redis = @redis.set(key, value, ex: ttl)
40
- @logger.info('Chave cadastrada com sucesso no redis') if set_redis == 'OK'
41
- rescue StandardError => e
42
- @logger.error("Exceção retornada do redis ao cadastrar a chave: #{e}")
43
- nil
44
- end
45
- end
46
- end
47
- end
1
+ # frozen_string_literal: true
2
+
3
+ module QasDockGem
4
+ class RedisService
5
+ def initialize
6
+ require 'logger'
7
+ require 'redis'
8
+ @logger = Logger.new($stdout)
9
+ end
10
+
11
+ def initialize_redis(uri, port = nil)
12
+ port = 6379 if port.nil?
13
+ { host: uri, port: port, connect_timeout: 0.5, read_timeout: 1.0, write_timeout: 1.0 }
14
+ end
15
+
16
+ def connect_redis(uri, port = nil)
17
+ redis_params = initialize_redis(uri, port)
18
+ redis = Redis.new(redis_params)
19
+ begin
20
+ redis.ping
21
+ redis
22
+ rescue StandardError => e
23
+ redis = nil
24
+ @logger.error("Params Redis: #{JSON.pretty_generate(JSON.parse(redis_params.to_json))}")
25
+ @logger.error("Exceção retornada do Redis: #{e.inspect} - Mensagem: #{e.message}")
26
+ end
27
+
28
+ redis
29
+ end
30
+
31
+ def get_key_redis(redis, key)
32
+ @logger.info("Buscando chave #{key} no Redis")
33
+ begin
34
+ redis.get(key)
35
+ rescue StandardError => e
36
+ @logger.error("Exceção retornada do redis ao consultar a chave: #{e}")
37
+ nil
38
+ end
39
+ end
40
+
41
+ def set_key_redis(redis, key, value, ttl)
42
+ @logger.info("Cadastrando chave #{key} com valor: #{value} e tempo de duração: #{ttl}")
43
+ begin
44
+ set_redis = redis.set(key, value, ex: ttl)
45
+ @logger.info('Chave cadastrada com sucesso no redis') if set_redis == 'OK'
46
+ rescue StandardError => e
47
+ @logger.error("Exceção retornada do redis ao cadastrar a chave: #{e}")
48
+ nil
49
+ end
50
+ end
51
+ end
52
+ end
@@ -1,123 +1,123 @@
1
- # frozen_string_literal: true
2
-
3
- module QasDockGem
4
- class RequestsAPI
5
- require 'httparty'
6
-
7
- def initialize
8
- require 'logger'
9
- @logger = Logger.new($stdout)
10
- end
11
-
12
- def initialize_headers(token, headers)
13
- headers_default = { "cache-control": 'no-cache', "content-type": 'application/json' }
14
-
15
- # seta o campo authorization caso o token seja diferente de nulo
16
- headers_default['Authorization'] = token unless token.nil?
17
-
18
- # define os headers parametrizados como um Hash caso seja nulo
19
- headers = {} if headers.nil?
20
-
21
- # realiza o merge dos headers defaults + os headers parametrizados
22
- headers_default.merge!(headers)
23
-
24
- # remove o campo content-type caso não seja informado
25
- if (headers_default[:"content-type"] == '') || headers_default[:"content-type"].nil?
26
- headers_default.delete(:"content-type")
27
- end
28
-
29
- # retorna os headers
30
- JSON.parse(headers_default.to_json)
31
- end
32
-
33
- def initialize_request(params)
34
- formated_params = nil
35
- if params.include?(:payload)
36
- formated_params = init_request_body(params[:token], params[:payload], params[:headers])
37
- end
38
-
39
- formated_params = init_request_query(params[:token], params[:query], params[:headers]) if params.include?(:query)
40
-
41
- if params.include?(:basic_auth)
42
- formated_params = init_request_basic_auth(params[:token], params[:basic_auth], params[:headers])
43
- end
44
-
45
- # retorna os params formatados para a request
46
- formated_params
47
- end
48
-
49
- def init_request_body(token, payload, headers)
50
- final_headers = initialize_headers(token, headers)
51
- payload = {} if payload.nil?
52
- @logger.info("Payload: #{payload.to_json}")
53
- @logger.info("Headers: #{final_headers}")
54
-
55
- { headers: final_headers, body: payload.to_json }
56
- end
57
-
58
- def init_request_basic_auth(token, basic_auth, headers)
59
- final_headers = initialize_headers(token, headers)
60
- @logger.info("Headers: #{final_headers}")
61
- { headers: final_headers, basic_auth: basic_auth }
62
- end
63
-
64
- def init_request_query(token, query, headers)
65
- final_headers = initialize_headers(token, headers)
66
- query = {} if query.nil?
67
- @logger.info("Query: #{query}")
68
- @logger.info("Headers: #{final_headers}")
69
-
70
- { headers: final_headers, query: query }
71
- end
72
-
73
- def execute_post(params)
74
- formated_params = initialize_request(params)
75
- @logger.info('Realizando POST')
76
- @logger.info("URI: #{params[:uri]}")
77
- request = HTTParty.post(params[:uri], formated_params)
78
- @logger.info("URI Final: #{request.request.last_uri}")
79
- @logger.info("POST realizado \n")
80
- request
81
- end
82
-
83
- def execute_get(params)
84
- formated_params = initialize_request(params)
85
- @logger.info('Realizando GET')
86
- @logger.info("URI: #{params[:uri]}")
87
- request = HTTParty.get(params[:uri], formated_params)
88
- @logger.info("URI Final: #{request.request.last_uri}")
89
- @logger.info("GET realizado \n")
90
- request
91
- end
92
-
93
- def execute_patch(params)
94
- formated_params = initialize_request(params)
95
- @logger.info('Realizando PATCH')
96
- @logger.info("URI: #{params[:uri]}")
97
- request = HTTParty.patch(params[:uri], formated_params)
98
- @logger.info("URI Final: #{request.request.last_uri}")
99
- @logger.info("PATCH realizado \n")
100
- request
101
- end
102
-
103
- def execute_put(params)
104
- formated_params = initialize_request(params)
105
- @logger.info('Realizando PUT')
106
- @logger.info("URI: #{params[:uri]}")
107
- request = HTTParty.put(params[:uri], formated_params)
108
- @logger.info("URI Final: #{request.request.last_uri}")
109
- @logger.info("PUT realizado \n")
110
- request
111
- end
112
-
113
- def execute_delete(params)
114
- formated_params = initialize_request(params)
115
- @logger.info('Realizando DELETE')
116
- @logger.info("URI: #{params[:uri]}")
117
- request = HTTParty.put(params[:uri], formated_params)
118
- @logger.info("URI Final: #{request.request.last_uri}")
119
- @logger.info("DELETE realizado \n")
120
- request
121
- end
122
- end
123
- end
1
+ # frozen_string_literal: true
2
+
3
+ module QasDockGem
4
+ class RequestsAPI
5
+ require 'httparty'
6
+
7
+ def initialize
8
+ require 'logger'
9
+ @logger = Logger.new($stdout)
10
+ end
11
+
12
+ def initialize_headers(token, headers)
13
+ headers_default = { "cache-control": 'no-cache', "content-type": 'application/json' }
14
+
15
+ # seta o campo authorization caso o token seja diferente de nulo
16
+ headers_default['Authorization'] = token unless token.nil?
17
+
18
+ # define os headers parametrizados como um Hash caso seja nulo
19
+ headers = {} if headers.nil?
20
+
21
+ # realiza o merge dos headers defaults + os headers parametrizados
22
+ headers_default.merge!(headers)
23
+
24
+ # remove o campo content-type caso não seja informado
25
+ if (headers_default[:"content-type"] == '') || headers_default[:"content-type"].nil?
26
+ headers_default.delete(:"content-type")
27
+ end
28
+
29
+ # retorna os headers
30
+ JSON.parse(headers_default.to_json)
31
+ end
32
+
33
+ def initialize_request(params)
34
+ formated_params = nil
35
+ if params.include?(:payload)
36
+ formated_params = init_request_body(params[:token], params[:payload], params[:headers])
37
+ end
38
+
39
+ formated_params = init_request_query(params[:token], params[:query], params[:headers]) if params.include?(:query)
40
+
41
+ if params.include?(:basic_auth)
42
+ formated_params = init_request_basic_auth(params[:token], params[:basic_auth], params[:headers])
43
+ end
44
+
45
+ # retorna os params formatados para a request
46
+ formated_params
47
+ end
48
+
49
+ def init_request_body(token, payload, headers)
50
+ final_headers = initialize_headers(token, headers)
51
+ payload = {} if payload.nil?
52
+ @logger.info("Payload: #{payload.to_json}")
53
+ @logger.info("Headers: #{final_headers}")
54
+
55
+ { headers: final_headers, body: payload.to_json }
56
+ end
57
+
58
+ def init_request_basic_auth(token, basic_auth, headers)
59
+ final_headers = initialize_headers(token, headers)
60
+ @logger.info("Headers: #{final_headers}")
61
+ { headers: final_headers, basic_auth: basic_auth }
62
+ end
63
+
64
+ def init_request_query(token, query, headers)
65
+ final_headers = initialize_headers(token, headers)
66
+ query = {} if query.nil?
67
+ @logger.info("Query: #{query}")
68
+ @logger.info("Headers: #{final_headers}")
69
+
70
+ { headers: final_headers, query: query }
71
+ end
72
+
73
+ def execute_post(params)
74
+ formated_params = initialize_request(params)
75
+ @logger.info('Realizando POST')
76
+ @logger.info("URI: #{params[:uri]}")
77
+ request = HTTParty.post(params[:uri], formated_params)
78
+ @logger.info("URI Final: #{request.request.last_uri}")
79
+ @logger.info("POST realizado \n")
80
+ request
81
+ end
82
+
83
+ def execute_get(params)
84
+ formated_params = initialize_request(params)
85
+ @logger.info('Realizando GET')
86
+ @logger.info("URI: #{params[:uri]}")
87
+ request = HTTParty.get(params[:uri], formated_params)
88
+ @logger.info("URI Final: #{request.request.last_uri}")
89
+ @logger.info("GET realizado \n")
90
+ request
91
+ end
92
+
93
+ def execute_patch(params)
94
+ formated_params = initialize_request(params)
95
+ @logger.info('Realizando PATCH')
96
+ @logger.info("URI: #{params[:uri]}")
97
+ request = HTTParty.patch(params[:uri], formated_params)
98
+ @logger.info("URI Final: #{request.request.last_uri}")
99
+ @logger.info("PATCH realizado \n")
100
+ request
101
+ end
102
+
103
+ def execute_put(params)
104
+ formated_params = initialize_request(params)
105
+ @logger.info('Realizando PUT')
106
+ @logger.info("URI: #{params[:uri]}")
107
+ request = HTTParty.put(params[:uri], formated_params)
108
+ @logger.info("URI Final: #{request.request.last_uri}")
109
+ @logger.info("PUT realizado \n")
110
+ request
111
+ end
112
+
113
+ def execute_delete(params)
114
+ formated_params = initialize_request(params)
115
+ @logger.info('Realizando DELETE')
116
+ @logger.info("URI: #{params[:uri]}")
117
+ request = HTTParty.put(params[:uri], formated_params)
118
+ @logger.info("URI Final: #{request.request.last_uri}")
119
+ @logger.info("DELETE realizado \n")
120
+ request
121
+ end
122
+ end
123
+ end
@@ -1,5 +1,5 @@
1
- # frozen_string_literal: true
2
-
3
- module QasDockGem
4
- VERSION = '0.1.32'
5
- end
1
+ # frozen_string_literal: true
2
+
3
+ module QasDockGem
4
+ VERSION = '0.1.37'
5
+ end
Binary file
data/qas_dock_gem.gemspec CHANGED
@@ -1,26 +1,26 @@
1
- # frozen_string_literal: true
2
-
3
- require_relative 'lib/qas_dock_gem/version'
4
-
5
- Gem::Specification.new do |spec|
6
- spec.name = 'qas_dock_gem'
7
- spec.version = QasDockGem::VERSION
8
- spec.authors = ['LucasKoritar23']
9
- spec.email = ['lucas.gimenes23@gmail.com']
10
-
11
- spec.summary = 'A hello gem to the ruby world'
12
- spec.description = 'I just created this gem to say hello for the ruby gems world, okay.'
13
- spec.homepage = ''
14
- spec.license = 'MIT'
15
-
16
- spec.files = `git ls-files -z`.split("\x0")
17
- spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
18
- spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
- spec.require_paths = ['lib']
20
-
21
- spec.add_development_dependency 'aws-sdk-secretsmanager'
22
- spec.add_development_dependency 'bundler'
23
- spec.add_development_dependency 'httparty'
24
- spec.add_development_dependency 'logger'
25
- spec.add_development_dependency 'redis'
26
- end
1
+ # frozen_string_literal: true
2
+
3
+ require_relative 'lib/qas_dock_gem/version'
4
+
5
+ Gem::Specification.new do |spec|
6
+ spec.name = 'qas_dock_gem'
7
+ spec.version = QasDockGem::VERSION
8
+ spec.authors = ['LucasKoritar23']
9
+ spec.email = ['lucas.gimenes23@gmail.com']
10
+
11
+ spec.summary = 'A hello gem to the ruby world'
12
+ spec.description = 'I just created this gem to say hello for the ruby gems world, okay.'
13
+ spec.homepage = ''
14
+ spec.license = 'MIT'
15
+
16
+ spec.files = `git ls-files -z`.split("\x0")
17
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
18
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
+ spec.require_paths = ['lib']
20
+
21
+ spec.add_development_dependency 'aws-sdk-secretsmanager'
22
+ spec.add_development_dependency 'bundler'
23
+ spec.add_development_dependency 'httparty'
24
+ spec.add_development_dependency 'logger'
25
+ spec.add_development_dependency 'redis'
26
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: qas_dock_gem
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.32
4
+ version: 0.1.37
5
5
  platform: ruby
6
6
  authors:
7
7
  - LucasKoritar23
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-05-07 00:00:00.000000000 Z
11
+ date: 2021-05-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: aws-sdk-secretsmanager
@@ -103,12 +103,13 @@ files:
103
103
  - lib/qas_dock_gem/services/redis_services.rb
104
104
  - lib/qas_dock_gem/services/requests_api_services.rb
105
105
  - lib/qas_dock_gem/version.rb
106
+ - qas_dock_gem-0.1.36.gem
106
107
  - qas_dock_gem.gemspec
107
108
  homepage: ''
108
109
  licenses:
109
110
  - MIT
110
111
  metadata: {}
111
- post_install_message:
112
+ post_install_message:
112
113
  rdoc_options: []
113
114
  require_paths:
114
115
  - lib
@@ -123,8 +124,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
123
124
  - !ruby/object:Gem::Version
124
125
  version: '0'
125
126
  requirements: []
126
- rubygems_version: 3.1.2
127
- signing_key:
127
+ rubygems_version: 3.1.6
128
+ signing_key:
128
129
  specification_version: 4
129
130
  summary: A hello gem to the ruby world
130
131
  test_files: []