Class: RubyConversations::MessageInput
- Inherits:
-
Object
- Object
- RubyConversations::MessageInput
- Defined in:
- lib/ruby_conversations/message_input.rb
Overview
Represents an input value for a message prompt
Instance Attribute Summary collapse
-
#created_at ⇒ Object
Define attributes.
-
#id ⇒ Object
Define attributes.
-
#message_prompt ⇒ Object
Returns the value of attribute message_prompt.
-
#message_prompt_id ⇒ Object
Define attributes.
-
#placeholder_name ⇒ Object
Define attributes.
-
#updated_at ⇒ Object
Define attributes.
-
#value ⇒ Object
Define attributes.
Class Method Summary collapse
- .all ⇒ Object
-
.ordered ⇒ Object
Scopes.
Instance Method Summary collapse
-
#attributes ⇒ Object
Attributes method for serialization/logging.
-
#attributes_for_api ⇒ Object
Method for API serialization.
-
#initialize(attributes = {}) ⇒ MessageInput
constructor
A new instance of MessageInput.
Constructor Details
#initialize(attributes = {}) ⇒ MessageInput
Returns a new instance of MessageInput.
14 15 16 17 18 |
# File 'lib/ruby_conversations/message_input.rb', line 14 def initialize(attributes = {}) attributes.each do |key, value| public_send("#{key}=", value) if respond_to?("#{key}=") end end |
Instance Attribute Details
#created_at ⇒ Object
Define attributes
9 10 11 |
# File 'lib/ruby_conversations/message_input.rb', line 9 def created_at @created_at end |
#id ⇒ Object
Define attributes
9 10 11 |
# File 'lib/ruby_conversations/message_input.rb', line 9 def id @id end |
#message_prompt ⇒ Object
Returns the value of attribute message_prompt.
12 13 14 |
# File 'lib/ruby_conversations/message_input.rb', line 12 def @message_prompt end |
#message_prompt_id ⇒ Object
Define attributes
9 10 11 |
# File 'lib/ruby_conversations/message_input.rb', line 9 def @message_prompt_id end |
#placeholder_name ⇒ Object
Define attributes
9 10 11 |
# File 'lib/ruby_conversations/message_input.rb', line 9 def placeholder_name @placeholder_name end |
#updated_at ⇒ Object
Define attributes
9 10 11 |
# File 'lib/ruby_conversations/message_input.rb', line 9 def updated_at @updated_at end |
#value ⇒ Object
Define attributes
9 10 11 |
# File 'lib/ruby_conversations/message_input.rb', line 9 def value @value end |
Class Method Details
.all ⇒ Object
31 32 33 |
# File 'lib/ruby_conversations/message_input.rb', line 31 def self.all @all ||= [] end |
.ordered ⇒ Object
Scopes
27 28 29 |
# File 'lib/ruby_conversations/message_input.rb', line 27 def self.ordered all.sort_by(&:placeholder_name) end |
Instance Method Details
#attributes ⇒ Object
Attributes method for serialization/logging
36 37 38 |
# File 'lib/ruby_conversations/message_input.rb', line 36 def attributes base_attributes end |
#attributes_for_api ⇒ Object
Method for API serialization
41 42 43 44 45 46 47 |
# File 'lib/ruby_conversations/message_input.rb', line 41 def attributes_for_api { id: id, placeholder_name: placeholder_name, value: value }.compact end |