Class: SlackWebApi::Info

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

Overview

Info 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(app_home:, channel:, group:, im:, mpim:, team:, additional_properties: nil) ⇒ Info

Returns a new instance of Info.



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

def initialize(app_home:, channel:, group:, im:, mpim:, team:,
               additional_properties: nil)
  # Add additional model properties to the instance

  additional_properties = {} if additional_properties.nil?

  @app_home = app_home
  @channel = channel
  @group = group
  @im = im
  @mpim = mpim
  @team = team
  @additional_properties = additional_properties
end

Instance Attribute Details

#app_homeAppHome

TODO: Write general description for this method

Returns:



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

def app_home
  @app_home
end

#channelChannel

TODO: Write general description for this method

Returns:



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

def channel
  @channel
end

#groupGroup

TODO: Write general description for this method

Returns:



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

def group
  @group
end

#imIm

TODO: Write general description for this method

Returns:



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

def im
  @im
end

#mpimMpim

TODO: Write general description for this method

Returns:



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

def mpim
  @mpim
end

#teamTeam

TODO: Write general description for this method

Returns:



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

def team
  @team
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
# File 'lib/slack_web_api/models/info.rb', line 73

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.

  app_home = AppHome.from_hash(hash['app_home']) if hash['app_home']
  channel = Channel.from_hash(hash['channel']) if hash['channel']
  group = Group.from_hash(hash['group']) if hash['group']
  im = Im.from_hash(hash['im']) if hash['im']
  mpim = Mpim.from_hash(hash['mpim']) if hash['mpim']
  team = Team.from_hash(hash['team']) if hash['team']

  # 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.

  Info.new(app_home: app_home,
           channel: channel,
           group: group,
           im: im,
           mpim: mpim,
           team: team,
           additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



37
38
39
40
41
42
43
44
45
46
# File 'lib/slack_web_api/models/info.rb', line 37

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['app_home'] = 'app_home'
  @_hash['channel'] = 'channel'
  @_hash['group'] = 'group'
  @_hash['im'] = 'im'
  @_hash['mpim'] = 'mpim'
  @_hash['team'] = 'team'
  @_hash
end

.nullablesObject

An array for nullable fields



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

def self.nullables
  []
end

.optionalsObject

An array for optional fields



49
50
51
# File 'lib/slack_web_api/models/info.rb', line 49

def self.optionals
  []
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



109
110
111
112
113
114
# File 'lib/slack_web_api/models/info.rb', line 109

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} app_home: #{@app_home.inspect}, channel: #{@channel.inspect}, group:"\
  " #{@group.inspect}, im: #{@im.inspect}, mpim: #{@mpim.inspect}, team: #{@team.inspect},"\
  " additional_properties: #{@additional_properties}>"
end

#to_sObject

Provides a human-readable string representation of the object.



102
103
104
105
106
# File 'lib/slack_web_api/models/info.rb', line 102

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} app_home: #{@app_home}, channel: #{@channel}, group: #{@group}, im: #{@im},"\
  " mpim: #{@mpim}, team: #{@team}, additional_properties: #{@additional_properties}>"
end