Class: SomTimer::RestFacade

Inherits:
Object
  • Object
show all
Defined in:
lib/som_timer/facades/rest_facade.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(path) ⇒ RestFacade

Returns a new instance of RestFacade.



4
5
6
7
# File 'lib/som_timer/facades/rest_facade.rb', line 4

def initialize(path)
  @path = path
  @service = SomTimer::Service.new(@path)
end

Instance Attribute Details

#pathObject (readonly)

Returns the value of attribute path.



2
3
4
# File 'lib/som_timer/facades/rest_facade.rb', line 2

def path
  @path
end

Instance Method Details

#create_rest(mood_rating_1, mood_rating_2, content_selected, focus_interval, rest_interval) ⇒ Object



25
26
27
# File 'lib/som_timer/facades/rest_facade.rb', line 25

def create_rest(mood_rating_1, mood_rating_2, content_selected, focus_interval, rest_interval)
  SomTimer::Rest.new(response_create_rest(mood_rating_1, mood_rating_2, content_selected, focus_interval, rest_interval))
end

#response_create_rest(mood_rating_1, mood_rating_2, content_selected, focus_interval, rest_interval) ⇒ Object



13
14
15
# File 'lib/som_timer/facades/rest_facade.rb', line 13

def response_create_rest(mood_rating_1, mood_rating_2, content_selected, focus_interval, rest_interval)
  @service.create_rest(mood_rating_1, mood_rating_2, content_selected, focus_interval, rest_interval)
end

#response_restsObject



9
10
11
# File 'lib/som_timer/facades/rest_facade.rb', line 9

def response_rests
  @service.rests
end

#restsObject



17
18
19
20
21
22
23
# File 'lib/som_timer/facades/rest_facade.rb', line 17

def rests
  rests_info = response_rests[:rests]

  rests_info.map do |rest|
    SomTimer::Rest.new(rest)
  end
end