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.



2524
2525
2526
2527
2528
2529
2530
2531
2532
2533
2534
2535
2536
# File 'lib/models/porcelain.rb', line 2524

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



2514
2515
2516
# File 'lib/models/porcelain.rb', line 2514

def email
  @email
end

#external_idObject

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



2516
2517
2518
# File 'lib/models/porcelain.rb', line 2516

def external_id
  @external_id
end

#idObject

The unique identifier of the entity this activity affected.



2518
2519
2520
# File 'lib/models/porcelain.rb', line 2518

def id
  @id
end

#nameObject

A display name representing the affected entity.



2520
2521
2522
# File 'lib/models/porcelain.rb', line 2520

def name
  @name
end

#typeObject

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



2522
2523
2524
# File 'lib/models/porcelain.rb', line 2522

def type
  @type
end

Instance Method Details

#to_json(options = {}) ⇒ Object



2538
2539
2540
2541
2542
2543
2544
# File 'lib/models/porcelain.rb', line 2538

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