Class: Teams::Api::SentActivity
- Inherits:
-
Object
- Object
- Teams::Api::SentActivity
- Defined in:
- lib/teams/api/sent_activity.rb
Overview
Represents an activity that was sent: the outbound activity merged with the server response, so the server-assigned id is always available. Mirrors the SDKs' SentActivity.
Instance Attribute Summary collapse
-
#raw ⇒ Object
readonly
Returns the value of attribute raw.
Class Method Summary collapse
Instance Method Summary collapse
- #[](key) ⇒ Object
- #conversation_id ⇒ Object
- #id ⇒ Object
-
#initialize(raw = {}) ⇒ SentActivity
constructor
A new instance of SentActivity.
- #text ⇒ Object
- #to_h ⇒ Object
- #type ⇒ Object
Constructor Details
#initialize(raw = {}) ⇒ SentActivity
Returns a new instance of SentActivity.
19 20 21 |
# File 'lib/teams/api/sent_activity.rb', line 19 def initialize(raw = {}) @raw = raw end |
Instance Attribute Details
#raw ⇒ Object (readonly)
Returns the value of attribute raw.
9 10 11 |
# File 'lib/teams/api/sent_activity.rb', line 9 def raw @raw end |
Class Method Details
.merge(activity, response) ⇒ Object
11 12 13 14 15 16 17 |
# File 'lib/teams/api/sent_activity.rb', line 11 def self.merge(activity, response) activity_hash = activity.respond_to?(:to_h) ? activity.to_h : activity activity_hash = {} unless activity_hash.is_a?(Hash) response_hash = response.is_a?(Hash) ? response : {} new(activity_hash.merge(response_hash)) end |
Instance Method Details
#[](key) ⇒ Object
39 40 41 |
# File 'lib/teams/api/sent_activity.rb', line 39 def [](key) raw[key] end |
#conversation_id ⇒ Object
35 36 37 |
# File 'lib/teams/api/sent_activity.rb', line 35 def conversation_id raw.dig("conversation", "id") end |
#id ⇒ Object
23 24 25 |
# File 'lib/teams/api/sent_activity.rb', line 23 def id raw["id"] || raw[:id] end |
#text ⇒ Object
31 32 33 |
# File 'lib/teams/api/sent_activity.rb', line 31 def text raw["text"] end |
#to_h ⇒ Object
43 44 45 |
# File 'lib/teams/api/sent_activity.rb', line 43 def to_h raw.dup end |
#type ⇒ Object
27 28 29 |
# File 'lib/teams/api/sent_activity.rb', line 27 def type raw["type"] end |