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.



1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
# File 'lib/models/porcelain.rb', line 1762

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.



1752
1753
1754
# File 'lib/models/porcelain.rb', line 1752

def activity_external_id
  @activity_external_id
end

#emailObject

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



1754
1755
1756
# File 'lib/models/porcelain.rb', line 1754

def email
  @email
end

#first_nameObject

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



1756
1757
1758
# File 'lib/models/porcelain.rb', line 1756

def first_name
  @first_name
end

#idObject

Unique identifier of the actor. Immutable.



1758
1759
1760
# File 'lib/models/porcelain.rb', line 1758

def id
  @id
end

#last_nameObject

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



1760
1761
1762
# File 'lib/models/porcelain.rb', line 1760

def last_name
  @last_name
end

Instance Method Details

#to_json(options = {}) ⇒ Object



1776
1777
1778
1779
1780
1781
1782
# File 'lib/models/porcelain.rb', line 1776

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