9
10
11
12
13
14
15
16
17
18
19
20
21
|
# File 'lib/qywx/client/group_robot_client/notify_feedcard.rb', line 9
def notify_feedcard(code, links)
token_code = code.to_sym
token = fetch_token(token_code)
links = Array.wrap(links).map do |link|
Hash(link).symbolize_keys.tap do |hash|
required_keys = %i[title url picurl]
keys_valid = required_keys.all? { |arg| hash[arg].present? }
raise ArgumentError, "links requires these keys present: #{required_keys.join(', ')}" unless keys_valid
end
end
body = get_feedcard_body(links)
notify(token, body)
end
|