Class: SDM::ActivityEntity

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(email: nil, external_id: nil, id: nil, name: nil, type: nil) ⇒ ActivityEntity

Returns a new instance of ActivityEntity.



1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
# File 'lib/models/porcelain.rb', line 1713

def initialize(
  email: nil,
  external_id: nil,
  id: nil,
  name: nil,
  type: nil
)
  @email = email == nil ? "" : email
  @external_id = external_id == nil ? "" : external_id
  @id = id == nil ? "" : id
  @name = name == nil ? "" : name
  @type = type == nil ? "" : type
end

Instance Attribute Details

#emailObject

The email of the affected entity, if it has one (for example, if it is an account).



1703
1704
1705
# File 'lib/models/porcelain.rb', line 1703

def email
  @email
end

#external_idObject

The external ID of the affected entity, if it has one (for example, if it is an account).



1705
1706
1707
# File 'lib/models/porcelain.rb', line 1705

def external_id
  @external_id
end

#idObject

The unique identifier of the entity this activity affected.



1707
1708
1709
# File 'lib/models/porcelain.rb', line 1707

def id
  @id
end

#nameObject

A display name representing the affected entity.



1709
1710
1711
# File 'lib/models/porcelain.rb', line 1709

def name
  @name
end

#typeObject

The type of entity affected, one of the ActivityEntityType constants.



1711
1712
1713
# File 'lib/models/porcelain.rb', line 1711

def type
  @type
end

Instance Method Details

#to_json(options = {}) ⇒ Object



1727
1728
1729
1730
1731
1732
1733
# File 'lib/models/porcelain.rb', line 1727

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