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.



1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
# File 'lib/models/porcelain.rb', line 1902

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



1892
1893
1894
# File 'lib/models/porcelain.rb', line 1892

def email
  @email
end

#external_idObject

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



1894
1895
1896
# File 'lib/models/porcelain.rb', line 1894

def external_id
  @external_id
end

#idObject

The unique identifier of the entity this activity affected.



1896
1897
1898
# File 'lib/models/porcelain.rb', line 1896

def id
  @id
end

#nameObject

A display name representing the affected entity.



1898
1899
1900
# File 'lib/models/porcelain.rb', line 1898

def name
  @name
end

#typeObject

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



1900
1901
1902
# File 'lib/models/porcelain.rb', line 1900

def type
  @type
end

Instance Method Details

#to_json(options = {}) ⇒ Object



1916
1917
1918
1919
1920
1921
1922
# File 'lib/models/porcelain.rb', line 1916

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