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.



1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
# File 'lib/models/porcelain.rb', line 1980

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



1970
1971
1972
# File 'lib/models/porcelain.rb', line 1970

def email
  @email
end

#external_idObject

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



1972
1973
1974
# File 'lib/models/porcelain.rb', line 1972

def external_id
  @external_id
end

#idObject

The unique identifier of the entity this activity affected.



1974
1975
1976
# File 'lib/models/porcelain.rb', line 1974

def id
  @id
end

#nameObject

A display name representing the affected entity.



1976
1977
1978
# File 'lib/models/porcelain.rb', line 1976

def name
  @name
end

#typeObject

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



1978
1979
1980
# File 'lib/models/porcelain.rb', line 1978

def type
  @type
end

Instance Method Details

#to_json(options = {}) ⇒ Object



1994
1995
1996
1997
1998
1999
2000
# File 'lib/models/porcelain.rb', line 1994

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