news_reader_cli 0.1.1 → 0.1.2

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: ca93ebe7d33de73a47f6e20a0e2aa5d6252bb16d374d5ceab40b8504ef4b4e79
4
- data.tar.gz: 83adc9f0955556770b76b9707c446948fc623aa597a6a0942f6c321eed60ee8e
3
+ metadata.gz: 880b95a69ff20a7a2ae3931a34ffc7f894939626533875bf43c9cedbc4030539
4
+ data.tar.gz: 560ab6f114804d3ea56aa51e40a159e9db1e2bfc3e9cf4f8f60ad7ebd690b796
5
5
  SHA512:
6
- metadata.gz: 526d5ba0dc0de75b46f9aca3761a308498b5fb7426c2b03c8c355e6e38976562b07d711e564d23cae972da2daf95e00dfe99c3d28da8d3da74ee3665d4385290
7
- data.tar.gz: fcbc90fb40bf5d4850462c098d2f6a286baf86cb161e5080bae5faed056ad92012cc50628db55c0f53b2d029f96d245f91aadac82419e570c8db0debbb9aea30
6
+ metadata.gz: aee2bce849d2059642ec85046b95a316c53c784dc33b94fdf5757675e871defae4524da2619ca435fca7d431fe73d40955b06eca4eb5df4bbb4dc2625ad246b2
7
+ data.tar.gz: 59f564d2d0b33b548491b74b675271dc06e7dbf284a5e292509c9d9f8284b5b859ed5fa743f30340ffa8e0d65009d833e192f137b458fa946b9c6c9182e94e05
data/.gitignore CHANGED
@@ -7,3 +7,4 @@
7
7
  /spec/reports/
8
8
  /tmp/
9
9
  /.env
10
+ /.env.backup
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- news_reader_cli (0.1.1)
4
+ news_reader_cli (0.1.2)
5
5
  dotenv
6
6
 
7
7
  GEM
@@ -27,4 +27,4 @@ DEPENDENCIES
27
27
  rake (~> 10.0)
28
28
 
29
29
  BUNDLED WITH
30
- 1.16.5
30
+ 1.17.3
data/README.md CHANGED
@@ -27,7 +27,7 @@ Before launch the command line, Go to https://newsapi.org/docs/get-started to re
27
27
  Type the below command and follow screen prompts
28
28
  $ news_reader_cli
29
29
 
30
- After message "please type in API Key from API News:" paste your API key received from API News. It is a hex string with 32 characters. The key will be saved on current computer, you won't be asked again for future logon.
30
+ After message "please type in API Key from API News:" paste your API key received from API News. It is a hex string with 32 characters. The key will be saved on current directory, you won't be asked again when you launch it as the same directory.
31
31
 
32
32
  Follow screen instructions to access News articles. Type Exit to end the program.
33
33
 
data/bin/news_reader_cli CHANGED
@@ -4,9 +4,8 @@ require_relative "../lib/news_reader_cli"
4
4
  # myapikey = open(File.expand_path(".newsapi.rb", "~/Development/m1/news_reader_cli")).read.strip
5
5
  # binding.pry
6
6
 
7
- NewsReaderCli::ApiKeyValidate.new.key_validate
7
+ # NewsReaderCli::ApiKeyValidate.new.key_validate
8
8
 
9
9
  # binding.pry
10
-
11
- Dotenv.load # defaul will looking for ('.env')
10
+ # Dotenv.load # defaul will looking for ('.env')
12
11
  NewsReaderCli::CLI.new.start
@@ -0,0 +1,30 @@
1
+ class NewsReaderCli::ApiKeyInputValidate
2
+
3
+ # def key_input_validate
4
+ # puts "please type in API Key from API News:"
5
+ #
6
+ # @key = gets.chomp.strip
7
+ #
8
+ # while !@key.match(/([0-9]|\w){32}/) do
9
+ #
10
+ # break if @key == "exit"
11
+ # # need to get out of the loop and remove the file .env
12
+ #
13
+ # puts <<-HEREDOC
14
+ #
15
+ # Your API keys value might missing digits or contain invalid Charactors.
16
+ # Please verify your API Key and try again. Thanks!
17
+ #
18
+ # HEREDOC
19
+ #
20
+ # @key = gets.chomp.strip
21
+ # end
22
+ #
23
+ # end #end of method
24
+ #
25
+ #
26
+ # def validated_key
27
+ # @key
28
+ # end
29
+
30
+ end #end of class
@@ -11,22 +11,24 @@ class NewsReaderCli::ApiKeyValidate
11
11
  # a condition verify key value is AES 128 Hex string 32 chars
12
12
 
13
13
  key = gets.chomp.strip
14
-
15
- while !key.match(/([0-9]|\w){32}/) do
16
-
17
- # break if key == "exit"
18
- # need to get out of the loop and remove the file .env
19
-
20
- puts <<-HEREDOC
21
-
22
- Your API keys value shows invalid.
23
- Please check verify your API Key and type in again.
24
-
25
- HEREDOC
26
-
27
- key = gets.chomp.strip
28
- end
29
-
14
+ #
15
+ # while !key.match(/([0-9]|\w){32}/) do
16
+ #
17
+ # break if key == "exit"
18
+ # # need to get out of the loop and remove the file .env
19
+ #
20
+ # puts <<-HEREDOC
21
+ #
22
+ # Your API keys value shows invalid.
23
+ # Please check verify your API Key and type in again.
24
+ #
25
+ # HEREDOC
26
+ #
27
+ # key = gets.chomp.strip
28
+ # end
29
+
30
+
31
+ #key = key_instance.validated_key
30
32
  key_file.puts("key = #{key}")
31
33
  key_file.close
32
34
 
@@ -3,6 +3,38 @@ class NewsReaderCli::CLI
3
3
 
4
4
  def start
5
5
 
6
+
7
+ # key_instance = NewsReaderCli::ApiKeyInputValidate.new
8
+ # key_instance.key_input_validate
9
+
10
+ NewsReaderCli::ApiKeyValidate.new.key_validate
11
+ Dotenv.load
12
+ #
13
+ # if !File.exist?(".env")
14
+ # key_file = File.new(".env", "w+")
15
+ # key = key_instance.validated_key
16
+ # key_file.puts("key = #{key}")
17
+ # key_file.close
18
+
19
+ # end
20
+
21
+ #compare input key with env variable
22
+ #if they are equal, keep going. if not change the value.
23
+
24
+ # if key_instance.validated_key != ENV['key']#.strip
25
+ # key = key_instance.validated_key
26
+ # key_file.puts("key = #{key}")
27
+ # key_file.close
28
+ #
29
+ # end
30
+
31
+ # assigned_api_key = ENV['key'].strip
32
+ #
33
+ # if assigned_api_key == 'exit'
34
+ # puts "Goodbye"
35
+ # return
36
+ # end
37
+
6
38
  NewsReaderCli::ApiService.newsapi
7
39
  puts "Welcome to the News Reader CLI!!!"
8
40
  menu
@@ -1,3 +1,3 @@
1
1
  module NewsReaderCli
2
- VERSION = "0.1.1"
2
+ VERSION = "0.1.2"
3
3
  end
@@ -5,6 +5,7 @@ require_relative "./news_reader_cli/version" #require "news_reader_cli/version"
5
5
  require_relative "./news_reader_cli/cli"
6
6
  require_relative "./news_reader_cli/api_service"
7
7
  require_relative "./news_reader_cli/article"
8
+ require_relative "./news_reader_cli/api_key_input_validate"
8
9
  require_relative "./news_reader_cli/api_key_validate"
9
10
 
10
11
  # Bundler.require(*Rails.groups)
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: news_reader_cli
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Henry
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-12-25 00:00:00.000000000 Z
11
+ date: 2019-01-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -101,6 +101,7 @@ files:
101
101
  - bin/news_reader_cli
102
102
  - bin/setup
103
103
  - lib/news_reader_cli.rb
104
+ - lib/news_reader_cli/api_key_input_validate.rb
104
105
  - lib/news_reader_cli/api_key_validate.rb
105
106
  - lib/news_reader_cli/api_service.rb
106
107
  - lib/news_reader_cli/article.rb