70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
|
# File 'lib/huginn_twitch_agent/twitch_agent.rb', line 70
def validate_options
errors.add(:base, "type has invalid value: should be 'get_user_informations', 'active_streams'") if interpolated['type'].present? && !%w(get_user_informations active_streams).include?(interpolated['type'])
unless options['user_id'].present?
errors.add(:base, "user_id is a required field")
end
unless options['client_id'].present?
errors.add(:base, "client_id is a required field")
end
unless options['client_secret'].present?
errors.add(:base, "client_secret is a required field")
end
unless options['access_token'].present?
errors.add(:base, "access_token is a required field")
end
if options.has_key?('emit_events') && boolify(options['emit_events']).nil?
errors.add(:base, "if provided, emit_events must be true or false")
end
if options.has_key?('debug') && boolify(options['debug']).nil?
errors.add(:base, "if provided, debug must be true or false")
end
unless options['expected_receive_period_in_days'].present? && options['expected_receive_period_in_days'].to_i > 0
errors.add(:base, "Please provide 'expected_receive_period_in_days' to indicate how many days can pass before this Agent is considered to be not working")
end
end
|