Class: SlackWebApi::FilesInfoSchema

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

Overview

Schema for successful response from files.info method

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(comments:, file:, content_html: SKIP, editor: SKIP, paging: SKIP, response_metadata: SKIP, additional_properties: nil) ⇒ FilesInfoSchema

Returns a new instance of FilesInfoSchema.



70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
# File 'lib/slack_web_api/models/files_info_schema.rb', line 70

def initialize(comments:, file:, content_html: SKIP, editor: SKIP,
               paging: SKIP, response_metadata: SKIP,
               additional_properties: nil)
  # Add additional model properties to the instance

  additional_properties = {} if additional_properties.nil?

  @comments = comments
  @content_html = content_html unless content_html == SKIP
  @editor = editor unless editor == SKIP
  @file = file
  @ok = 'True'
  @paging = paging unless paging == SKIP
   =  unless  == SKIP
  @additional_properties = additional_properties
end

Instance Attribute Details

#commentsArray[Object]

TODO: Write general description for this method

Returns:

  • (Array[Object])


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

def comments
  @comments
end

#content_htmlString

TODO: Write general description for this method

Returns:

  • (String)


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

def content_html
  @content_html
end

#editorString

TODO: Write general description for this method

Returns:

  • (String)


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

def editor
  @editor
end

#fileFileObject

TODO: Write general description for this method

Returns:



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

def file
  @file
end

#okString (readonly)

TODO: Write general description for this method

Returns:

  • (String)


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

def ok
  @ok
end

#pagingPagingObject

TODO: Write general description for this method

Returns:



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

def paging
  @paging
end

#response_metadataObject

TODO: Write general description for this method

Returns:

  • (Object)


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

def 
  
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
# File 'lib/slack_web_api/models/files_info_schema.rb', line 87

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.

  comments = hash.key?('comments') ? hash['comments'] : nil
  file = FileObject.from_hash(hash['file']) if hash['file']
  content_html = hash.key?('content_html') ? hash['content_html'] : SKIP
  editor = hash.key?('editor') ? hash['editor'] : SKIP
  paging = PagingObject.from_hash(hash['paging']) if hash['paging']
   =
    hash.key?('response_metadata') ? hash['response_metadata'] : 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.

  FilesInfoSchema.new(comments: comments,
                      file: file,
                      content_html: content_html,
                      editor: editor,
                      paging: paging,
                      response_metadata: ,
                      additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



41
42
43
44
45
46
47
48
49
50
51
# File 'lib/slack_web_api/models/files_info_schema.rb', line 41

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['comments'] = 'comments'
  @_hash['content_html'] = 'content_html'
  @_hash['editor'] = 'editor'
  @_hash['file'] = 'file'
  @_hash['ok'] = 'ok'
  @_hash['paging'] = 'paging'
  @_hash['response_metadata'] = 'response_metadata'
  @_hash
end

.nullablesObject

An array for nullable fields



64
65
66
67
68
# File 'lib/slack_web_api/models/files_info_schema.rb', line 64

def self.nullables
  %w[
    content_html
  ]
end

.optionalsObject

An array for optional fields



54
55
56
57
58
59
60
61
# File 'lib/slack_web_api/models/files_info_schema.rb', line 54

def self.optionals
  %w[
    content_html
    editor
    paging
    response_metadata
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



125
126
127
128
129
130
131
# File 'lib/slack_web_api/models/files_info_schema.rb', line 125

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} comments: #{@comments.inspect}, content_html: #{@content_html.inspect},"\
  " editor: #{@editor.inspect}, file: #{@file.inspect}, ok: #{@ok.inspect}, paging:"\
  " #{@paging.inspect}, response_metadata: #{@response_metadata.inspect},"\
  " additional_properties: #{@additional_properties}>"
end

#to_sObject

Provides a human-readable string representation of the object.



117
118
119
120
121
122
# File 'lib/slack_web_api/models/files_info_schema.rb', line 117

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} comments: #{@comments}, content_html: #{@content_html}, editor: #{@editor},"\
  " file: #{@file}, ok: #{@ok}, paging: #{@paging}, response_metadata: #{@response_metadata},"\
  " additional_properties: #{@additional_properties}>"
end