Class: Messenger::Parameters::Entry

Inherits:
Object
  • Object
show all
Defined in:
lib/messenger/parameters/entry.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(id:, time:, messaging: nil) ⇒ Entry

Returns a new instance of Entry.



6
7
8
9
10
# File 'lib/messenger/parameters/entry.rb', line 6

def initialize(id:, time:, messaging: nil)
  @id         = id
  @time       = time
  @messagings = build_messagings(messaging) if messaging.present?
end

Instance Attribute Details

#idObject

Returns the value of attribute id.



4
5
6
# File 'lib/messenger/parameters/entry.rb', line 4

def id
  @id
end

#messagingsObject

Returns the value of attribute messagings.



4
5
6
# File 'lib/messenger/parameters/entry.rb', line 4

def messagings
  @messagings
end

#timeObject

Returns the value of attribute time.



4
5
6
# File 'lib/messenger/parameters/entry.rb', line 4

def time
  @time
end

Instance Method Details

#build_messagings(messagings) ⇒ Object



12
13
14
# File 'lib/messenger/parameters/entry.rb', line 12

def build_messagings(messagings)
  messagings.map { |messaging| Messaging.new(messaging.transform_keys(&:to_sym)) }
end