Class: SomTimer::ExerciseFacade
- Inherits:
-
Object
- Object
- SomTimer::ExerciseFacade
- Defined in:
- lib/som_timer/facades/exercise_facade.rb
Instance Attribute Summary collapse
-
#path ⇒ Object
readonly
Returns the value of attribute path.
Instance Method Summary collapse
- #exercises ⇒ Object
-
#initialize(path) ⇒ ExerciseFacade
constructor
A new instance of ExerciseFacade.
- #rand_exercise(duration, category) ⇒ Object
- #response_exercises ⇒ Object
- #response_rand_exercise(duration, category) ⇒ Object
Constructor Details
#initialize(path) ⇒ ExerciseFacade
Returns a new instance of ExerciseFacade.
4 5 6 7 |
# File 'lib/som_timer/facades/exercise_facade.rb', line 4 def initialize(path) @path = path @service = SomTimer::Service.new(@path) end |
Instance Attribute Details
#path ⇒ Object (readonly)
Returns the value of attribute path.
2 3 4 |
# File 'lib/som_timer/facades/exercise_facade.rb', line 2 def path @path end |
Instance Method Details
#exercises ⇒ Object
17 18 19 20 21 22 23 |
# File 'lib/som_timer/facades/exercise_facade.rb', line 17 def exercises exercises_info = response_exercises[:exercises] exercises_info.map do |exercise| SomTimer::Exercise.new(exercise) end end |
#rand_exercise(duration, category) ⇒ Object
25 26 27 |
# File 'lib/som_timer/facades/exercise_facade.rb', line 25 def rand_exercise(duration, category) SomTimer::Exercise.new(response_rand_exercise(duration, category)) end |
#response_exercises ⇒ Object
9 10 11 |
# File 'lib/som_timer/facades/exercise_facade.rb', line 9 def response_exercises @service.exercises end |
#response_rand_exercise(duration, category) ⇒ Object
13 14 15 |
# File 'lib/som_timer/facades/exercise_facade.rb', line 13 def response_rand_exercise(duration, category) @service.rand_exercise(duration, category) end |