RouteVendor 1.0.0

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.
Files changed (3) hide show
  1. checksums.yaml +7 -0
  2. data/lib/RouteVendor.rb +90 -0
  3. metadata +42 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: b098d5f4d4405ebecc0ca0bc2df286512d092c3e9df07f64cc4c9726c3b78c70
4
+ data.tar.gz: 95325aa1d4382e110f074623b79940676a743078933cd2ed62b81e90d7db9bf0
5
+ SHA512:
6
+ metadata.gz: a6804dd9b5ff358854ca9e5b82e7e45a27cf30b0ab993c36f5560dfe858ed9b47eb4f3f9018b9bd6782653571a02eec7230a081ab7f577016118642b457392f1
7
+ data.tar.gz: 380b3594f5bc291b499f8ff0a133430153b5a2d0e6823df11025f92d6d65f60e5094a4ba185770e8bd31f4a689d2f0eaa451253ac0c00cb6b1e9c4f264f47622
@@ -0,0 +1,90 @@
1
+ module RouteVendor
2
+
3
+ def self.assign(ratesArray,plan,insurance)
4
+ @commonArray = []
5
+ @count1 = 0
6
+ @count2 = 0
7
+ @count3 = 0
8
+
9
+ @ratesArray = ratesArray
10
+ @temp = []
11
+
12
+ puts "PLAN====>#{plan}"
13
+ if plan == "basic"
14
+ # plan = basic and non zero ---------------------
15
+ @ratesArray.each do |rate|
16
+ puts "RATES====>#{rate.basic}"
17
+ if rate.basic != 0
18
+ @commonArray[@count1] = rate
19
+ puts "HELLO1===> #{@commonArray}"
20
+ @count1 = @count1+1
21
+ end
22
+ end
23
+
24
+ # plan = basic check for minimum
25
+ @temp = @commonArray[0]
26
+ puts "sjdhsj #{@temp}"
27
+ @commonArray.each do |basic|
28
+ puts "kjksdj=========> #{basic.basic}"
29
+ if basic.basic <= @temp.basic
30
+ puts "VALUES1 ====>>>>> #{premium}"
31
+ @temp = basic
32
+ end
33
+ end
34
+ end
35
+
36
+ if plan == "advance"
37
+ # plan = advance and non zero -------------------
38
+ @ratesArray.each do |rate|
39
+ if rate.advance != 0
40
+ @commonArray[@count1] = rate
41
+ puts "HELLO2===> #{@commonArray}"
42
+ @count1 = @count1+1
43
+ end
44
+ end
45
+
46
+ # plan = basic check for minimum
47
+ @temp = @commonArray[0]
48
+ @commonArray.each do |advance|
49
+ if advance.advance <= @temp.advance
50
+ puts "VALUES2 ====>>>>> #{advance}"
51
+ @temp = advance
52
+
53
+ end
54
+ end
55
+ end
56
+
57
+ # plan = premium and non zero --------------------
58
+ if plan == "premium"
59
+ @ratesArray.each do |rate|
60
+ if rate.premium != 0
61
+ @commonArray[@count1] = rate
62
+ puts "HELLO3===> #{@commonArray}"
63
+ @count1 = @count1+1
64
+ end
65
+ end
66
+
67
+ # plan = premium check for minimum
68
+ @temp = @commonArray[0]
69
+ @commonArray.each do |premium|
70
+ if premium.premium <= @temp.premium
71
+ puts "VALUES3 ====>>>>> #{premium}"
72
+ @temp = premium
73
+ end
74
+ end
75
+ end
76
+
77
+ # puts "INSURANCE ====>>>> #{@temp.insurance}"
78
+ # find minimum insurance
79
+ # @temp1 = @temp
80
+ # @temp.each do |insurance|
81
+ # if insurance.insurance <= @temp1.insurance
82
+ # @temp1[@count3] = @temp
83
+ # @count3=@count3+1
84
+ # end
85
+ # end
86
+
87
+ return @temp.vendor_id
88
+
89
+ end
90
+ end
metadata ADDED
@@ -0,0 +1,42 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: RouteVendor
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.0
5
+ platform: ruby
6
+ authors:
7
+ - Prashant Agavane
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2019-12-09 00:00:00.000000000 Z
12
+ dependencies: []
13
+ description: Route Vendor Description
14
+ email: x18165435@student.ncirl.ie
15
+ executables: []
16
+ extensions: []
17
+ extra_rdoc_files: []
18
+ files:
19
+ - lib/RouteVendor.rb
20
+ homepage: http://rubygems.org/gems/RouteVendor
21
+ licenses: []
22
+ metadata: {}
23
+ post_install_message:
24
+ rdoc_options: []
25
+ require_paths:
26
+ - lib
27
+ required_ruby_version: !ruby/object:Gem::Requirement
28
+ requirements:
29
+ - - ">="
30
+ - !ruby/object:Gem::Version
31
+ version: '0'
32
+ required_rubygems_version: !ruby/object:Gem::Requirement
33
+ requirements:
34
+ - - ">="
35
+ - !ruby/object:Gem::Version
36
+ version: '0'
37
+ requirements: []
38
+ rubygems_version: 3.0.3
39
+ signing_key:
40
+ specification_version: 4
41
+ summary: Route Vendor
42
+ test_files: []