Sha256: 95dd764b939155a9e9149cd8ca6860ed2595c6a1222f0418b46ae4651e9986b5
Contents?: true
Size: 1.31 KB
Versions: 1
Compression:
Stored size: 1.31 KB
Contents
module Commands::Groups::Invitation class Create < RestPack::Service::Command required do array :invitations do hash do required do integer :application_id integer :group_id integer :inviter_id string :inviter_name end optional do string :email end end end end def execute invitations = Models::Groups::Invitation.create!(inputs[:invitations]) send_email(invitations) Serializers::Groups::Invitation.serialize(invitations) end private def send_email(invitations) invitations.each do |invitation| if invitation.email rsvp_url = invitation.configuration.data['rsvp_url'] Messaging::Email::Send.run!({ application_id: invitation.application_id, template: 'group.invitation', to: invitation.email, data: { inviter_name: invitation.inviter_name, access_key: invitation.access_key, group_name: invitation.group.name, accept_url: "#{rsvp_url}?access_key=#{invitation.access_key}", reject_url: "#{rsvp_url}?access_key=#{invitation.access_key}&accept=false" } }) end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
restpack_group_service-0.0.8 | lib/restpack_group_service/commands/invitation/create.rb |