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.



1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
# File 'lib/models/porcelain.rb', line 1945

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.



1935
1936
1937
# File 'lib/models/porcelain.rb', line 1935

def activity_external_id
  @activity_external_id
end

#emailObject

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



1937
1938
1939
# File 'lib/models/porcelain.rb', line 1937

def email
  @email
end

#first_nameObject

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



1939
1940
1941
# File 'lib/models/porcelain.rb', line 1939

def first_name
  @first_name
end

#idObject

Unique identifier of the actor. Immutable.



1941
1942
1943
# File 'lib/models/porcelain.rb', line 1941

def id
  @id
end

#last_nameObject

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



1943
1944
1945
# File 'lib/models/porcelain.rb', line 1943

def last_name
  @last_name
end

Instance Method Details

#to_json(options = {}) ⇒ Object



1959
1960
1961
1962
1963
1964
1965
# File 'lib/models/porcelain.rb', line 1959

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