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.



1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
# File 'lib/models/porcelain.rb', line 1667

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).



1657
1658
1659
# File 'lib/models/porcelain.rb', line 1657

def email
  @email
end

#external_idObject

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



1659
1660
1661
# File 'lib/models/porcelain.rb', line 1659

def external_id
  @external_id
end

#idObject

The unique identifier of the entity this activity affected.



1661
1662
1663
# File 'lib/models/porcelain.rb', line 1661

def id
  @id
end

#nameObject

A display name representing the affected entity.



1663
1664
1665
# File 'lib/models/porcelain.rb', line 1663

def name
  @name
end

#typeObject

The type of entity affected, one of the Activity Entities constants.



1665
1666
1667
# File 'lib/models/porcelain.rb', line 1665

def type
  @type
end

Instance Method Details

#to_json(options = {}) ⇒ Object



1681
1682
1683
1684
1685
1686
1687
# File 'lib/models/porcelain.rb', line 1681

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