Sha256: 05232995198fd44490fd8be7de9efcfd3d4c7e8bd9dcc25ea938f40aa9439cdf

Contents?: true

Size: 655 Bytes

Versions: 9

Compression:

Stored size: 655 Bytes

Contents

class Ey::Core::Client::User < Ey::Core::Model
  extend Ey::Core::Associations

  identity :id

  attribute :name
  attribute :email
  attribute :staff
  attribute :deleted_at

  has_many :accounts
  has_many :environments
  has_many :keypairs
  has_many :tokens

  attr_accessor :password

  def self.api_name
    "User"
  end

  def save!
    requires :name, :email

    params = {
      "name"  => self.name,
      "email" => self.email,
      "password" => self.password,
    }

    merge_attributes(self.connection.create_user("user" => params).body["user"])
  end

  def destroy!
    self.connection.destroy_user("id" => self.id) && true
  end

end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
ey-core-3.1.11 lib/ey-core/models/user.rb
ey-core-3.1.10 lib/ey-core/models/user.rb
ey-core-3.1.9 lib/ey-core/models/user.rb
ey-core-3.1.8 lib/ey-core/models/user.rb
ey-core-3.1.7 lib/ey-core/models/user.rb
ey-core-3.1.6 lib/ey-core/models/user.rb
ey-core-3.1.5 lib/ey-core/models/user.rb
ey-core-3.1.4 lib/ey-core/models/user.rb
ey-core-3.1.3 lib/ey-core/models/user.rb