Class: Maker::Server
- Inherits:
-
Object
- Object
- Maker::Server
- Defined in:
- lib/maker/server.rb
Instance Attribute Summary collapse
-
#email ⇒ Object
readonly
Returns the value of attribute email.
Instance Method Summary collapse
- #fields ⇒ Object
- #firebase ⇒ Object
-
#initialize(email) ⇒ Server
constructor
A new instance of Server.
- #next_stage ⇒ Object
- #student ⇒ Object
Constructor Details
#initialize(email) ⇒ Server
Returns a new instance of Server.
7 8 9 |
# File 'lib/maker/server.rb', line 7 def initialize(email) @email = email end |
Instance Attribute Details
#email ⇒ Object (readonly)
Returns the value of attribute email.
5 6 7 |
# File 'lib/maker/server.rb', line 5 def email @email end |
Instance Method Details
#fields ⇒ Object
24 25 26 |
# File 'lib/maker/server.rb', line 24 def fields student[student_id] || {} end |
#firebase ⇒ Object
15 16 17 |
# File 'lib/maker/server.rb', line 15 def firebase @firebase ||= Firebase::Client.new('https://resplendent-fire-7855.firebaseio.com') end |
#next_stage ⇒ Object
19 20 21 22 |
# File 'lib/maker/server.rb', line 19 def next_stage fields['stage'] += 1 firebase.set("students/#{student_id}", fields) end |
#student ⇒ Object
11 12 13 |
# File 'lib/maker/server.rb', line 11 def student @student ||= load_student end |