Class: SlackWebApi::FileCommentObject

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

Overview

FileCommentObject 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(comment:, created:, id:, is_intro:, timestamp:, user:, is_starred: SKIP, num_stars: SKIP, pinned_info: SKIP, pinned_to: SKIP, reactions: SKIP, additional_properties: nil) ⇒ FileCommentObject

Returns a new instance of FileCommentObject.



89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
# File 'lib/slack_web_api/models/file_comment_object.rb', line 89

def initialize(comment:, created:, id:, is_intro:, timestamp:, user:,
               is_starred: SKIP, num_stars: SKIP, pinned_info: SKIP,
               pinned_to: SKIP, reactions: SKIP, additional_properties: nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @comment = comment
  @created = created
  @id = id
  @is_intro = is_intro
  @is_starred = is_starred unless is_starred == SKIP
  @num_stars = num_stars unless num_stars == SKIP
  @pinned_info = pinned_info unless pinned_info == SKIP
  @pinned_to = pinned_to unless pinned_to == SKIP
  @reactions = reactions unless reactions == SKIP
  @timestamp = timestamp
  @user = user
  @additional_properties = additional_properties
end

Instance Attribute Details

#commentString

TODO: Write general description for this method

Returns:

  • (String)


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

def comment
  @comment
end

#createdInteger

TODO: Write general description for this method

Returns:

  • (Integer)


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

def created
  @created
end

#idString

TODO: Write general description for this method

Returns:

  • (String)


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

def id
  @id
end

#is_introTrueClass | FalseClass

TODO: Write general description for this method

Returns:

  • (TrueClass | FalseClass)


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

def is_intro
  @is_intro
end

#is_starredTrueClass | FalseClass

TODO: Write general description for this method

Returns:

  • (TrueClass | FalseClass)


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

def is_starred
  @is_starred
end

#num_starsInteger

TODO: Write general description for this method

Returns:

  • (Integer)


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

def num_stars
  @num_stars
end

#pinned_infoObject

TODO: Write general description for this method

Returns:

  • (Object)


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

def pinned_info
  @pinned_info
end

#pinned_toArray[String]

TODO: Write general description for this method

Returns:

  • (Array[String])


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

def pinned_to
  @pinned_to
end

#reactionsArray[ReactionObject]

TODO: Write general description for this method

Returns:



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

def reactions
  @reactions
end

#timestampInteger

TODO: Write general description for this method

Returns:

  • (Integer)


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

def timestamp
  @timestamp
end

#userString

TODO: Write general description for this method

Returns:

  • (String)


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

def user
  @user
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
# File 'lib/slack_web_api/models/file_comment_object.rb', line 110

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  comment = hash.key?('comment') ? hash['comment'] : nil
  created = hash.key?('created') ? hash['created'] : nil
  id = hash.key?('id') ? hash['id'] : nil
  is_intro = hash.key?('is_intro') ? hash['is_intro'] : nil
  timestamp = hash.key?('timestamp') ? hash['timestamp'] : nil
  user = hash.key?('user') ? hash['user'] : nil
  is_starred = hash.key?('is_starred') ? hash['is_starred'] : SKIP
  num_stars = hash.key?('num_stars') ? hash['num_stars'] : SKIP
  pinned_info = hash.key?('pinned_info') ? hash['pinned_info'] : SKIP
  pinned_to = hash.key?('pinned_to') ? hash['pinned_to'] : SKIP
  # Parameter is an array, so we need to iterate through it
  reactions = nil
  unless hash['reactions'].nil?
    reactions = []
    hash['reactions'].each do |structure|
      reactions << (ReactionObject.from_hash(structure) if structure)
    end
  end

  reactions = SKIP unless hash.key?('reactions')

  # 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.
  FileCommentObject.new(comment: comment,
                        created: created,
                        id: id,
                        is_intro: is_intro,
                        timestamp: timestamp,
                        user: user,
                        is_starred: is_starred,
                        num_stars: num_stars,
                        pinned_info: pinned_info,
                        pinned_to: pinned_to,
                        reactions: reactions,
                        additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
# File 'lib/slack_web_api/models/file_comment_object.rb', line 57

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['comment'] = 'comment'
  @_hash['created'] = 'created'
  @_hash['id'] = 'id'
  @_hash['is_intro'] = 'is_intro'
  @_hash['is_starred'] = 'is_starred'
  @_hash['num_stars'] = 'num_stars'
  @_hash['pinned_info'] = 'pinned_info'
  @_hash['pinned_to'] = 'pinned_to'
  @_hash['reactions'] = 'reactions'
  @_hash['timestamp'] = 'timestamp'
  @_hash['user'] = 'user'
  @_hash
end

.nullablesObject

An array for nullable fields



85
86
87
# File 'lib/slack_web_api/models/file_comment_object.rb', line 85

def self.nullables
  []
end

.optionalsObject

An array for optional fields



74
75
76
77
78
79
80
81
82
# File 'lib/slack_web_api/models/file_comment_object.rb', line 74

def self.optionals
  %w[
    is_starred
    num_stars
    pinned_info
    pinned_to
    reactions
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



167
168
169
170
171
172
173
174
# File 'lib/slack_web_api/models/file_comment_object.rb', line 167

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} comment: #{@comment.inspect}, created: #{@created.inspect}, id:"\
  " #{@id.inspect}, is_intro: #{@is_intro.inspect}, is_starred: #{@is_starred.inspect},"\
  " num_stars: #{@num_stars.inspect}, pinned_info: #{@pinned_info.inspect}, pinned_to:"\
  " #{@pinned_to.inspect}, reactions: #{@reactions.inspect}, timestamp: #{@timestamp.inspect},"\
  " user: #{@user.inspect}, additional_properties: #{@additional_properties}>"
end

#to_sObject

Provides a human-readable string representation of the object.



158
159
160
161
162
163
164
# File 'lib/slack_web_api/models/file_comment_object.rb', line 158

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} comment: #{@comment}, created: #{@created}, id: #{@id}, is_intro:"\
  " #{@is_intro}, is_starred: #{@is_starred}, num_stars: #{@num_stars}, pinned_info:"\
  " #{@pinned_info}, pinned_to: #{@pinned_to}, reactions: #{@reactions}, timestamp:"\
  " #{@timestamp}, user: #{@user}, additional_properties: #{@additional_properties}>"
end