Class: SimplyAuth::User

Inherits:
Model
  • Object
show all
Defined in:
app/models/simply_auth/user.rb

Instance Attribute Summary collapse

Attributes inherited from Model

#id

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Model

#attributes=, collection_path, #collection_path, create, #data, #data=, find, #initialize, instance_path, #instance_path, owner_class, path_component, #persisted=, #persisted?, #save

Constructor Details

This class inherits a constructor from SimplyAuth::Model

Instance Attribute Details

#emailObject

Returns the value of attribute email.



3
4
5
# File 'app/models/simply_auth/user.rb', line 3

def email
  @email
end

#nameObject

Returns the value of attribute name.



3
4
5
# File 'app/models/simply_auth/user.rb', line 3

def name
  @name
end

#passwordObject

Returns the value of attribute password.



3
4
5
# File 'app/models/simply_auth/user.rb', line 3

def password
  @password
end

#user_pool_idObject

Returns the value of attribute user_pool_id.



3
4
5
# File 'app/models/simply_auth/user.rb', line 3

def user_pool_id
  @user_pool_id
end

Class Method Details

.all(ids) ⇒ Object



19
20
21
22
23
24
25
26
27
28
29
# File 'app/models/simply_auth/user.rb', line 19

def self.all(ids)
  response = RestClient.get(
    "https://api.simplyauth.com#{collection_path(ids)}",
    accept: :json
  )
  body = JSON.parse(response.body)
  body.map do |data|
    data = data.deep_transform_keys { |key| key.to_s.underscore }
    new(data)
  end
end

.owner_class_nameObject



15
16
17
# File 'app/models/simply_auth/user.rb', line 15

def self.owner_class_name
  "UserPool"
end

Instance Method Details

#attributesObject



7
8
9
# File 'app/models/simply_auth/user.rb', line 7

def attributes
  super.merge(name: name, email: email, password: password)
end

#owner_idObject



11
12
13
# File 'app/models/simply_auth/user.rb', line 11

def owner_id
  self.user_pool_id
end