som-timer 0.0.1 → 0.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 26378a82ead55dae01edf0e85ed33d5804efbfb055592a187ddd5630bde905d4
4
- data.tar.gz: e9cb01b178e6c88eeaac2bc6b5f76cc48f1bf1daf8d4de980572e4d99921afb2
3
+ metadata.gz: fba04d660865cbe1ad1cc2e4beecff34dc2d02db91c7772df77344ab78b79a3b
4
+ data.tar.gz: 9d2f76f99181a7314f3079b5df431653ed3d970644fa42f554bf67970d605e6a
5
5
  SHA512:
6
- metadata.gz: bea0d3fe95f5e4e55d87402b8893b7a529ad8e11615c0419e6cd5af3332fb13d6dbd8c15c28a6d96612c805826b8b74499292bac9b1d613eca5c5dcbfd0ed7e0
7
- data.tar.gz: 480392abaff55b01197e9c39035b3500320826a851083f170e433f9559f5b16463baeff540c3ead75d82e3f406089aad71bc9077ecd26980007adcb51e280bdc
6
+ metadata.gz: 97867c4c4a1ed4a7ee60a9085abc14e45a61ed904050e33c412b736ea8d001a06b42b92c837480a53fdd0fb281cd1ad1b2200312584714e9b36fbe591fecebf6
7
+ data.tar.gz: 102bd6251dfaef0f8c695be8991601c7b511bbe185c15871ae2da13c790d2726c5fbe36092580436b62d4f62d255e41df1a37973140ac63150cb4a8222d59c25
@@ -10,34 +10,34 @@ class SomTimer
10
10
  end
11
11
 
12
12
  def self.update_timer(work_interval, rest_interval, sound, path = "timers/1")
13
- service = Service.new(path)
14
- service.update_timer(work_interval, rest_interval, sound)
13
+ TimerFacade.new(path).update_timer(work_interval, rest_interval, sound)
15
14
  end
16
15
 
17
16
  def self.one_timer(path = "timers/1")
18
- service = Service.new(path)
19
- service.timer
17
+ TimerFacade.new(path).one_timer
20
18
  end
21
19
 
22
20
  def self.rand_exercise(duration, category, path = "rand_exercise")
23
- service = Service.new(path)
24
- service.rand_exercise(duration, category)
21
+ ExerciseFacade.new(path).rand_exercise(duration, category)
25
22
  end
26
23
 
27
24
  def self.exercises(path = "exercises")
28
- service = Service.new(path)
29
- service.exercises
25
+ ExerciseFacade.new(path).exercises
30
26
  end
31
27
 
32
28
  def self.rests(path = "rests")
33
- service = Service.new(path)
34
- service.rests
29
+ RestFacade.new(path).rests
35
30
  end
36
31
 
37
32
  def self.create_rest(mood_rating_1, mood_rating_2, content_selected, focus_interval, rest_interval, path = "rests")
38
- service = Service.new(path)
39
- service.create_rest(mood_rating_1, mood_rating_2, content_selected, focus_interval, rest_interval)
33
+ RestFacade.new(path).create_rest(mood_rating_1, mood_rating_2, content_selected, focus_interval, rest_interval)
40
34
  end
41
35
  end
42
36
 
43
37
  require 'som_timer/service'
38
+ require 'som_timer/poros/timer'
39
+ require 'som_timer/poros/exercise'
40
+ require 'som_timer/poros/rest'
41
+ require 'som_timer/facades/timer_facade'
42
+ require 'som_timer/facades/exercise_facade'
43
+ require 'som_timer/facades/rest_facade'
@@ -0,0 +1,28 @@
1
+ class SomTimer::ExerciseFacade
2
+ attr_reader :path
3
+
4
+ def initialize(path)
5
+ @path = path
6
+ @service = SomTimer::Service.new(@path)
7
+ end
8
+
9
+ def response_exercises
10
+ @service.exercises
11
+ end
12
+
13
+ def response_rand_exercise(duration, category)
14
+ @service.rand_exercise(duration, category)
15
+ end
16
+
17
+ def exercises
18
+ exercises_info = response_exercises[:exercises]
19
+
20
+ exercises_info.map do |exercise|
21
+ SomTimer::Exercise.new(exercise)
22
+ end
23
+ end
24
+
25
+ def rand_exercise(duration, category)
26
+ SomTimer::Exercise.new(response_rand_exercise(duration, category))
27
+ end
28
+ end
@@ -0,0 +1,28 @@
1
+ class SomTimer::RestFacade
2
+ attr_reader :path
3
+
4
+ def initialize(path)
5
+ @path = path
6
+ @service = SomTimer::Service.new(@path)
7
+ end
8
+
9
+ def response_rests
10
+ @service.rests
11
+ end
12
+
13
+ def response_create_rest(mood_rating_1, mood_rating_2, content_selected, focus_interval, rest_interval)
14
+ @service.create_rest(mood_rating_1, mood_rating_2, content_selected, focus_interval, rest_interval)
15
+ end
16
+
17
+ def rests
18
+ rests_info = response_rests[:rests]
19
+
20
+ rests_info.map do |rest|
21
+ SomTimer::Rest.new(rest)
22
+ end
23
+ end
24
+
25
+ def create_rest(mood_rating_1, mood_rating_2, content_selected, focus_interval, rest_interval)
26
+ SomTimer::Rest.new(response_create_rest(mood_rating_1, mood_rating_2, content_selected, focus_interval, rest_interval))
27
+ end
28
+ end
@@ -0,0 +1,24 @@
1
+ class SomTimer::TimerFacade
2
+ attr_reader :path
3
+
4
+ def initialize(path)
5
+ @path = path
6
+ @service = SomTimer::Service.new(@path)
7
+ end
8
+
9
+ def response_timer
10
+ @service.timer
11
+ end
12
+
13
+ def response_update_timer(work_interval, rest_interval, sound)
14
+ @service.update_timer(work_interval, rest_interval, sound)
15
+ end
16
+
17
+ def one_timer
18
+ SomTimer::Timer.new(response_timer)
19
+ end
20
+
21
+ def update_timer(work_interval, rest_interval, sound)
22
+ SomTimer::Timer.new(response_update_timer(work_interval, rest_interval, sound))
23
+ end
24
+ end
@@ -0,0 +1,13 @@
1
+ class SomTimer::Exercise
2
+ attr_reader :id,
3
+ :url,
4
+ :duration,
5
+ :category
6
+
7
+ def initialize(attributes)
8
+ @id = attributes[:id]
9
+ @url = attributes[:url]
10
+ @duration = attributes[:duration]
11
+ @category = attributes[:category].split(".")[1]
12
+ end
13
+ end
@@ -0,0 +1,17 @@
1
+ class SomTimer::Rest
2
+ attr_reader :id,
3
+ :mood_rating_1,
4
+ :mood_rating_2,
5
+ :content_selected,
6
+ :focus_interval,
7
+ :rest_interval
8
+
9
+ def initialize(attributes)
10
+ @id = attributes[:id]
11
+ @mood_rating_1 = attributes[:mood_rating_1]
12
+ @mood_rating_2 = attributes[:mood_rating_2]
13
+ @content_selected = attributes[:content_selected]
14
+ @focus_interval = attributes[:focus_interval]
15
+ @rest_interval = attributes[:rest_interval]
16
+ end
17
+ end
@@ -0,0 +1,13 @@
1
+ class SomTimer::Timer
2
+ attr_reader :id,
3
+ :work_interval,
4
+ :rest_interval,
5
+ :sound
6
+
7
+ def initialize(attributes)
8
+ @id = attributes[:id]
9
+ @work_interval = attributes[:work_interval]
10
+ @rest_interval = attributes[:rest_interval]
11
+ @sound = attributes[:sound]
12
+ end
13
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: som-timer
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sienna Kopf
@@ -24,20 +24,6 @@ dependencies:
24
24
  - - ">="
25
25
  - !ruby/object:Gem::Version
26
26
  version: '0'
27
- - !ruby/object:Gem::Dependency
28
- name: mocha
29
- requirement: !ruby/object:Gem::Requirement
30
- requirements:
31
- - - ">="
32
- - !ruby/object:Gem::Version
33
- version: '0'
34
- type: :development
35
- prerelease: false
36
- version_requirements: !ruby/object:Gem::Requirement
37
- requirements:
38
- - - ">="
39
- - !ruby/object:Gem::Version
40
- version: '0'
41
27
  description: A ruby library for accessing API endpoints of the SomTimer application.
42
28
  email: princess.kopf@gmail.com
43
29
  executables: []
@@ -45,6 +31,12 @@ extensions: []
45
31
  extra_rdoc_files: []
46
32
  files:
47
33
  - lib/som_timer.rb
34
+ - lib/som_timer/facades/exercise_facade.rb
35
+ - lib/som_timer/facades/rest_facade.rb
36
+ - lib/som_timer/facades/timer_facade.rb
37
+ - lib/som_timer/poros/exercise.rb
38
+ - lib/som_timer/poros/rest.rb
39
+ - lib/som_timer/poros/timer.rb
48
40
  - lib/som_timer/service.rb
49
41
  homepage: https://rubygems.org/gems/som_timer
50
42
  licenses: