Sha256: 564610b35334db4a656c691d2f0741d1e1a75ed998bdd29cf3d64e11e1a7a77f

Contents?: true

Size: 698 Bytes

Versions: 20

Compression:

Stored size: 698 Bytes

Contents

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

  identity :id

  attribute :token, aliases: ["api_token"]
  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

20 entries across 20 versions & 2 rubygems

Version Path
ey-core-3.6.4 lib/ey-core/models/user.rb
ey-core-3.6.3 lib/ey-core/models/user.rb
ey-core-3.6.1 lib/ey-core/models/user.rb
groove-ey-core-3.6.3 lib/ey-core/models/user.rb
groove-ey-core-3.6.2 lib/ey-core/models/user.rb
groove-ey-core-3.6.1 lib/ey-core/models/user.rb
ey-core-3.5.0 lib/ey-core/models/user.rb
ey-core-3.4.4 lib/ey-core/models/user.rb
ey-core-3.4.2 lib/ey-core/models/user.rb
ey-core-3.4.1 lib/ey-core/models/user.rb
ey-core-3.4.0 lib/ey-core/models/user.rb
ey-core-3.3.1 lib/ey-core/models/user.rb
ey-core-3.3.0 lib/ey-core/models/user.rb
ey-core-3.2.6 lib/ey-core/models/user.rb
ey-core-3.2.5 lib/ey-core/models/user.rb
ey-core-3.2.4 lib/ey-core/models/user.rb
ey-core-3.2.3 lib/ey-core/models/user.rb
ey-core-3.2.2 lib/ey-core/models/user.rb
ey-core-3.2.1 lib/ey-core/models/user.rb
ey-core-3.2.0 lib/ey-core/models/user.rb