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.



7555
7556
7557
7558
7559
7560
7561
7562
7563
7564
7565
7566
7567
7568
7569
7570
7571
7572
7573
7574
7575
7576
7577
7578
7579
7580
7581
# File 'lib/models/porcelain.rb', line 7555

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.



7543
7544
7545
# File 'lib/models/porcelain.rb', line 7543

def email
  @email
end

#first_nameObject

The User’s first name.



7545
7546
7547
# File 'lib/models/porcelain.rb', line 7545

def first_name
  @first_name
end

#idObject

Unique identifier of the User.



7547
7548
7549
# File 'lib/models/porcelain.rb', line 7547

def id
  @id
end

#last_nameObject

The User’s last name.



7549
7550
7551
# File 'lib/models/porcelain.rb', line 7549

def last_name
  @last_name
end

#suspendedObject

The User’s suspended state.



7551
7552
7553
# File 'lib/models/porcelain.rb', line 7551

def suspended
  @suspended
end

#tagsObject

Tags is a map of key, value pairs.



7553
7554
7555
# File 'lib/models/porcelain.rb', line 7553

def tags
  @tags
end

Instance Method Details

#to_json(options = {}) ⇒ Object



7583
7584
7585
7586
7587
7588
7589
# File 'lib/models/porcelain.rb', line 7583

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