Class: BotFramework::Activity

Inherits:
Base
  • Object
show all
Defined in:
lib/bot_framework/models/activity.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Base

#==, #_deserialize, #_to_hash, #as_json, attr_accessor, attribute_map, #attributes, #attributes_hash, #build_from_hash, #compact_attributes_hash, #eql?, #hash, #initialize, #list_invalid_properties, #to_body, #to_hash, #to_json, #to_s, #valid?

Constructor Details

This class inherits a constructor from BotFramework::Base

Instance Attribute Details

#actionObject

ContactAdded/Removed action



64
65
66
# File 'lib/bot_framework/models/activity.rb', line 64

def action
  @action
end

#attachment_layoutObject

AttachmentLayout - hint for how to deal with multiple attachments Values: [list|carousel] Default:list



31
32
33
# File 'lib/bot_framework/models/activity.rb', line 31

def attachment_layout
  @attachment_layout
end

#attachmentsObject

Attachments



55
56
57
# File 'lib/bot_framework/models/activity.rb', line 55

def attachments
  @attachments
end

#channel_dataObject

Channel specific payload



61
62
63
# File 'lib/bot_framework/models/activity.rb', line 61

def channel_data
  @channel_data
end

#channel_idObject

ChannelId the activity was on



16
17
18
# File 'lib/bot_framework/models/activity.rb', line 16

def channel_id
  @channel_id
end

#conversationObject

Conversation



22
23
24
# File 'lib/bot_framework/models/activity.rb', line 22

def conversation
  @conversation
end

#entitiesObject

Collection of Entity objects, each of which contains metadata about this activity. Each Entity object is typed.



58
59
60
# File 'lib/bot_framework/models/activity.rb', line 58

def entities
  @entities
end

#fromObject

Sender address



19
20
21
# File 'lib/bot_framework/models/activity.rb', line 19

def from
  @from
end

#history_disclosedObject

the previous history of the channel was disclosed



43
44
45
# File 'lib/bot_framework/models/activity.rb', line 43

def history_disclosed
  @history_disclosed
end

#idObject

Id for the activity



7
8
9
# File 'lib/bot_framework/models/activity.rb', line 7

def id
  @id
end

#localeObject

The language code of the Text field



46
47
48
# File 'lib/bot_framework/models/activity.rb', line 46

def locale
  @locale
end

#members_addedObject

Array of address added



34
35
36
# File 'lib/bot_framework/models/activity.rb', line 34

def members_added
  @members_added
end

#members_removedObject

Array of addresses removed



37
38
39
# File 'lib/bot_framework/models/activity.rb', line 37

def members_removed
  @members_removed
end

#recipientObject

(Outbound to bot only) Bot’s address that received the message



25
26
27
# File 'lib/bot_framework/models/activity.rb', line 25

def recipient
  @recipient
end

#reply_to_idObject

the original id this message is a response to



67
68
69
# File 'lib/bot_framework/models/activity.rb', line 67

def reply_to_id
  @reply_to_id
end

#service_urlObject

Service endpoint



13
14
15
# File 'lib/bot_framework/models/activity.rb', line 13

def service_url
  @service_url
end

#summaryObject

Text to display if you can’t render cards



52
53
54
# File 'lib/bot_framework/models/activity.rb', line 52

def summary
  @summary
end

#textObject

Content for the message



49
50
51
# File 'lib/bot_framework/models/activity.rb', line 49

def text
  @text
end

#text_formatObject

Format of text fields [plain|markdown] Default:markdown



28
29
30
# File 'lib/bot_framework/models/activity.rb', line 28

def text_format
  @text_format
end

#timestampObject

Time when message was sent



10
11
12
# File 'lib/bot_framework/models/activity.rb', line 10

def timestamp
  @timestamp
end

#topic_nameObject

Conversations new topic name



40
41
42
# File 'lib/bot_framework/models/activity.rb', line 40

def topic_name
  @topic_name
end

#typeObject

The type of the activity [message|contactRelationUpdate|converationUpdate|typing]



4
5
6
# File 'lib/bot_framework/models/activity.rb', line 4

def type
  @type
end

Class Method Details

.swagger_typesObject

Attribute type mapping.



70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
# File 'lib/bot_framework/models/activity.rb', line 70

def self.swagger_types
  {
    type: :String,
    id: :String,
    timestamp: :DateTime,
    service_url: :String,
    channel_id: :String,
    from: :ChannelAccount,
    conversation: :ConversationAccount,
    recipient: :ChannelAccount,
    text_format: :String,
    attachment_layout: :String,
    members_added: :'Array<ChannelAccount>',
    members_removed: :'Array<ChannelAccount>',
    topic_name: :String,
    history_disclosed: :BOOLEAN,
    locale: :String,
    text: :String,
    summary: :String,
    attachments: :'Array<Attachment>',
    entities: :'Array<Entity>',
    channel_data: :Object,
    action: :String,
    reply_to_id: :String
  }
end

Instance Method Details

#reply(message) ⇒ Object



97
98
99
100
101
102
103
104
# File 'lib/bot_framework/models/activity.rb', line 97

def reply(message)
  return false if type != 'message'
  new_activity = Activity.new(type: 'message',
                              locale: 'en',
                              text: message,
                              from: recipient.to_hash)
  Conversation.new(service_url).reply_to_activity(conversation.id, id, new_activity)
end