class Ribose::CLI::Commands::Invitation

Public Instance Methods

accept() click to toggle source
# File lib/ribose/cli/commands/invitation.rb, line 38
def accept
  Ribose::SpaceInvitation.accept(options[:invitation_id])
  say("Space invitation has been accepted!")
end
add() click to toggle source
# File lib/ribose/cli/commands/invitation.rb, line 19
def add
  invoke(Member, :add)
end
list() click to toggle source
# File lib/ribose/cli/commands/invitation.rb, line 9
def list
  say(build_output(Ribose::SpaceInvitation.all(options), options))
end
reject() click to toggle source
# File lib/ribose/cli/commands/invitation.rb, line 46
def reject
  Ribose::SpaceInvitation.reject(options[:invitation_id])
  say("Space invitation has been rejected!")
end
remove() click to toggle source
# File lib/ribose/cli/commands/invitation.rb, line 54
def remove
  Ribose::SpaceInvitation.cancel(options[:invitation_id])
  say("Space invitation has been removed!")
rescue Ribose::Forbidden
  say("Could not remove the specified invitation")
end
update() click to toggle source
# File lib/ribose/cli/commands/invitation.rb, line 28
def update
  update_invitation(options)
  say("Space invitation has been updated!")
rescue Ribose::UnprocessableEntity
  say("Something went wrong! Please check required attributes")
end

Private Instance Methods

table_headers() click to toggle source
# File lib/ribose/cli/commands/invitation.rb, line 69
def table_headers
  ["ID", "Inviter", "Type", "Space Name"]
end
table_rows(invitations) click to toggle source
# File lib/ribose/cli/commands/invitation.rb, line 73
def table_rows(invitations)
  invitations.map do |invt|
    [invt.id, invt.inviter.name, invt.type, invt.space.name]
  end
end
update_invitation(attributes) click to toggle source
# File lib/ribose/cli/commands/invitation.rb, line 63
def update_invitation(attributes)
  Ribose::SpaceInvitation.update(
    attributes.delete(:invitation_id), attributes
  )
end