timekit 0.2.1 → 0.2.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
  SHA1:
3
- metadata.gz: 66b5a72518833ff8e3433bd41b8ce0f8140b0aa2
4
- data.tar.gz: 66190bf36b9c5573660179de6c37fdd204484c84
3
+ metadata.gz: 05a6531ec3a16e156d16744eccb237a0b7b607af
4
+ data.tar.gz: 6cf88078a35e0e861076c957cb0fea93ee11b05d
5
5
  SHA512:
6
- metadata.gz: e8fbaf37e4a43fd006e1f98eb6c7ee1164a16a8bd726b67240956fb3c3af2e558e77b045f60e5bc3006ef44ebf2d6277ff7cec968a235a97394cc357cf414ad3
7
- data.tar.gz: fe99a6a55789db2040375d40582d27b9844704f51a314356b15350f714af784b3084287fbe150dfbf0ad88cf6bfb7d2c153af5b3fc0d858ddae34087eab9a46f
6
+ metadata.gz: 7c3b62c9dab0d8c8c0a99f8f2e4658f0067647b01c5e0dac99bc9a33dc07412232a789a5f79dfc4cc5fc18740862e8dafe9108e83fd147ca5741f3990db5b76b
7
+ data.tar.gz: e08e1ee82d2137ae7c8957c8d22f8c9eb2a38a8030271e5502b39a024201fcc94fa2f469703bcbc23f0a767a4a2f1c969f2889dfceb8843f6acbe6c73294f6b9
@@ -40,20 +40,18 @@ module Timekit
40
40
  calendar_id: calendar_id
41
41
  }
42
42
 
43
- optional_params = [
44
- :participants,
45
- :invite,
46
- :description,
47
- :my_rsvp,
48
- :sync_provider,
49
- :all_day
50
- ]
51
-
52
- optional_params.each do |name|
53
- value = binding.local_variable_get(name)
54
- params[name.to_sym] = value if [true, false].include?(value) ||
55
- !value.nil?
56
- end
43
+ params = set_optional_params(
44
+ binding,
45
+ [
46
+ :participants,
47
+ :invite,
48
+ :description,
49
+ :my_rsvp,
50
+ :sync_provider,
51
+ :all_day
52
+ ],
53
+ params
54
+ )
57
55
 
58
56
  post(API_PATH, params)
59
57
  end
@@ -71,24 +69,34 @@ module Timekit
71
69
  params[:start] = event_start if event_start
72
70
  params[:end] = event_end if event_end
73
71
 
74
- optional_params = [
75
- :what,
76
- :where,
77
- :participants,
78
- :all_day
79
- ]
72
+ params = set_optional_params(
73
+ binding,
74
+ [
75
+ :what,
76
+ :where,
77
+ :participants,
78
+ :all_day
79
+ ],
80
+ params
81
+ )
80
82
 
83
+ put(API_PATH + '/' + id.to_s, params)
84
+ end
85
+
86
+ def delete(id)
87
+ super(API_PATH + '/' + id.to_s)
88
+ end
89
+
90
+ private
91
+
92
+ def set_optional_params(binding, optional_params, params)
81
93
  optional_params.each do |name|
82
94
  value = binding.local_variable_get(name)
83
95
  params[name.to_sym] = value if
84
96
  [true, false].include?(value) || !value.nil?
85
97
  end
86
98
 
87
- put(API_PATH + '/' + id.to_s, params)
88
- end
89
-
90
- def delete(id)
91
- super(API_PATH + '/' + id.to_s)
99
+ params
92
100
  end
93
101
  end
94
102
  end
@@ -15,7 +15,7 @@ module Timekit
15
15
 
16
16
  # @return [Integer]
17
17
  def patch
18
- 1
18
+ 2
19
19
  end
20
20
 
21
21
  # @return [Integer, NilClass]
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: timekit
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michael Gauthier