Method: BotFramework::CardAction#initialize

Defined in:
lib/bot_framework/models/card_action.rb

#initialize(attributes = {}) ⇒ CardAction

Initializes the object

Parameters:

  • attributes (Hash) (defaults to: {})

    Model attributes in the form of hash



28
29
30
31
32
33
34
35
36
37
38
39
40
41
# File 'lib/bot_framework/models/card_action.rb', line 28

def initialize(attributes = {})
  return unless attributes.is_a?(Hash)

  # convert string to symbol for hash key
  attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }

  self.type = attributes[:type] if attributes.key?(:type)

  self.title = attributes[:title] if attributes.key?(:title)

  self.image = attributes[:image] if attributes.key?(:image)

  self.value = attributes[:value] if attributes.key?(:value)
end