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.



1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
# File 'lib/models/porcelain.rb', line 1797

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



1787
1788
1789
# File 'lib/models/porcelain.rb', line 1787

def email
  @email
end

#external_idObject

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



1789
1790
1791
# File 'lib/models/porcelain.rb', line 1789

def external_id
  @external_id
end

#idObject

The unique identifier of the entity this activity affected.



1791
1792
1793
# File 'lib/models/porcelain.rb', line 1791

def id
  @id
end

#nameObject

A display name representing the affected entity.



1793
1794
1795
# File 'lib/models/porcelain.rb', line 1793

def name
  @name
end

#typeObject

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



1795
1796
1797
# File 'lib/models/porcelain.rb', line 1795

def type
  @type
end

Instance Method Details

#to_json(options = {}) ⇒ Object



1811
1812
1813
1814
1815
1816
1817
# File 'lib/models/porcelain.rb', line 1811

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