Class: Omega::User
Instance Attribute Summary
Attributes inherited from Base
#data
Instance Method Summary
collapse
Methods inherited from Base
#initialize
Constructor Details
This class inherits a constructor from Omega::Base
Instance Method Details
#full_data ⇒ Object
7
8
9
10
11
12
13
|
# File 'lib/omega/user.rb', line 7
def full_data
{
data: @data,
problems_solved: problems_solved,
resume: report
}
end
|
#problems_solved ⇒ Object
15
16
17
|
# File 'lib/omega/user.rb', line 15
def problems_solved
@client.problems_solved(data[:username])[:problems]
end
|
#report ⇒ Object
19
20
21
22
23
24
25
26
|
# File 'lib/omega/user.rb', line 19
def report
data = { score: 0, count: 0 }
problems_solved.each do |p|
data[:score] += p[:difficulty] || 0
data[:count] += 1
end
data
end
|