Class: SDM::ActivityActor

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(activity_external_id: nil, email: nil, first_name: nil, id: nil, last_name: nil) ⇒ ActivityActor

Returns a new instance of ActivityActor.



1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
# File 'lib/models/porcelain.rb', line 1284

def initialize(
  activity_external_id: nil,
  email: nil,
  first_name: nil,
  id: nil,
  last_name: nil
)
  @activity_external_id = activity_external_id == nil ? "" : activity_external_id
  @email = email == nil ? "" : email
  @first_name = first_name == nil ? "" : first_name
  @id = id == nil ? "" : id
  @last_name = last_name == nil ? "" : last_name
end

Instance Attribute Details

#activity_external_idObject

The external ID of the actor at the time this activity occurred.



1274
1275
1276
# File 'lib/models/porcelain.rb', line 1274

def activity_external_id
  @activity_external_id
end

#emailObject

The email of the actor at the time this activity occurred.



1276
1277
1278
# File 'lib/models/porcelain.rb', line 1276

def email
  @email
end

#first_nameObject

The first name of the actor at the time this activity occurred.



1278
1279
1280
# File 'lib/models/porcelain.rb', line 1278

def first_name
  @first_name
end

#idObject

Unique identifier of the actor. Immutable.



1280
1281
1282
# File 'lib/models/porcelain.rb', line 1280

def id
  @id
end

#last_nameObject

The last name of the actor at the time this activity occurred.



1282
1283
1284
# File 'lib/models/porcelain.rb', line 1282

def last_name
  @last_name
end

Instance Method Details

#to_json(options = {}) ⇒ Object



1298
1299
1300
1301
1302
1303
1304
# File 'lib/models/porcelain.rb', line 1298

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