BookMD 0.1.6 → 0.1.7

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: 99159b01606d9c413640cf1823237697feb9c9e6c24f3d1d2d8aab0cfaacea7d
4
- data.tar.gz: 5a4fe87801bce9f37eef8c4a9802e71e0f8d36651907fb2dbeec1aa37107a157
3
+ metadata.gz: 3a3345e64379c52fff5c89d0c8d564a0d408634ddedf6076b4a942499b24b4d4
4
+ data.tar.gz: 3748d909877e9600ff31324a77cca3153805d6ea48b9768d3d29eaa794055fec
5
5
  SHA512:
6
- metadata.gz: b570050921157953781cf2f0148f28f226a18a61f7c56a71fa31891187cf52631d1150c7026414364f43175972257599bb38bb4c94e0554181a5dc3f85050b38
7
- data.tar.gz: c189e83e0dbf159225d84ef006e6922e84d4a316b1b1a44b764bdbaab86eb08ac877a1a39f4c5fdb936d2ffc8638b2fb86caca2b5dfc0e64da2287ef0b4bbd7c
6
+ metadata.gz: cd4c77d4d350cb425fe4889abe7c2e56b6975d5d7cf9f8e5b1f85eff0a7b5bcea2434e72d1f91f2b5aba831ce8b3d0b731f871e2344e1e31ed64edd95f3ac934
7
+ data.tar.gz: e68af0aae6f44a93bc14af33d8ebe2a5437d6964428918ae3dac0e4f39c805c1ff57d1cc79abf15e039b97d838c3669837bb0e75c48ef2df355f03e90036502b
data/BookMD-0.1.6.gem ADDED
Binary file
@@ -1,3 +1,3 @@
1
1
  module BookMD
2
- VERSION = "0.1.6"
2
+ VERSION = "0.1.7"
3
3
  end
data/lib/BookMD.rb CHANGED
@@ -4,4 +4,4 @@ require_relative "user.rb"
4
4
  require 'tty-prompt'
5
5
  require 'colorize'
6
6
  require 'fileutils'
7
- start
7
+ start
data/lib/appointments.txt CHANGED
@@ -1,4 +0,0 @@
1
- Dr: Dr. Gregor
2
- Day: Monday
3
- Time: ["\"8.30\""]
4
-
data/lib/bookMD2.rb CHANGED
@@ -5,97 +5,97 @@ require 'tty-reader'
5
5
  require 'tty-table'
6
6
  require 'tty-box'
7
7
  require 'colorize'
8
+
8
9
  prompt = TTY::Prompt.new
9
10
 
10
11
  def drs_info
11
- box = TTY::Box.frame(width: 60, height: 20, align: :left) do
12
+ box = TTY::Box.frame(width: 60, height: 20, align: :left) do
12
13
  "Our team of doctors offer a comprehensive general practice. All have been practicing for over a decade in our community.
13
14
  \nALL DOCTORS OFFER BULK BILLING. \nALL GPS ARE ABLE TO ASSIST WITH WORKCOVER AND TAC CONSULTATIONS.\n \nDr Gregor specialises and has a background in nutrition.\n \nDr. Helen Kouzmin specialises in neurology is a member of the royal australasian collage of physicians.\n \nDr Sade Weatley specialises in womens health and has 6 years of experience in delveries and birth related surgeries at Box Hill public hospital.\n \nPatrick Chan specialises in the treatment and management of chronic pain disorders"
14
- end
15
- drs = TTY::Table.new header: ['Dr. Gregor ','Dr. Helen Kouzmin','Dr Kooray','Dr. Sade Weatley','Dr. Patrick Chan'], rows: [['Monday 8.30, 2.00', 'Monday','-----','-----','Monday',], ['Tuesday', 'Tuesday','Tuesday','Tuesday','Tuesday'], ['Wednesday', 'Wednesday','Wednesday','-----','Wednesday'],['Thursday', 'Thursday','Thursday','-----','Thursday'],['Friday', 'Friday','Friday','Friday','Friday']]
16
- # drs.render(:ascii)
15
+ end
17
16
 
17
+ drs = TTY::Table.new header: ['Dr. Gregor ','Dr. Helen Kouzmin','Dr Kooray','Dr. Sade Weatley','Dr. Patrick Chan'], rows: [['Monday 8.30, 2.00', 'Monday','-----','-----','Monday',], ['Tuesday', 'Tuesday','Tuesday','Tuesday','Tuesday'], ['Wednesday', 'Wednesday','Wednesday','-----','Wednesday'],['Thursday', 'Thursday','Thursday','-----','Thursday'],['Friday', 'Friday','Friday','Friday','Friday']]
18
18
  puts box.colorize(:color => :black, :background => :white)
19
- puts drs.render(:ascii).colorize(:color => :black, :background => :white)
19
+ puts drs.render(:ascii).colorize(:color => :black, :background => :white)
20
20
 
21
21
  end
22
22
 
23
-
24
23
  def day_select
25
- prompt = TTY::Prompt.new
26
- day_choice = prompt.select("Select Appointment Day") do |menu|
27
- menu.choice 'Monday', 'Monday'
28
- menu.choice 'Tuesday', 'Tuesday', disabled: '(no availabilities)'
29
- menu.choice 'Wednesday', 'Wednesday', disabled: '(no availabilities)'
30
- menu.choice 'Thursday', 'Thursday', disabled: '(no availabilities)'
31
- menu.choice 'Friday', 'Friday', disabled: '(no availabilities)'
32
- end
33
- return day_choice
24
+ prompt = TTY::Prompt.new
25
+ day_choice = prompt.select("Select Appointment Day") do |menu|
26
+ menu.choice 'Monday', 'Monday'
27
+ menu.choice 'Tuesday', 'Tuesday', disabled: '(no availabilities)'
28
+ menu.choice 'Wednesday', 'Wednesday', disabled: '(no availabilities)'
29
+ menu.choice 'Thursday', 'Thursday', disabled: '(no availabilities)'
30
+ menu.choice 'Friday', 'Friday', disabled: '(no availabilities)'
31
+ end
32
+ return day_choice
34
33
  end
35
34
 
36
-
37
-
38
35
  def mon_time_selection
39
- prompt = TTY::Prompt.new
40
- choices = %w("8.30" "2.00")
41
- time_choice = prompt.multi_select("Select time", choices)
42
- return time_choice
36
+ prompt = TTY::Prompt.new
37
+ choices = %w("8.30" "2.00")
38
+ time_choice = prompt.multi_select("Select time", choices)
39
+ return time_choice
43
40
  end
44
41
 
42
+ def dr_selection
43
+ prompt = TTY::Prompt.new
44
+ dr = prompt.select("Select Dr") do |menu|
45
+ menu.choice 'Dr Gregor', 'Dr. Gregor'
46
+ menu.choice 'Dr. Helen', 'Dr. Helen', disabled: '(no consultations available)'
47
+ menu.choice 'Dr. Kooray', 'Dr. Kooray', disabled: '(no consultations available'
48
+ menu.choice 'Dr. Weatley', 'Dr. Weatley', disabled: '(no consultations available)'
49
+ menu.choice 'Dr. Chan', 'Dr. Chan', disabled: '(no consultations available)'
50
+ end
51
+ return dr
52
+ end
45
53
 
46
- def dr_selection
47
- prompt = TTY::Prompt.new
48
- dr = prompt.select("Select Dr") do |menu|
49
- menu.choice 'Dr Gregor', 'Dr. Gregor'
50
- menu.choice 'Dr. Helen', 'Dr. Helen', disabled: '(no consultations available)'
51
- menu.choice 'Dr. Kooray', 'Dr. Kooray', disabled: '(no consultations available)'
52
- menu.choice 'Dr. Weatley', 'Dr. Weatley', disabled: '(no consultations available)'
53
- menu.choice 'Dr. Chan', 'Dr. Chan', disabled: '(no consultations available)'
54
- end
55
- return dr
56
- end
57
- def start
58
- system("clear")
59
- start_title = TTY::Box.frame(width: 50, height: 21, align: :left) do
60
- "Welcome to BOOKMD\n" "\nTo view dr availability and book an appointment and type 1 and press ENTER. \n \nTo manage and view your appointmrnts type 2 and press ENTER. \n \nTo make an appointment over the phone please call our rooms on 12345893.\n \nIF YOU ARE EXPERIENCING A MEDICAL EMERGENCY DIAL 000.\n \nIF YOU ARE EXPERIENCING FLU LIKE SYMPTOMS: HEADACHE, FEVER, ACHING, COUGHING, RESPATORY ISSUES MUST CALL THE PRACTICE PRIOR TO ATTENDING.\n \nMORE INFORMATION IS AVAILABLE AT THE COVID19 HOTLINE "
61
- end
62
- puts start_title.colorize(:color => :black, :background => :white)
54
+ def start
55
+ system("clear")
56
+ start_title = TTY::Box.frame(width: 50, height: 21, align: :left) do
57
+ "Welcome to BOOKMD\n" "\n \nTo view dr availability and book an appointment type 1 and press ENTER. \n \nTo view your appointments type 2 and press ENTER. \n \nTo delete your appointment press 3 and press ENTER.\n \nTo make an appointment over the phone please call our rooms on 12345893.\n \nIF YOU ARE EXPERIENCING A MEDICAL EMERGENCY DIAL 000.\n \nIF YOU ARE EXPERIENCING FLU LIKE SYMPTOMS: HEADACHE, FEVER, ACHING, COUGHING, MUST CALL THE PRACTICE PRIOR TO ATTENDING.\n \nMORE INFORMATION IS AVAILABLE AT THE COVID19 HOTLINE "
58
+ end
59
+
60
+ puts start_title.colorize(:color => :black, :background => :white)
61
+ puts "AFTER PERFORMING EACH FUNCTION BOOKMD WILL RETURN YOU TO THIS MENU IN 10secs"
62
+ puts "1. BOOK APPOINTMENT".colorize(:yellow)
63
+ puts "2. VIEW YOUR APPOINTMENTS".colorize(:yellow)
64
+ puts "3. DELETE APPOINTMENT".colorize(:yellow)
65
+ puts " > ".colorize(:yellow)
66
+ selection = gets.chomp
67
+
68
+ case
69
+ when selection == "1"
70
+ system("clear")
71
+ drs_info
72
+ new_appointment
73
+ printer
74
+ appointment_printer
75
+ appointment_message
76
+ sleep(10)
77
+ start
78
+ when selection == "2"
79
+ system("clear")
80
+ appointment_printer
81
+ appointment_message
82
+ sleep(10)
83
+ start
84
+ when selection == "3"
85
+ system("clear")
86
+ delete_appointment
87
+ puts "your appointment was deleted returning home in 10 seconds"
88
+ sleep(10)
89
+ start
90
+ end
91
+ end
63
92
 
64
- puts "1. BOOK APPOINTMENT".colorize(:yellow)
65
- puts "2. VIEW YOUR APPOINTMENTS".colorize(:yellow)
66
- puts "3. DELETE APPOINTMENT".colorize(:yellow)
67
- puts " > ".colorize(:yellow)
68
-
69
- selection = gets.chomp
70
- case
71
- when selection == "1"
72
- system("clear")
73
- drs_info
74
- new_appointment
75
- printer
76
- appointment_printer
77
- appointment_message
78
- sleep(10)
79
- start
80
- when selection == "2"
81
- system("clear")
82
- appointment_printer
83
- appointment_message
84
- sleep(10)
85
- start
86
- when selection == "3"
87
- system("clear")
88
- delete_appointment
89
- puts "your appointment was deleted returning home in 10 seconds"
90
- sleep(10)
91
- start
92
- end
93
- end
94
93
  def appointment_message
95
- confirm = TTY::Box.frame(width: 30, height: 10, align: :left) do
96
- "IF YOU NEED TO CANCEL YOUR APPOINTMENT ON THE SAME DAY OF YOUR APPOINTMENT PLEASE CALL THE ROOMS TO DO SO".colorize(:color => :black, :background =>:white)
97
- end
98
- puts confirm
94
+ confirm = TTY::Box.frame(width: 30, height: 10, align: :left) do
95
+ "IF YOU NEED TO CANCEL YOUR APPOINTMENT ON THE SAME DAY OF YOUR APPOINTMENT PLEASE CALL THE ROOMS TO DO SO".colorize(:color => :black, :background =>:white)
96
+ end
97
+
98
+ puts confirm
99
99
 
100
100
  end
101
101
 
data/lib/patients.txt CHANGED
@@ -294,3 +294,9 @@ n
294
294
 
295
295
  {:Name=>"ds", :Phone=>"d", :Email=>"d", :Travel=>"n"}
296
296
 
297
+ {:Name=>"GORGA", :Phone=>"GORGA", :Email=>"GORGA", :Travel=>"n"}
298
+
299
+ {:Name=>"HI", :Phone=>"HI", :Email=>"HI", :Travel=>"N"}
300
+
301
+ {:Name=>"HI", :Phone=>"HI", :Email=>"HI", :Travel=>"N"}
302
+
data/lib/test.rb ADDED
@@ -0,0 +1,24 @@
1
+ require "rspec/autorun"
2
+
3
+
4
+
5
+ describe Appointment_printer do
6
+ it "reads txt file and writes it in terminal display" do
7
+ puts("\n\n")
8
+ puts "These are your upcoming appointments:\n"
9
+ File.open("appointments.txt").each do |line|
10
+ puts line
11
+ end
12
+
13
+ expect(appointment.txt = not nil
14
+
15
+
16
+
17
+
18
+ def appointment_printer
19
+ puts("\n\n")
20
+ puts "These are your upcoming appointments:\n"
21
+ File.open("appointments.txt").each do |line|
22
+ puts line
23
+ end
24
+ end
data/lib/user.rb CHANGED
@@ -9,12 +9,13 @@ class Patient
9
9
  end
10
10
  self
11
11
  end
12
- def make_patient #this method makes a patient from user input in terminal
12
+
13
+ def make_patient
13
14
  new_patient = Patient.new(:name, :phone, :email, :travel)
14
- patients = {}
15
- patients.store(:new_patient,())
16
- print "Please answer each prompt and press ENTER\n".colorize(:yellow)
17
- print "Name: "
15
+ patients = {}
16
+ patients.store(:new_patient,())
17
+ print "Please answer each prompt and press ENTER\n".colorize(:yellow)
18
+ print "Name: "
18
19
  @name = gets.chomp
19
20
  print "Phone: "
20
21
  @phone = gets.chomp
@@ -27,45 +28,47 @@ print "Name: "
27
28
  'Phone': @phone,
28
29
  'Email': @email,
29
30
  'Travel': @travel
30
- }
31
+ }
31
32
  end
33
+
32
34
  def printer
33
- separator = ' '
34
- File.open("patients.txt","a+") do |f| #append flag
35
+ separator = ' '
36
+ File.open("patients.txt","a+") do |f|
35
37
  f.puts(make_patient)
36
38
  f.puts(separator)
37
- # puts patients
39
+ end
38
40
  end
39
- end
41
+
40
42
  class Appointments
41
43
  attr_accessor :dr, :day_choice, :time_choice
42
44
  def initialize(dr, day_choice, time_choice)
43
- @dr #= dr_selection
44
- @day_choice #= day_select
45
- @time_choice #= mon_time_selection
46
- end
47
- self
45
+ @dr
46
+ @day_choice
47
+ @time_choice
48
+ end
49
+ self
48
50
  end
51
+
49
52
  def new_appointment
50
- the_appointment = Appointments.new(:dr, :day_choice, :time_choice)
51
- appointments = {}
52
- appointments.store(:the_appointment,())
53
- @dr = dr_selection
54
- @day_choice = day_select
55
- @time_choice = mon_time_selection
53
+ the_appointment = Appointments.new(:dr, :day_choice, :time_choice)
54
+ appointments = {}
55
+ appointments.store(:the_appointment,())
56
+ @dr = dr_selection
57
+ @day_choice = day_select
58
+ @time_choice = mon_time_selection
56
59
 
57
- new_appointment = {
58
- dr: @dr,
59
- day_choice: @day_choice,
60
- time_choice: @time_choice,
61
- }
60
+ new_appointment = {
61
+ dr: @dr,
62
+ day_choice: @day_choice,
63
+ time_choice: @time_choice,
64
+ }
62
65
 
63
- File.open("appointments.txt","a+") do |f| #flag
64
- f.puts("Dr: #{new_appointment[:dr]}")
65
- f.puts("Day: #{new_appointment[:day_choice]}")
66
- f.puts("Time: #{new_appointment[:time_choice]}")
67
- f.puts("\n")
68
- end
66
+ File.open("appointments.txt","a+") do |f|
67
+ f.puts("Dr: #{new_appointment[:dr]}")
68
+ f.puts("Day: #{new_appointment[:day_choice]}")
69
+ f.puts("Time: #{new_appointment[:time_choice]}")
70
+ f.puts("\n")
71
+ end
69
72
  end
70
73
 
71
74
  def appointment_printer
@@ -84,5 +87,4 @@ def delete_appointment
84
87
  File.close
85
88
  end
86
89
  end
87
- # FileUtils.mv()
88
90
  end
data/test.rb ADDED
@@ -0,0 +1,19 @@
1
+ require rspec/autorun
2
+
3
+ class Appointments
4
+ def initialize(time_choice)
5
+ "Dr Gregor"
6
+ end
7
+ end
8
+
9
+ describe Appointments do
10
+ it "manages user choices" do
11
+ choice = Appointments.new
12
+
13
+ expect(choice.equals("Dr Gregor")).to eq("Dr Gregor")
14
+ end
15
+
16
+ it "passes user choice" do
17
+ string = Appointments.new
18
+ end
19
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: BookMD
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.6
4
+ version: 0.1.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - GorginZ
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-03-21 00:00:00.000000000 Z
11
+ date: 2020-03-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: tty-prompt
@@ -125,6 +125,7 @@ files:
125
125
  - BookMD-0.1.3.gem
126
126
  - BookMD-0.1.4.gem
127
127
  - BookMD-0.1.5.gem
128
+ - BookMD-0.1.6.gem
128
129
  - BookMD.gemspec
129
130
  - CODE_OF_CONDUCT.md
130
131
  - Gemfile
@@ -144,8 +145,10 @@ files:
144
145
  - lib/appointments.txt
145
146
  - lib/bookMD2.rb
146
147
  - lib/patients.txt
148
+ - lib/test.rb
147
149
  - lib/user.rb
148
150
  - patients.txt
151
+ - test.rb
149
152
  homepage: https://github.com/GorginZ/BookMD/tree/master/lib
150
153
  licenses:
151
154
  - MIT