Class: SDM::ActivityActor

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(activity_external_id: nil, email: nil, first_name: nil, id: nil, last_name: nil) ⇒ ActivityActor

Returns a new instance of ActivityActor.



1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
# File 'lib/models/porcelain.rb', line 1455

def initialize(
  activity_external_id: nil,
  email: nil,
  first_name: nil,
  id: nil,
  last_name: nil
)
  @activity_external_id = activity_external_id == nil ? "" : activity_external_id
  @email = email == nil ? "" : email
  @first_name = first_name == nil ? "" : first_name
  @id = id == nil ? "" : id
  @last_name = last_name == nil ? "" : last_name
end

Instance Attribute Details

#activity_external_idObject

The external ID of the actor at the time this activity occurred.



1445
1446
1447
# File 'lib/models/porcelain.rb', line 1445

def activity_external_id
  @activity_external_id
end

#emailObject

The email of the actor at the time this activity occurred.



1447
1448
1449
# File 'lib/models/porcelain.rb', line 1447

def email
  @email
end

#first_nameObject

The first name of the actor at the time this activity occurred.



1449
1450
1451
# File 'lib/models/porcelain.rb', line 1449

def first_name
  @first_name
end

#idObject

Unique identifier of the actor. Immutable.



1451
1452
1453
# File 'lib/models/porcelain.rb', line 1451

def id
  @id
end

#last_nameObject

The last name of the actor at the time this activity occurred.



1453
1454
1455
# File 'lib/models/porcelain.rb', line 1453

def last_name
  @last_name
end

Instance Method Details

#to_json(options = {}) ⇒ Object



1469
1470
1471
1472
1473
1474
1475
# File 'lib/models/porcelain.rb', line 1469

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