Class: Layer::Identity

Inherits:
Resource show all
Includes:
Operations::Delete, Operations::Fetch, Operations::Patch
Defined in:
lib/layer/identity.rb

Overview

Note:

This is only available via the Platform API.

Managing user identity is also possible:

Examples:

user = Layer::User.find('user_id')
user.identity # Returns user identity
user.identity.create({ first_name: 'Frodo', last_name: 'Baggins'}) # Creates new identity
user.identity.delete # Removes identity

See Also:

Instance Attribute Summary

Attributes inherited from Resource

#attributes, #client

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Operations::Patch

#save

Methods included from Operations::Delete

#delete

Methods included from Operations::Fetch

#reload

Methods inherited from Resource

class_name, from_response, #id, #initialize, #respond_to_missing?, #url

Constructor Details

This class inherits a constructor from Layer::Resource

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Layer::Resource

Class Method Details

.urlObject



17
18
19
# File 'lib/layer/identity.rb', line 17

def self.url
  '/identity'
end

Instance Method Details

#attributes=(attributes) ⇒ Object



21
22
23
24
# File 'lib/layer/identity.rb', line 21

def attributes=(attributes)
  attributes['metadata'] ||= {}
  super
end

#metadata=(metadata) ⇒ Object



26
27
28
29
30
# File 'lib/layer/identity.rb', line 26

def metadata=()
  .each_pair do |key, value|
    self.[key] = value
  end
end