Class: SlackWebApi::ChannelObject

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/slack_web_api/models/channel_object.rb

Overview

ChannelObject Model.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseModel

#check_for_conflict, #process_additional_properties, #process_array, #process_basic_value, #process_hash, #to_hash, #to_json

Constructor Details

#initialize(created:, creator:, id:, is_channel:, is_mpim:, is_org_shared:, is_private:, is_shared:, members:, name:, name_normalized:, purpose:, topic:, accepted_user: SKIP, is_archived: SKIP, is_frozen: SKIP, is_general: SKIP, is_member: SKIP, is_moved: SKIP, is_non_threadable: SKIP, is_pending_ext_shared: SKIP, is_read_only: SKIP, is_thread_only: SKIP, last_read: SKIP, latest: SKIP, num_members: SKIP, pending_shared: SKIP, previous_names: SKIP, priority: SKIP, unlinked: SKIP, unread_count: SKIP, unread_count_display: SKIP, additional_properties: nil) ⇒ ChannelObject

Returns a new instance of ChannelObject.



208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
# File 'lib/slack_web_api/models/channel_object.rb', line 208

def initialize(created:, creator:, id:, is_channel:, is_mpim:,
               is_org_shared:, is_private:, is_shared:, members:, name:,
               name_normalized:, purpose:, topic:, accepted_user: SKIP,
               is_archived: SKIP, is_frozen: SKIP, is_general: SKIP,
               is_member: SKIP, is_moved: SKIP, is_non_threadable: SKIP,
               is_pending_ext_shared: SKIP, is_read_only: SKIP,
               is_thread_only: SKIP, last_read: SKIP, latest: SKIP,
               num_members: SKIP, pending_shared: SKIP,
               previous_names: SKIP, priority: SKIP, unlinked: SKIP,
               unread_count: SKIP, unread_count_display: SKIP,
               additional_properties: nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @accepted_user = accepted_user unless accepted_user == SKIP
  @created = created
  @creator = creator
  @id = id
  @is_archived = is_archived unless is_archived == SKIP
  @is_channel = is_channel
  @is_frozen = is_frozen unless is_frozen == SKIP
  @is_general = is_general unless is_general == SKIP
  @is_member = is_member unless is_member == SKIP
  @is_moved = is_moved unless is_moved == SKIP
  @is_mpim = is_mpim
  @is_non_threadable = is_non_threadable unless is_non_threadable == SKIP
  @is_org_shared = is_org_shared
  @is_pending_ext_shared = is_pending_ext_shared unless is_pending_ext_shared == SKIP
  @is_private = is_private
  @is_read_only = is_read_only unless is_read_only == SKIP
  @is_shared = is_shared
  @is_thread_only = is_thread_only unless is_thread_only == SKIP
  @last_read = last_read unless last_read == SKIP
  @latest = latest unless latest == SKIP
  @members = members
  @name = name
  @name_normalized = name_normalized
  @num_members = num_members unless num_members == SKIP
  @pending_shared = pending_shared unless pending_shared == SKIP
  @previous_names = previous_names unless previous_names == SKIP
  @priority = priority unless priority == SKIP
  @purpose = purpose
  @topic = topic
  @unlinked = unlinked unless unlinked == SKIP
  @unread_count = unread_count unless unread_count == SKIP
  @unread_count_display = unread_count_display unless unread_count_display == SKIP
  @additional_properties = additional_properties
end

Instance Attribute Details

#accepted_userString

TODO: Write general description for this method

Returns:

  • (String)


14
15
16
# File 'lib/slack_web_api/models/channel_object.rb', line 14

def accepted_user
  @accepted_user
end

#createdInteger

TODO: Write general description for this method

Returns:

  • (Integer)


18
19
20
# File 'lib/slack_web_api/models/channel_object.rb', line 18

def created
  @created
end

#creatorString

TODO: Write general description for this method

Returns:

  • (String)


22
23
24
# File 'lib/slack_web_api/models/channel_object.rb', line 22

def creator
  @creator
end

#idString

TODO: Write general description for this method

Returns:

  • (String)


26
27
28
# File 'lib/slack_web_api/models/channel_object.rb', line 26

def id
  @id
end

#is_archivedTrueClass | FalseClass

TODO: Write general description for this method

Returns:

  • (TrueClass | FalseClass)


30
31
32
# File 'lib/slack_web_api/models/channel_object.rb', line 30

def is_archived
  @is_archived
end

#is_channelTrueClass | FalseClass

TODO: Write general description for this method

Returns:

  • (TrueClass | FalseClass)


34
35
36
# File 'lib/slack_web_api/models/channel_object.rb', line 34

def is_channel
  @is_channel
end

#is_frozenTrueClass | FalseClass

TODO: Write general description for this method

Returns:

  • (TrueClass | FalseClass)


38
39
40
# File 'lib/slack_web_api/models/channel_object.rb', line 38

def is_frozen
  @is_frozen
end

#is_generalTrueClass | FalseClass

TODO: Write general description for this method

Returns:

  • (TrueClass | FalseClass)


42
43
44
# File 'lib/slack_web_api/models/channel_object.rb', line 42

def is_general
  @is_general
end

#is_memberTrueClass | FalseClass

TODO: Write general description for this method

Returns:

  • (TrueClass | FalseClass)


46
47
48
# File 'lib/slack_web_api/models/channel_object.rb', line 46

def is_member
  @is_member
end

#is_movedInteger

TODO: Write general description for this method

Returns:

  • (Integer)


50
51
52
# File 'lib/slack_web_api/models/channel_object.rb', line 50

def is_moved
  @is_moved
end

#is_mpimTrueClass | FalseClass

TODO: Write general description for this method

Returns:

  • (TrueClass | FalseClass)


54
55
56
# File 'lib/slack_web_api/models/channel_object.rb', line 54

def is_mpim
  @is_mpim
end

#is_non_threadableTrueClass | FalseClass

TODO: Write general description for this method

Returns:

  • (TrueClass | FalseClass)


58
59
60
# File 'lib/slack_web_api/models/channel_object.rb', line 58

def is_non_threadable
  @is_non_threadable
end

#is_org_sharedTrueClass | FalseClass

TODO: Write general description for this method

Returns:

  • (TrueClass | FalseClass)


62
63
64
# File 'lib/slack_web_api/models/channel_object.rb', line 62

def is_org_shared
  @is_org_shared
end

#is_pending_ext_sharedTrueClass | FalseClass

TODO: Write general description for this method

Returns:

  • (TrueClass | FalseClass)


66
67
68
# File 'lib/slack_web_api/models/channel_object.rb', line 66

def is_pending_ext_shared
  @is_pending_ext_shared
end

#is_privateTrueClass | FalseClass

TODO: Write general description for this method

Returns:

  • (TrueClass | FalseClass)


70
71
72
# File 'lib/slack_web_api/models/channel_object.rb', line 70

def is_private
  @is_private
end

#is_read_onlyTrueClass | FalseClass

TODO: Write general description for this method

Returns:

  • (TrueClass | FalseClass)


74
75
76
# File 'lib/slack_web_api/models/channel_object.rb', line 74

def is_read_only
  @is_read_only
end

#is_sharedTrueClass | FalseClass

TODO: Write general description for this method

Returns:

  • (TrueClass | FalseClass)


78
79
80
# File 'lib/slack_web_api/models/channel_object.rb', line 78

def is_shared
  @is_shared
end

#is_thread_onlyTrueClass | FalseClass

TODO: Write general description for this method

Returns:

  • (TrueClass | FalseClass)


82
83
84
# File 'lib/slack_web_api/models/channel_object.rb', line 82

def is_thread_only
  @is_thread_only
end

#last_readString

TODO: Write general description for this method

Returns:

  • (String)


86
87
88
# File 'lib/slack_web_api/models/channel_object.rb', line 86

def last_read
  @last_read
end

#latestObject

TODO: Write general description for this method

Returns:

  • (Object)


90
91
92
# File 'lib/slack_web_api/models/channel_object.rb', line 90

def latest
  @latest
end

#membersArray[String]

TODO: Write general description for this method

Returns:

  • (Array[String])


94
95
96
# File 'lib/slack_web_api/models/channel_object.rb', line 94

def members
  @members
end

#nameString

TODO: Write general description for this method

Returns:

  • (String)


98
99
100
# File 'lib/slack_web_api/models/channel_object.rb', line 98

def name
  @name
end

#name_normalizedString

TODO: Write general description for this method

Returns:

  • (String)


102
103
104
# File 'lib/slack_web_api/models/channel_object.rb', line 102

def name_normalized
  @name_normalized
end

#num_membersInteger

TODO: Write general description for this method

Returns:

  • (Integer)


106
107
108
# File 'lib/slack_web_api/models/channel_object.rb', line 106

def num_members
  @num_members
end

#pending_sharedArray[String]

TODO: Write general description for this method

Returns:

  • (Array[String])


110
111
112
# File 'lib/slack_web_api/models/channel_object.rb', line 110

def pending_shared
  @pending_shared
end

#previous_namesArray[String]

TODO: Write general description for this method

Returns:

  • (Array[String])


114
115
116
# File 'lib/slack_web_api/models/channel_object.rb', line 114

def previous_names
  @previous_names
end

#priorityFloat

TODO: Write general description for this method

Returns:

  • (Float)


118
119
120
# File 'lib/slack_web_api/models/channel_object.rb', line 118

def priority
  @priority
end

#purposePurpose

TODO: Write general description for this method

Returns:



122
123
124
# File 'lib/slack_web_api/models/channel_object.rb', line 122

def purpose
  @purpose
end

#topicTopic

TODO: Write general description for this method

Returns:



126
127
128
# File 'lib/slack_web_api/models/channel_object.rb', line 126

def topic
  @topic
end

#unlinkedInteger

TODO: Write general description for this method

Returns:

  • (Integer)


130
131
132
# File 'lib/slack_web_api/models/channel_object.rb', line 130

def unlinked
  @unlinked
end

#unread_countInteger

TODO: Write general description for this method

Returns:

  • (Integer)


134
135
136
# File 'lib/slack_web_api/models/channel_object.rb', line 134

def unread_count
  @unread_count
end

#unread_count_displayInteger

TODO: Write general description for this method

Returns:

  • (Integer)


138
139
140
# File 'lib/slack_web_api/models/channel_object.rb', line 138

def unread_count_display
  @unread_count_display
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
# File 'lib/slack_web_api/models/channel_object.rb', line 258

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  created = hash.key?('created') ? hash['created'] : nil
  creator = hash.key?('creator') ? hash['creator'] : nil
  id = hash.key?('id') ? hash['id'] : nil
  is_channel = hash.key?('is_channel') ? hash['is_channel'] : nil
  is_mpim = hash.key?('is_mpim') ? hash['is_mpim'] : nil
  is_org_shared = hash.key?('is_org_shared') ? hash['is_org_shared'] : nil
  is_private = hash.key?('is_private') ? hash['is_private'] : nil
  is_shared = hash.key?('is_shared') ? hash['is_shared'] : nil
  members = hash.key?('members') ? hash['members'] : nil
  name = hash.key?('name') ? hash['name'] : nil
  name_normalized =
    hash.key?('name_normalized') ? hash['name_normalized'] : nil
  purpose = Purpose.from_hash(hash['purpose']) if hash['purpose']
  topic = Topic.from_hash(hash['topic']) if hash['topic']
  accepted_user = hash.key?('accepted_user') ? hash['accepted_user'] : SKIP
  is_archived = hash.key?('is_archived') ? hash['is_archived'] : SKIP
  is_frozen = hash.key?('is_frozen') ? hash['is_frozen'] : SKIP
  is_general = hash.key?('is_general') ? hash['is_general'] : SKIP
  is_member = hash.key?('is_member') ? hash['is_member'] : SKIP
  is_moved = hash.key?('is_moved') ? hash['is_moved'] : SKIP
  is_non_threadable =
    hash.key?('is_non_threadable') ? hash['is_non_threadable'] : SKIP
  is_pending_ext_shared =
    hash.key?('is_pending_ext_shared') ? hash['is_pending_ext_shared'] : SKIP
  is_read_only = hash.key?('is_read_only') ? hash['is_read_only'] : SKIP
  is_thread_only =
    hash.key?('is_thread_only') ? hash['is_thread_only'] : SKIP
  last_read = hash.key?('last_read') ? hash['last_read'] : SKIP
  latest = hash.key?('latest') ? hash['latest'] : SKIP
  num_members = hash.key?('num_members') ? hash['num_members'] : SKIP
  pending_shared =
    hash.key?('pending_shared') ? hash['pending_shared'] : SKIP
  previous_names =
    hash.key?('previous_names') ? hash['previous_names'] : SKIP
  priority = hash.key?('priority') ? hash['priority'] : SKIP
  unlinked = hash.key?('unlinked') ? hash['unlinked'] : SKIP
  unread_count = hash.key?('unread_count') ? hash['unread_count'] : SKIP
  unread_count_display =
    hash.key?('unread_count_display') ? hash['unread_count_display'] : SKIP

  # Create a new hash for additional properties, removing known properties.
  new_hash = hash.reject { |k, _| names.value?(k) }

  additional_properties = APIHelper.get_additional_properties(
    new_hash, proc { |value| value }
  )

  # Create object from extracted values.
  ChannelObject.new(created: created,
                    creator: creator,
                    id: id,
                    is_channel: is_channel,
                    is_mpim: is_mpim,
                    is_org_shared: is_org_shared,
                    is_private: is_private,
                    is_shared: is_shared,
                    members: members,
                    name: name,
                    name_normalized: name_normalized,
                    purpose: purpose,
                    topic: topic,
                    accepted_user: accepted_user,
                    is_archived: is_archived,
                    is_frozen: is_frozen,
                    is_general: is_general,
                    is_member: is_member,
                    is_moved: is_moved,
                    is_non_threadable: is_non_threadable,
                    is_pending_ext_shared: is_pending_ext_shared,
                    is_read_only: is_read_only,
                    is_thread_only: is_thread_only,
                    last_read: last_read,
                    latest: latest,
                    num_members: num_members,
                    pending_shared: pending_shared,
                    previous_names: previous_names,
                    priority: priority,
                    unlinked: unlinked,
                    unread_count: unread_count,
                    unread_count_display: unread_count_display,
                    additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
# File 'lib/slack_web_api/models/channel_object.rb', line 141

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['accepted_user'] = 'accepted_user'
  @_hash['created'] = 'created'
  @_hash['creator'] = 'creator'
  @_hash['id'] = 'id'
  @_hash['is_archived'] = 'is_archived'
  @_hash['is_channel'] = 'is_channel'
  @_hash['is_frozen'] = 'is_frozen'
  @_hash['is_general'] = 'is_general'
  @_hash['is_member'] = 'is_member'
  @_hash['is_moved'] = 'is_moved'
  @_hash['is_mpim'] = 'is_mpim'
  @_hash['is_non_threadable'] = 'is_non_threadable'
  @_hash['is_org_shared'] = 'is_org_shared'
  @_hash['is_pending_ext_shared'] = 'is_pending_ext_shared'
  @_hash['is_private'] = 'is_private'
  @_hash['is_read_only'] = 'is_read_only'
  @_hash['is_shared'] = 'is_shared'
  @_hash['is_thread_only'] = 'is_thread_only'
  @_hash['last_read'] = 'last_read'
  @_hash['latest'] = 'latest'
  @_hash['members'] = 'members'
  @_hash['name'] = 'name'
  @_hash['name_normalized'] = 'name_normalized'
  @_hash['num_members'] = 'num_members'
  @_hash['pending_shared'] = 'pending_shared'
  @_hash['previous_names'] = 'previous_names'
  @_hash['priority'] = 'priority'
  @_hash['purpose'] = 'purpose'
  @_hash['topic'] = 'topic'
  @_hash['unlinked'] = 'unlinked'
  @_hash['unread_count'] = 'unread_count'
  @_hash['unread_count_display'] = 'unread_count_display'
  @_hash
end

.nullablesObject

An array for nullable fields



204
205
206
# File 'lib/slack_web_api/models/channel_object.rb', line 204

def self.nullables
  []
end

.optionalsObject

An array for optional fields



179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
# File 'lib/slack_web_api/models/channel_object.rb', line 179

def self.optionals
  %w[
    accepted_user
    is_archived
    is_frozen
    is_general
    is_member
    is_moved
    is_non_threadable
    is_pending_ext_shared
    is_read_only
    is_thread_only
    last_read
    latest
    num_members
    pending_shared
    previous_names
    priority
    unlinked
    unread_count
    unread_count_display
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
# File 'lib/slack_web_api/models/channel_object.rb', line 363

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} accepted_user: #{@accepted_user.inspect}, created: #{@created.inspect},"\
  " creator: #{@creator.inspect}, id: #{@id.inspect}, is_archived: #{@is_archived.inspect},"\
  " is_channel: #{@is_channel.inspect}, is_frozen: #{@is_frozen.inspect}, is_general:"\
  " #{@is_general.inspect}, is_member: #{@is_member.inspect}, is_moved: #{@is_moved.inspect},"\
  " is_mpim: #{@is_mpim.inspect}, is_non_threadable: #{@is_non_threadable.inspect},"\
  " is_org_shared: #{@is_org_shared.inspect}, is_pending_ext_shared:"\
  " #{@is_pending_ext_shared.inspect}, is_private: #{@is_private.inspect}, is_read_only:"\
  " #{@is_read_only.inspect}, is_shared: #{@is_shared.inspect}, is_thread_only:"\
  " #{@is_thread_only.inspect}, last_read: #{@last_read.inspect}, latest: #{@latest.inspect},"\
  " members: #{@members.inspect}, name: #{@name.inspect}, name_normalized:"\
  " #{@name_normalized.inspect}, num_members: #{@num_members.inspect}, pending_shared:"\
  " #{@pending_shared.inspect}, previous_names: #{@previous_names.inspect}, priority:"\
  " #{@priority.inspect}, purpose: #{@purpose.inspect}, topic: #{@topic.inspect}, unlinked:"\
  " #{@unlinked.inspect}, unread_count: #{@unread_count.inspect}, unread_count_display:"\
  " #{@unread_count_display.inspect}, additional_properties: #{@additional_properties}>"
end

#to_sObject

Provides a human-readable string representation of the object.



346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
# File 'lib/slack_web_api/models/channel_object.rb', line 346

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} accepted_user: #{@accepted_user}, created: #{@created}, creator:"\
  " #{@creator}, id: #{@id}, is_archived: #{@is_archived}, is_channel: #{@is_channel},"\
  " is_frozen: #{@is_frozen}, is_general: #{@is_general}, is_member: #{@is_member}, is_moved:"\
  " #{@is_moved}, is_mpim: #{@is_mpim}, is_non_threadable: #{@is_non_threadable},"\
  " is_org_shared: #{@is_org_shared}, is_pending_ext_shared: #{@is_pending_ext_shared},"\
  " is_private: #{@is_private}, is_read_only: #{@is_read_only}, is_shared: #{@is_shared},"\
  " is_thread_only: #{@is_thread_only}, last_read: #{@last_read}, latest: #{@latest}, members:"\
  " #{@members}, name: #{@name}, name_normalized: #{@name_normalized}, num_members:"\
  " #{@num_members}, pending_shared: #{@pending_shared}, previous_names: #{@previous_names},"\
  " priority: #{@priority}, purpose: #{@purpose}, topic: #{@topic}, unlinked: #{@unlinked},"\
  " unread_count: #{@unread_count}, unread_count_display: #{@unread_count_display},"\
  " additional_properties: #{@additional_properties}>"
end