jishan_fast_track_gem 0.1.18 → 0.1.19
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/bin/bundle +7 -1
- data/bin/console +1 -1
- data/bin/gemoji +1 -1
- data/bin/htmldiff +1 -1
- data/bin/jishan_solar_panel_rebate +1 -1
- data/bin/ldiff +1 -1
- data/bin/rake +1 -1
- data/bin/rspec +1 -1
- data/bin/setup +1 -1
- data/jishan_fast_track_gem.gemspec +3 -3
- data/lib/eligibility_check.rb +32 -26
- data/lib/files_check.rb +32 -29
- data/lib/jishan_fast_track_gem/version.rb +1 -1
- data/lib/jishan_fast_track_gem.rb +0 -16
- data/lib/manage_list.rb +5 -5
- data/lib/rebate_calculator.rb +17 -15
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 719889e8913d3465549af1c5fe4f7079007f3f5143ec28732cc475b18de30993
|
4
|
+
data.tar.gz: 02a9838473f1c1c039c34c00442e86c1182f1d975cb17817c40efbc35b062ee5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2ccda7a2fad014d44bbff42a9eb167b86ea1462a29c71ed1d3973bde390926de536062f656584e7f32dc95805b9d475e4bf2ff6c15290f204ec11daae5791fd4
|
7
|
+
data.tar.gz: ec7afcf54559b071fcc8d5d151aecc82dc1bea8c12fe31ec07d18fc8d0deded0148f034eb499bd5c2db83ec469567cdfb9f332fa61930616678fed0f704b49b5
|
data/bin/bundle
CHANGED
@@ -24,6 +24,7 @@ m = Module.new do
|
|
24
24
|
def cli_arg_version
|
25
25
|
return unless invoked_as_script? # don't want to hijack other binstubs
|
26
26
|
return unless "update".start_with?(ARGV.first || " ") # must be running `bundle update`
|
27
|
+
|
27
28
|
bundler_version = nil
|
28
29
|
update_index = nil
|
29
30
|
ARGV.each_with_index do |a, i|
|
@@ -31,6 +32,7 @@ m = Module.new do
|
|
31
32
|
bundler_version = a
|
32
33
|
end
|
33
34
|
next unless a =~ /\A--bundler(?:[= ](#{Gem::Version::VERSION_PATTERN}))?\z/
|
35
|
+
|
34
36
|
bundler_version = $1
|
35
37
|
update_index = i
|
36
38
|
end
|
@@ -55,15 +57,17 @@ m = Module.new do
|
|
55
57
|
|
56
58
|
def lockfile_version
|
57
59
|
return unless File.file?(lockfile)
|
60
|
+
|
58
61
|
lockfile_contents = File.read(lockfile)
|
59
62
|
return unless lockfile_contents =~ /\n\nBUNDLED WITH\n\s{2,}(#{Gem::Version::VERSION_PATTERN})\n/
|
63
|
+
|
60
64
|
Regexp.last_match(1)
|
61
65
|
end
|
62
66
|
|
63
67
|
def bundler_version
|
64
68
|
@bundler_version ||=
|
65
69
|
env_var_version || cli_arg_version ||
|
66
|
-
|
70
|
+
lockfile_version
|
67
71
|
end
|
68
72
|
|
69
73
|
def bundler_requirement
|
@@ -91,10 +95,12 @@ m = Module.new do
|
|
91
95
|
gem "bundler", bundler_requirement
|
92
96
|
end
|
93
97
|
return if gem_error.nil?
|
98
|
+
|
94
99
|
require_error = activation_error_handling do
|
95
100
|
require "bundler/version"
|
96
101
|
end
|
97
102
|
return if require_error.nil? && Gem::Requirement.new(bundler_requirement).satisfied_by?(Gem::Version.new(Bundler::VERSION))
|
103
|
+
|
98
104
|
warn "Activating bundler (#{bundler_requirement}) failed:\n#{gem_error.message}\n\nTo install the version of bundler this project requires, run `gem install bundler -v '#{bundler_requirement}'`"
|
99
105
|
exit 42
|
100
106
|
end
|
data/bin/console
CHANGED
data/bin/gemoji
CHANGED
data/bin/htmldiff
CHANGED
@@ -1,2 +1,2 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
|
-
require_relative '../lib/jishan_fast_track_gem'
|
2
|
+
require_relative '../lib/jishan_fast_track_gem'
|
data/bin/ldiff
CHANGED
data/bin/rake
CHANGED
data/bin/rspec
CHANGED
data/bin/setup
CHANGED
@@ -20,7 +20,7 @@ Gem::Specification.new do |spec|
|
|
20
20
|
|
21
21
|
# Specify which files should be added to the gem when it is released.
|
22
22
|
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
23
|
-
spec.files
|
23
|
+
spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
|
24
24
|
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
25
25
|
end
|
26
26
|
spec.bindir = "exe"
|
@@ -30,8 +30,8 @@ Gem::Specification.new do |spec|
|
|
30
30
|
spec.add_dependency 'colorize', '~> 0.8.1'
|
31
31
|
end
|
32
32
|
# use this the format above to add differet gen
|
33
|
-
#different datas of our gem
|
33
|
+
# different datas of our gem
|
34
34
|
|
35
|
-
#curl -u jishan https://rubygems.org/api/v1/api_key.yaml > ~/.gem/credentials; chmod 0600 ~/.gem/credentials
|
35
|
+
# curl -u jishan https://rubygems.org/api/v1/api_key.yaml > ~/.gem/credentials; chmod 0600 ~/.gem/credentials
|
36
36
|
|
37
37
|
# gem push pkg/jishan_fast_track_gem-0.1.0.gem
|
data/lib/eligibility_check.rb
CHANGED
@@ -3,33 +3,35 @@ require 'csv'
|
|
3
3
|
require 'colorize'
|
4
4
|
require 'gemoji'
|
5
5
|
|
6
|
-
|
7
6
|
class EligibilityCheck
|
8
7
|
def initialize(name)
|
9
8
|
@name = name
|
10
|
-
@answers =[]
|
9
|
+
@answers = []
|
11
10
|
end
|
12
11
|
|
13
12
|
def instruction
|
14
13
|
puts "Hello, this is a solar panel rebate eligibility check process, please follow the questions and them with a valid input 1 is yes and 2 is no. Simply type 1 or 2 will be sufficient. Although you respond with any other inputs, this program will guide you through the whole process. if you wish to leave the process type 3 as your response.".colorize(:blue)
|
15
|
-
puts "---"*20
|
14
|
+
puts "---" * 20
|
16
15
|
ower_of_the_property
|
17
16
|
end
|
18
17
|
|
19
18
|
private
|
19
|
+
|
20
20
|
def ower_of_the_property
|
21
21
|
puts "Are you the property owner and the current occupier?".colorize(:light_blue)
|
22
22
|
user_input_options
|
23
23
|
answer = gets.chomp.to_i
|
24
24
|
return ower_of_the_property unless answer_check(answer)
|
25
|
+
|
25
26
|
received_solar_rebate_before
|
26
27
|
end
|
27
|
-
|
28
|
+
|
28
29
|
def received_solar_rebate_before
|
29
30
|
puts "Is this your first apply for solar panel rebate?".colorize(:light_blue)
|
30
31
|
user_input_options
|
31
32
|
answer = gets.chomp.to_i
|
32
33
|
return received_solar_rebate_before unless answer_check(answer)
|
34
|
+
|
33
35
|
existed_solar_panel
|
34
36
|
end
|
35
37
|
|
@@ -39,6 +41,7 @@ class EligibilityCheck
|
|
39
41
|
|
40
42
|
answer = gets.chomp.to_i
|
41
43
|
return existed_solar_panel unless answer_check(answer)
|
44
|
+
|
42
45
|
combined_houshold_income
|
43
46
|
end
|
44
47
|
|
@@ -47,48 +50,51 @@ class EligibilityCheck
|
|
47
50
|
user_input_options
|
48
51
|
answer = gets.chomp.to_i
|
49
52
|
return combined_houshold_income unless answer_check(answer)
|
53
|
+
|
50
54
|
property_value
|
51
55
|
end
|
52
|
-
|
56
|
+
|
53
57
|
def property_value
|
54
58
|
puts "Is your property value less than $3 millions?" .colorize(:light_blue)
|
55
59
|
user_input_options
|
56
60
|
answer = gets.chomp.to_i
|
57
61
|
return property_value unless answer_check(answer)
|
62
|
+
|
58
63
|
eligibility_response
|
59
64
|
end
|
60
65
|
|
61
66
|
def eligibility_response
|
62
67
|
if @answers.size == 0
|
63
|
-
|
64
|
-
|
65
|
-
else
|
68
|
+
clap = Emoji.find_by_alias("clap").raw + " "
|
69
|
+
puts "Congrats! You are eligible for solar panel rebate #{clap * 3}".colorize(:red)
|
70
|
+
else
|
66
71
|
puts "Sorry, you are not eligible for solar panel rebate program."
|
67
72
|
end
|
68
73
|
end
|
69
74
|
|
70
75
|
def answer_check(answer)
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
76
|
+
while answer != 1 || answer != 2
|
77
|
+
if answer == 1
|
78
|
+
puts "Please read the next line #{Emoji.find_by_alias("point_right").raw}.".colorize(:light_yellow)
|
79
|
+
puts " "
|
80
|
+
return true
|
81
|
+
elsif answer == 2
|
82
|
+
puts "Please read the next line #{Emoji.find_by_alias("point_right").raw}.".colorize(:light_yellow)
|
83
|
+
puts " "
|
84
|
+
@answers << answer
|
85
|
+
return true
|
86
|
+
elsif answer == 3
|
87
|
+
exit
|
88
|
+
else
|
89
|
+
puts "It is no a valid input. Please type 1. yes or 2. no."
|
90
|
+
puts " "
|
91
|
+
return false
|
92
|
+
end
|
87
93
|
end
|
88
94
|
end
|
89
|
-
|
95
|
+
|
90
96
|
def user_input_options
|
91
97
|
puts "1. Yes 2. No ".colorize(:light_blue)
|
92
98
|
puts "if you wish to leave this eligibility check process, type 3".colorize(:green)
|
93
99
|
end
|
94
|
-
end
|
100
|
+
end
|
data/lib/files_check.rb
CHANGED
@@ -4,7 +4,7 @@ require "colorize"
|
|
4
4
|
require "table_print"
|
5
5
|
|
6
6
|
class FilesCheck
|
7
|
-
attr_reader :file_list
|
7
|
+
attr_reader :file_list
|
8
8
|
def initialize(name)
|
9
9
|
@name = name
|
10
10
|
@file_list = []
|
@@ -12,11 +12,12 @@ attr_reader :file_list
|
|
12
12
|
|
13
13
|
def instruction
|
14
14
|
puts "Hello, this is a files check process. It will check whether your URL is valid or not first. If it is valid, it will further check whether is a supported file type. The supported file types for this process are .pdf and .doc. Although you provide unsupported files or not valid file, it will ask you to provide the valid and supported file types document again. If you wish to leave the process, simply type 3 to respond.".colorize(:blue)
|
15
|
-
puts "--" *30
|
15
|
+
puts "--" * 30
|
16
16
|
income_proof
|
17
17
|
end
|
18
18
|
|
19
19
|
private
|
20
|
+
|
20
21
|
def income_proof
|
21
22
|
puts "provide the proof of income document URL (only .pdf or .doc): ".colorize(:light_blue)
|
22
23
|
leave_request
|
@@ -24,6 +25,7 @@ attr_reader :file_list
|
|
24
25
|
url = gets.chomp
|
25
26
|
return income_proof unless valid_file_check(url)
|
26
27
|
return income_proof unless file_type_check(url)
|
28
|
+
|
27
29
|
two_forms_of_identity
|
28
30
|
end
|
29
31
|
|
@@ -36,14 +38,13 @@ attr_reader :file_list
|
|
36
38
|
url = gets.chomp
|
37
39
|
return two_forms_of_identity unless valid_file_check(url)
|
38
40
|
return two_forms_of_identity unless file_type_check(url)
|
41
|
+
|
39
42
|
file_arr << url
|
40
43
|
break if file_arr.size == 2
|
41
44
|
end
|
42
45
|
retailer_quote
|
43
46
|
end
|
44
47
|
|
45
|
-
|
46
|
-
|
47
48
|
def retailer_quote
|
48
49
|
puts "Provide the eligible quote URL (only .pdf or .doc): ".colorize(:light_blue)
|
49
50
|
leave_request
|
@@ -52,6 +53,7 @@ attr_reader :file_list
|
|
52
53
|
file_type = File.extname(URI.parse(url).path)
|
53
54
|
return retail quote unless valid_file_check(url)
|
54
55
|
return retail quote unless file_type_check(url)
|
56
|
+
|
55
57
|
eligible_quote(url)
|
56
58
|
end
|
57
59
|
|
@@ -72,36 +74,37 @@ attr_reader :file_list
|
|
72
74
|
tp csv.map { |row| row.to_hash }, { :NAME => { display_name: "Company Name" } }, { :URL => { width: 35 } }
|
73
75
|
end
|
74
76
|
end
|
75
|
-
|
77
|
+
|
76
78
|
def valid_file_check(url)
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
79
|
+
loop do
|
80
|
+
if url =~ URI::regexp
|
81
|
+
puts "It's a valid URL."
|
82
|
+
return true
|
83
|
+
elsif url == "3"
|
84
|
+
exit
|
85
|
+
else
|
86
|
+
puts "It's not a valid file URL.".colorize(:light_yellow)
|
87
|
+
return false
|
88
|
+
end
|
89
|
+
break if url == "0" || url =~ URI::regexp
|
86
90
|
end
|
87
|
-
break if url == "0" || url =~ URI::regexp
|
88
|
-
end
|
89
91
|
end
|
92
|
+
|
90
93
|
def file_type_check(url)
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
94
|
+
loop do
|
95
|
+
file_type = File.extname(URI.parse(url).path)
|
96
|
+
if file_type == ".pdf" || file_type == ".doc"
|
97
|
+
puts "File upload succeeded.".colorize(:red)
|
98
|
+
puts " "
|
99
|
+
@file_list << url
|
100
|
+
return true
|
101
|
+
else
|
102
|
+
puts "Upload failed, please provide .pdf or .doc document.".colorize(:light_yellow)
|
103
|
+
puts " "
|
104
|
+
return false
|
105
|
+
end
|
106
|
+
break if file_type == ".pdf" || file_type == ".doc"
|
102
107
|
end
|
103
|
-
break if file_type == ".pdf" || file_type == ".doc"
|
104
|
-
end
|
105
108
|
end
|
106
109
|
|
107
110
|
def leave_request
|
@@ -8,8 +8,6 @@ john.instruction
|
|
8
8
|
john_files = FilesCheck.new("John Files")
|
9
9
|
john_files.instruction
|
10
10
|
|
11
|
-
|
12
|
-
|
13
11
|
list_zone_1 = ManageList.new("zone 1")
|
14
12
|
list_zone_2 = ManageList.new("zone 2")
|
15
13
|
|
@@ -27,17 +25,3 @@ p ManageList.display_processing_number
|
|
27
25
|
|
28
26
|
john_rebate = RebateCalculator.new
|
29
27
|
john_rebate.instruction
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
data/lib/manage_list.rb
CHANGED
@@ -1,11 +1,11 @@
|
|
1
|
-
|
2
1
|
class ManageList
|
3
|
-
attr_reader :list_detail
|
4
|
-
@@processing_number = 0
|
2
|
+
attr_reader :list_detail
|
3
|
+
@@processing_number = 0
|
5
4
|
def initialize(name)
|
6
5
|
@name = name
|
7
6
|
@list_detail = []
|
8
7
|
end
|
8
|
+
|
9
9
|
def self.display_processing_number
|
10
10
|
@@processing_number
|
11
11
|
end
|
@@ -14,9 +14,9 @@ attr_reader :list_detail
|
|
14
14
|
@list_detail << name
|
15
15
|
@@processing_number += 1
|
16
16
|
end
|
17
|
-
|
17
|
+
|
18
18
|
def remove_applicant(name)
|
19
19
|
@list_detail.delete(name)
|
20
20
|
@@processing_number -= 1
|
21
21
|
end
|
22
|
-
end
|
22
|
+
end
|
data/lib/rebate_calculator.rb
CHANGED
@@ -1,7 +1,6 @@
|
|
1
1
|
require 'csv'
|
2
2
|
require 'colorize'
|
3
3
|
|
4
|
-
|
5
4
|
class RebateCalculator
|
6
5
|
def initialize
|
7
6
|
@postcode = 0
|
@@ -17,34 +16,37 @@ class RebateCalculator
|
|
17
16
|
end
|
18
17
|
|
19
18
|
private
|
19
|
+
|
20
20
|
def ask_parameters
|
21
21
|
loop do
|
22
|
-
|
22
|
+
puts "what is your postcode?"
|
23
23
|
postcode = gets.chomp.to_i
|
24
24
|
if postcode > 9999
|
25
|
-
|
25
|
+
puts "It's not a valid postcode, please type a valid postcode.".colorize(:light_yellow)
|
26
26
|
end
|
27
|
-
|
27
|
+
@postcode = postcode
|
28
28
|
if postcode < 9999
|
29
29
|
break
|
30
30
|
end
|
31
31
|
end
|
32
|
-
|
32
|
+
|
33
33
|
puts "How many kilowatt is your future solar panel?"
|
34
|
-
|
35
|
-
|
34
|
+
kw = gets.chomp.to_i
|
35
|
+
@kw = kw
|
36
36
|
puts "What is the lifetime of your future solar panel?"
|
37
|
-
|
38
|
-
|
37
|
+
deeming_year = gets.chomp.to_i
|
38
|
+
@deeming_year = deeming_year
|
39
39
|
stc_postcode_rating
|
40
40
|
end
|
41
|
+
|
41
42
|
private
|
43
|
+
|
42
44
|
def stc_postcode_rating
|
43
45
|
csv_text = File.read(__dir__ + '/stc_rating.csv')
|
44
46
|
csv = CSV.parse(csv_text, headers: true)
|
45
47
|
result = csv.find do |num|
|
46
|
-
|
47
|
-
|
48
|
+
stc_table = num.to_hash
|
49
|
+
@postcode >= stc_table['Postcode from'].to_i && @postcode <= stc_table['Postcode to'].to_i
|
48
50
|
end
|
49
51
|
@stc_rating = result['Rating'].to_f
|
50
52
|
stc_calculator
|
@@ -56,13 +58,13 @@ class RebateCalculator
|
|
56
58
|
end
|
57
59
|
|
58
60
|
def rebate
|
59
|
-
|
60
|
-
|
61
|
-
if rebate_amount > 1888
|
61
|
+
stc_value = 37.5
|
62
|
+
rebate_amount = @stc * stc_value
|
63
|
+
if rebate_amount > 1888
|
62
64
|
puts "Total amount of your solar panel rebate has reach the maximum, which is $1888 aud.".colorize(:red)
|
63
65
|
else
|
64
66
|
puts "Total amount of your solar panel rebate is $#{rebate_amount} aud".colorize(:red)
|
65
67
|
end
|
66
68
|
rebate_amount
|
67
69
|
end
|
68
|
-
end
|
70
|
+
end
|