Class: Maker::Server

Inherits:
Object
  • Object
show all
Defined in:
lib/maker/server.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#emailObject (readonly)

Returns the value of attribute email.



5
6
7
# File 'lib/maker/server.rb', line 5

def email
  @email
end

Instance Method Details

#fieldsObject



24
25
26
# File 'lib/maker/server.rb', line 24

def fields
  student[student_id] || {}
end

#firebaseObject



15
16
17
# File 'lib/maker/server.rb', line 15

def firebase
  @firebase ||= Firebase::Client.new('https://resplendent-fire-7855.firebaseio.com')
end

#next_stageObject



19
20
21
22
# File 'lib/maker/server.rb', line 19

def next_stage
  fields['stage'] += 1
  firebase.set("students/#{student_id}", fields)
end

#studentObject



11
12
13
# File 'lib/maker/server.rb', line 11

def student
  @student ||= load_student
end