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.



7599
7600
7601
7602
7603
7604
7605
7606
7607
7608
7609
7610
7611
7612
7613
7614
7615
7616
7617
7618
7619
7620
7621
7622
7623
7624
7625
# File 'lib/models/porcelain.rb', line 7599

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.



7587
7588
7589
# File 'lib/models/porcelain.rb', line 7587

def email
  @email
end

#first_nameObject

The User's first name.



7589
7590
7591
# File 'lib/models/porcelain.rb', line 7589

def first_name
  @first_name
end

#idObject

Unique identifier of the User.



7591
7592
7593
# File 'lib/models/porcelain.rb', line 7591

def id
  @id
end

#last_nameObject

The User's last name.



7593
7594
7595
# File 'lib/models/porcelain.rb', line 7593

def last_name
  @last_name
end

#suspendedObject

The User's suspended state.



7595
7596
7597
# File 'lib/models/porcelain.rb', line 7595

def suspended
  @suspended
end

#tagsObject

Tags is a map of key, value pairs.



7597
7598
7599
# File 'lib/models/porcelain.rb', line 7597

def tags
  @tags
end

Instance Method Details

#to_json(options = {}) ⇒ Object



7627
7628
7629
7630
7631
7632
7633
# File 'lib/models/porcelain.rb', line 7627

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