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.



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

def password
  @password
end

Class Method Details

.api_nameObject



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

def self.api_name
  "User"
end

Instance Method Details

#destroy!Object



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

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

#save!Object



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

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