Class: SDM::User

Inherits:
Object
  • Object
show all
Defined in:
lib/models/porcelain.rb

Overview

A User can connect to resources they are granted directly, or granted via roles.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(email: nil, first_name: nil, id: nil, last_name: nil, suspended: nil, tags: nil) ⇒ User

Returns a new instance of User.



6833
6834
6835
6836
6837
6838
6839
6840
6841
6842
6843
6844
6845
6846
6847
6848
6849
6850
6851
6852
6853
6854
6855
6856
6857
6858
6859
# File 'lib/models/porcelain.rb', line 6833

def initialize(
  email: nil,
  first_name: nil,
  id: nil,
  last_name: nil,
  suspended: nil,
  tags: nil
)
  if email != nil
    @email = email
  end
  if first_name != nil
    @first_name = first_name
  end
  if id != nil
    @id = id
  end
  if last_name != nil
    @last_name = last_name
  end
  if suspended != nil
    @suspended = suspended
  end
  if tags != nil
    @tags = tags
  end
end

Instance Attribute Details

#emailObject

The User’s email address. Must be unique.



6821
6822
6823
# File 'lib/models/porcelain.rb', line 6821

def email
  @email
end

#first_nameObject

The User’s first name.



6823
6824
6825
# File 'lib/models/porcelain.rb', line 6823

def first_name
  @first_name
end

#idObject

Unique identifier of the User.



6825
6826
6827
# File 'lib/models/porcelain.rb', line 6825

def id
  @id
end

#last_nameObject

The User’s last name.



6827
6828
6829
# File 'lib/models/porcelain.rb', line 6827

def last_name
  @last_name
end

#suspendedObject

The User’s suspended state.



6829
6830
6831
# File 'lib/models/porcelain.rb', line 6829

def suspended
  @suspended
end

#tagsObject

Tags is a map of key, value pairs.



6831
6832
6833
# File 'lib/models/porcelain.rb', line 6831

def tags
  @tags
end

Instance Method Details

#to_json(options = {}) ⇒ Object



6861
6862
6863
6864
6865
6866
6867
# File 'lib/models/porcelain.rb', line 6861

def to_json(options = {})
  hash = {}
  self.instance_variables.each do |var|
    hash[var.id2name.delete_prefix("@")] = self.instance_variable_get var
  end
  hash.to_json
end