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.



1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
# File 'lib/models/porcelain.rb', line 1271

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



1261
1262
1263
# File 'lib/models/porcelain.rb', line 1261

def email
  @email
end

#external_idObject

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



1263
1264
1265
# File 'lib/models/porcelain.rb', line 1263

def external_id
  @external_id
end

#idObject

The unique identifier of the entity this activity affected.



1265
1266
1267
# File 'lib/models/porcelain.rb', line 1265

def id
  @id
end

#nameObject

A display name representing the affected entity.



1267
1268
1269
# File 'lib/models/porcelain.rb', line 1267

def name
  @name
end

#typeObject

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



1269
1270
1271
# File 'lib/models/porcelain.rb', line 1269

def type
  @type
end

Instance Method Details

#to_json(options = {}) ⇒ Object



1285
1286
1287
1288
1289
1290
1291
# File 'lib/models/porcelain.rb', line 1285

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