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.



2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
# File 'lib/models/porcelain.rb', line 2495

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.



2485
2486
2487
# File 'lib/models/porcelain.rb', line 2485

def activity_external_id
  @activity_external_id
end

#emailObject

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



2487
2488
2489
# File 'lib/models/porcelain.rb', line 2487

def email
  @email
end

#first_nameObject

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



2489
2490
2491
# File 'lib/models/porcelain.rb', line 2489

def first_name
  @first_name
end

#idObject

Unique identifier of the actor. Immutable.



2491
2492
2493
# File 'lib/models/porcelain.rb', line 2491

def id
  @id
end

#last_nameObject

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



2493
2494
2495
# File 'lib/models/porcelain.rb', line 2493

def last_name
  @last_name
end

Instance Method Details

#to_json(options = {}) ⇒ Object



2509
2510
2511
2512
2513
2514
2515
# File 'lib/models/porcelain.rb', line 2509

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