- def build_sum_infos
- email = @mail_content.from[0]
- account_uuid = %x(uuidgen).chomp
- message_id = @mail_content.message_id
- sum_infos = {
'email' => email,
'message_id' => message_id,
'url' => check_email_available(email),
'acct_infos' => account_info(pub_key),
'account_uuid' => account_uuid,
'pub_key' => pub_key
This creates sum_infos in one Hash format and convert it to another below. Why not create it in final form all at once?
- }
- store_account_info(sum_infos)
- sum_infos
- end
- def store_account_info(sum_infos)
- account_uuid_info = {
'email' => sum_infos['email'],
'name' => sum_infos['email'].split('@')[0],
'uuid' => sum_infos['account_uuid'],
'user' => sum_infos['acct_infos']['account'],
'my_commit_url' => sum_infos['url']
- }
- es = ESClient.new(index: 'accounts')
- es.put_source_by_id(sum_infos['email'], account_uuid_info)
- end
+end
2.23.0