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.



2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
# File 'lib/models/porcelain.rb', line 2220

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



2210
2211
2212
# File 'lib/models/porcelain.rb', line 2210

def email
  @email
end

#external_idObject

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



2212
2213
2214
# File 'lib/models/porcelain.rb', line 2212

def external_id
  @external_id
end

#idObject

The unique identifier of the entity this activity affected.



2214
2215
2216
# File 'lib/models/porcelain.rb', line 2214

def id
  @id
end

#nameObject

A display name representing the affected entity.



2216
2217
2218
# File 'lib/models/porcelain.rb', line 2216

def name
  @name
end

#typeObject

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



2218
2219
2220
# File 'lib/models/porcelain.rb', line 2218

def type
  @type
end

Instance Method Details

#to_json(options = {}) ⇒ Object



2234
2235
2236
2237
2238
2239
2240
# File 'lib/models/porcelain.rb', line 2234

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