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
|
# File 'lib/huginn_bybit_agent/bybit_agent.rb', line 70
def validate_options
errors.add(:base, "type has invalid value: should be 'get_balances' 'order_history' 'trade_history'") if interpolated['type'].present? && !%w(get_balances order_history trade_history).include?(interpolated['type'])
unless options['apikey'].present? || !['get_balances', 'order_history', 'trade_history'].include?(options['type'])
errors.add(:base, "apikey is a required field")
end
unless options['secretkey'].present? || !['get_balances', 'order_history', 'trade_history'].include?(options['type'])
errors.add(:base, "secretkey is a required field")
end
unless options['limit'].present? || !['order_history', 'trade_history'].include?(options['type'])
errors.add(:base, "limit is a required field")
end
if options.has_key?('changes_only') && boolify(options['changes_only']).nil?
errors.add(:base, "if provided, changes_only 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
|