Class: Mumukit::Auth::Profile

Inherits:
Object
  • Object
show all
Defined in:
lib/mumuki/profile.rb

Constant Summary collapse

FIELDS =
[:uid, :social_id, :email, :name, :first_name, :last_name, :image_url]

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes) ⇒ Profile

Returns a new instance of Profile.



6
7
8
# File 'lib/mumuki/profile.rb', line 6

def initialize(attributes)
  @attributes = attributes
end

Instance Attribute Details

#attributesObject

Returns the value of attribute attributes.



2
3
4
# File 'lib/mumuki/profile.rb', line 2

def attributes
  @attributes
end

Class Method Details

.extract(profile_like) ⇒ Object



10
11
12
# File 'lib/mumuki/profile.rb', line 10

def self.extract(profile_like)
  new profile_like.as_json(only: FIELDS).with_indifferent_access
end

Instance Method Details

#==(other) ⇒ Object



14
15
16
# File 'lib/mumuki/profile.rb', line 14

def ==(other)
  other.class == self.class && other.attributes == self.attributes
end