chores_kit 0.2.0 → 0.2.1

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: 19c0459360abffeaa51fc5bdd18b1b6ea2988857d5dc2f9a16f00303f915e1eb
4
- data.tar.gz: 108e845ff47a7c0bf0cc16195fc076e83d86729bbf1a93fc85828ad1927b60bd
3
+ metadata.gz: f4053eb5fcc4a8164b279a8b02d90e26591d0de4d9323e7b5fb72b60191ddf80
4
+ data.tar.gz: 83d2a4bd1e7733959a93e6ef7c692df30ce32522d90a8f7f15c7bb10e2c14ae6
5
5
  SHA512:
6
- metadata.gz: ce8853e8ffcaf35f57b152cbb252762970a920cd34d6f859f3d69039f9645a79bf8cf7ccc533c07673e02d5e4a210942d18c62c04f04e673e7be381c049b907d
7
- data.tar.gz: 17b0035c2b1c8516d2cfe9cd2ad6927b83b61b4781a1b87028e7ac0d9c94aa606e226832f19a2a422be7898cbe7a8daaaf872d7677b05d5472f869fb2a40ac83
6
+ metadata.gz: b589b5d8b022d16b092d6baa1005593ce11e7a0d7d60dd5e2e9ba4bbdb9c05e7091e2896bb7d1c2e31bfb43e188cc67ab1f315fe04afda4865c949f062aa4827
7
+ data.tar.gz: e92606e0da19c34defb5b17b1c2372cbb169dbfbe62f40bcdfb3605c8c1f2a5b62e973c5f533f4e81e5f3ac5e947b989cb617429ee26d208ce05ae4f1d491e1c
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- chores_kit (0.2.0)
4
+ chores_kit (0.2.1)
5
5
  as-duration (~> 0.1.1)
6
6
  dag (~> 0.0.9)
7
7
 
@@ -1,4 +1,6 @@
1
1
  require 'date'
2
+ require 'time'
3
+
2
4
  require 'as-duration'
3
5
 
4
6
  module ChoresKit
@@ -23,14 +25,28 @@ module ChoresKit
23
25
  end
24
26
 
25
27
  def schedule(options)
28
+ raise "Couldn't parse start time from attributes" if options[:at].nil?
29
+ raise "Couldn't parse interval from attributes" unless options[:every].nil? || options[:every].is_a?(AS::Duration)
30
+
31
+ at_ltz = Time.parse(options[:at]) || Time.now
32
+ at_utc = Time.utc(*at_ltz) || Date.today.to_time.utc
33
+
26
34
  @metadata[:schedule] = {
27
- at: options.fetch(:at, Date.today.to_time),
28
- every: options.fetch(:every, 1.day)
35
+ at: at_utc,
36
+ every: options[:every]
29
37
  }
30
38
  end
31
39
 
32
40
  def retry_failed(options)
33
- @metadata[:retry_failed] = options
41
+ raise "Couldn't parse retry interval from attributes" unless options[:wait].nil? || options[:wait].is_a?(AS::Duration)
42
+
43
+ wait = options[:wait] || 1.second
44
+ retries = options[:retries] || 1
45
+
46
+ @metadata[:retry_failed] = {
47
+ wait: wait,
48
+ retries: retries
49
+ }
34
50
  end
35
51
 
36
52
  # Tasks and dependencies
@@ -1,3 +1,3 @@
1
1
  module ChoresKit
2
- VERSION = '0.2.0'.freeze
2
+ VERSION = '0.2.1'.freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: chores_kit
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Lennard Timm
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-03-12 00:00:00.000000000 Z
11
+ date: 2018-03-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: as-duration