Skip to content

Commit 911dd9f

Browse files
feat: add ending_at property to Schedule (#27)
* feat: add ending_at property to Schedule Co-Authored-By: Christopher Bell <[email protected]> * style: fix line length and parameter list formatting Co-Authored-By: Christopher Bell <[email protected]> * refactor: move optional parameters to options hash to reduce parameter count Co-Authored-By: Christopher Bell <[email protected]> * refactor: simplify create_schedules method signature to use single options hash Co-Authored-By: Christopher Bell <[email protected]> * refactor: revert to positional arguments with ending_at Co-Authored-By: Christopher Bell <[email protected]> * style: fix method signature line length Co-Authored-By: Christopher Bell <[email protected]> * style: fix RuboCop LineLength namespace Co-Authored-By: Christopher Bell <[email protected]> * style: replace has_key? with key? in users.rb Co-Authored-By: Christopher Bell <[email protected]> * chore: bump to 0.6.2 --------- Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> Co-authored-by: Christopher Bell <[email protected]> Co-authored-by: Chris Bell <[email protected]>
1 parent f592613 commit 911dd9f

File tree

5 files changed

+16
-9
lines changed

5 files changed

+16
-9
lines changed

.rubocop.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
AllCops:
22
TargetRubyVersion: 2.5
3-
Metrics/LineLength:
3+
Layout/LineLength:
44
Max: 120
55
Metrics/MethodLength:
66
Max: 35
77
Metrics/ParameterLists:
8-
Max: 7
8+
Max: 8

Gemfile.lock

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
PATH
22
remote: .
33
specs:
4-
knockapi (0.6.1)
4+
knockapi (0.6.2)
55

66
GEM
77
remote: https://rubygems.org/

lib/knock/users.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,7 @@ def bulk_set_preferences(
223223
endpoint = '/v1/users/bulk/preferences'
224224

225225
# Put the preference set id if it doesn't already exist
226-
preferences['id'] = preference_set unless preferences.has_key?('id')
226+
preferences['id'] = preference_set unless preferences.key?('id')
227227

228228
request = post_request(
229229
auth: true,

lib/knock/version.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# frozen_string_literal: true
22

33
module Knock
4-
VERSION = '0.6.1'
4+
VERSION = '0.6.2'
55
end

lib/knock/workflows.rb

+11-4
Original file line numberDiff line numberDiff line change
@@ -67,21 +67,28 @@ def cancel(key:, cancellation_key:, recipients: nil)
6767
# workflow.
6868
#
6969
# @param [String] key The workflow key
70-
# @param [String, Hash] actor An optional actor identifier to be used when trigger the workflow
7170
# @param [Array<String, Hash>] recipients The recipient identifiers
7271
# @param [Array<Hash>] repeats The repeat rules for when to schedule the workflow run
72+
# @param [String, Hash] actor An optional actor identifier to be used when trigger the workflow
73+
# @param [Time, String, nil] scheduled_at When the schedule should start
74+
# @param [Time, String, nil] ending_at When the schedule should end
7375
# @param [Hash] data Parameters to be used as variables on the workflow run
7476
# @param [String, Hash] tenant An optional tenant identifier or a set of tenant attributes
7577

76-
def create_schedules(key:, recipients:, repeats:, scheduled_at: nil, data: {}, actor: nil, tenant: nil)
78+
def create_schedules(
79+
key:, recipients:, repeats:,
80+
scheduled_at: nil, ending_at: nil, data: {},
81+
actor: nil, tenant: nil
82+
)
7783
attrs = {
7884
workflow: key,
7985
actor: actor,
8086
recipients: recipients,
8187
repeats: repeats,
8288
data: data,
8389
tenant: tenant,
84-
scheduled_at: scheduled_at
90+
scheduled_at: scheduled_at,
91+
ending_at: ending_at
8592
}
8693

8794
request = post_request(
@@ -97,7 +104,7 @@ def create_schedules(key:, recipients:, repeats:, scheduled_at: nil, data: {}, a
97104
#
98105
# @param [Array<String>] schedule_ids The ids of the schedules to be updated
99106
# @param [Hash] schedule_attrs The attributes to be used to update the schedules
100-
# Possible attributes: actor, repeats, data and tenant
107+
# Possible attributes: actor, repeats, data, tenant, ending_at
101108

102109
def update_schedules(schedule_ids:, schedule_attrs:)
103110
attrs = {

0 commit comments

Comments
 (0)