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.



1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
# File 'lib/models/porcelain.rb', line 1646

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.



1636
1637
1638
# File 'lib/models/porcelain.rb', line 1636

def activity_external_id
  @activity_external_id
end

#emailObject

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



1638
1639
1640
# File 'lib/models/porcelain.rb', line 1638

def email
  @email
end

#first_nameObject

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



1640
1641
1642
# File 'lib/models/porcelain.rb', line 1640

def first_name
  @first_name
end

#idObject

Unique identifier of the actor. Immutable.



1642
1643
1644
# File 'lib/models/porcelain.rb', line 1642

def id
  @id
end

#last_nameObject

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



1644
1645
1646
# File 'lib/models/porcelain.rb', line 1644

def last_name
  @last_name
end

Instance Method Details

#to_json(options = {}) ⇒ Object



1660
1661
1662
1663
1664
1665
1666
# File 'lib/models/porcelain.rb', line 1660

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