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.



1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
# File 'lib/models/porcelain.rb', line 1562

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



1552
1553
1554
# File 'lib/models/porcelain.rb', line 1552

def email
  @email
end

#external_idObject

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



1554
1555
1556
# File 'lib/models/porcelain.rb', line 1554

def external_id
  @external_id
end

#idObject

The unique identifier of the entity this activity affected.



1556
1557
1558
# File 'lib/models/porcelain.rb', line 1556

def id
  @id
end

#nameObject

A display name representing the affected entity.



1558
1559
1560
# File 'lib/models/porcelain.rb', line 1558

def name
  @name
end

#typeObject

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



1560
1561
1562
# File 'lib/models/porcelain.rb', line 1560

def type
  @type
end

Instance Method Details

#to_json(options = {}) ⇒ Object



1576
1577
1578
1579
1580
1581
1582
# File 'lib/models/porcelain.rb', line 1576

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