Class: Ey::Core::Client::User

Inherits:
Model
  • Object
show all
Extended by:
Associations
Defined in:
lib/ey-core/models/user.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Associations

assoc_accessor, assoc_coverage, assoc_reader, assoc_writer, associations, collection_reader

Methods inherited from Model

#destroy, range_parser, #save, #to_s, #update!, #url

Instance Attribute Details

#passwordObject

Returns the value of attribute password.



16
17
18
# File 'lib/ey-core/models/user.rb', line 16

def password
  @password
end

Class Method Details

.api_nameObject



18
19
20
# File 'lib/ey-core/models/user.rb', line 18

def self.api_name
  "User"
end

Instance Method Details

#destroy!Object



34
35
36
# File 'lib/ey-core/models/user.rb', line 34

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

#save!Object



22
23
24
25
26
27
28
29
30
31
32
# File 'lib/ey-core/models/user.rb', line 22

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