Class: SlackWebApi::ObjsUserProfileShort

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

Overview

ObjsUserProfileShort 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(avatar_hash:, display_name:, first_name:, image_72:, is_restricted:, is_ultra_restricted:, name:, real_name:, team:, display_name_normalized: SKIP, real_name_normalized: SKIP, additional_properties: nil) ⇒ ObjsUserProfileShort

Returns a new instance of ObjsUserProfileShort.



88
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/objs_user_profile_short.rb', line 88

def initialize(avatar_hash:, display_name:, first_name:, image_72:,
               is_restricted:, is_ultra_restricted:, name:, real_name:,
               team:, display_name_normalized: SKIP,
               real_name_normalized: SKIP, additional_properties: nil)
  # Add additional model properties to the instance

  additional_properties = {} if additional_properties.nil?

  @avatar_hash = avatar_hash
  @display_name = display_name
  @display_name_normalized = display_name_normalized unless display_name_normalized == SKIP
  @first_name = first_name
  @image_72 = image_72
  @is_restricted = is_restricted
  @is_ultra_restricted = is_ultra_restricted
  @name = name
  @real_name = real_name
  @real_name_normalized = real_name_normalized unless real_name_normalized == SKIP
  @team = team
  @additional_properties = additional_properties
end

Instance Attribute Details

#avatar_hashString

TODO: Write general description for this method

Returns:

  • (String)


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

def avatar_hash
  @avatar_hash
end

#display_nameString

TODO: Write general description for this method

Returns:

  • (String)


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

def display_name
  @display_name
end

#display_name_normalizedString

TODO: Write general description for this method

Returns:

  • (String)


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

def display_name_normalized
  @display_name_normalized
end

#first_nameString

TODO: Write general description for this method

Returns:

  • (String)


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

def first_name
  @first_name
end

#image_72String

TODO: Write general description for this method

Returns:

  • (String)


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

def image_72
  @image_72
end

#is_restrictedTrueClass | FalseClass

TODO: Write general description for this method

Returns:

  • (TrueClass | FalseClass)


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

def is_restricted
  @is_restricted
end

#is_ultra_restrictedTrueClass | FalseClass

TODO: Write general description for this method

Returns:

  • (TrueClass | FalseClass)


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

def is_ultra_restricted
  @is_ultra_restricted
end

#nameString

TODO: Write general description for this method

Returns:

  • (String)


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

def name
  @name
end

#real_nameString

TODO: Write general description for this method

Returns:

  • (String)


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

def real_name
  @real_name
end

#real_name_normalizedString

TODO: Write general description for this method

Returns:

  • (String)


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

def real_name_normalized
  @real_name_normalized
end

#teamString

TODO: Write general description for this method

Returns:

  • (String)


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

def team
  @team
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
# File 'lib/slack_web_api/models/objs_user_profile_short.rb', line 110

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.

  avatar_hash = hash.key?('avatar_hash') ? hash['avatar_hash'] : nil
  display_name = hash.key?('display_name') ? hash['display_name'] : nil
  first_name = hash.key?('first_name') ? hash['first_name'] : nil
  image_72 = hash.key?('image_72') ? hash['image_72'] : nil
  is_restricted = hash.key?('is_restricted') ? hash['is_restricted'] : nil
  is_ultra_restricted =
    hash.key?('is_ultra_restricted') ? hash['is_ultra_restricted'] : nil
  name = hash.key?('name') ? hash['name'] : nil
  real_name = hash.key?('real_name') ? hash['real_name'] : nil
  team = hash.key?('team') ? hash['team'] : nil
  display_name_normalized =
    hash.key?('display_name_normalized') ? hash['display_name_normalized'] : SKIP
  real_name_normalized =
    hash.key?('real_name_normalized') ? hash['real_name_normalized'] : 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.

  ObjsUserProfileShort.new(avatar_hash: avatar_hash,
                           display_name: display_name,
                           first_name: first_name,
                           image_72: image_72,
                           is_restricted: is_restricted,
                           is_ultra_restricted: is_ultra_restricted,
                           name: name,
                           real_name: real_name,
                           team: team,
                           display_name_normalized: display_name_normalized,
                           real_name_normalized: real_name_normalized,
                           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/objs_user_profile_short.rb', line 57

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['avatar_hash'] = 'avatar_hash'
  @_hash['display_name'] = 'display_name'
  @_hash['display_name_normalized'] = 'display_name_normalized'
  @_hash['first_name'] = 'first_name'
  @_hash['image_72'] = 'image_72'
  @_hash['is_restricted'] = 'is_restricted'
  @_hash['is_ultra_restricted'] = 'is_ultra_restricted'
  @_hash['name'] = 'name'
  @_hash['real_name'] = 'real_name'
  @_hash['real_name_normalized'] = 'real_name_normalized'
  @_hash['team'] = 'team'
  @_hash
end

.nullablesObject

An array for nullable fields



82
83
84
85
86
# File 'lib/slack_web_api/models/objs_user_profile_short.rb', line 82

def self.nullables
  %w[
    first_name
  ]
end

.optionalsObject

An array for optional fields



74
75
76
77
78
79
# File 'lib/slack_web_api/models/objs_user_profile_short.rb', line 74

def self.optionals
  %w[
    display_name_normalized
    real_name_normalized
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



163
164
165
166
167
168
169
170
171
172
# File 'lib/slack_web_api/models/objs_user_profile_short.rb', line 163

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} avatar_hash: #{@avatar_hash.inspect}, display_name:"\
  " #{@display_name.inspect}, display_name_normalized: #{@display_name_normalized.inspect},"\
  " first_name: #{@first_name.inspect}, image_72: #{@image_72.inspect}, is_restricted:"\
  " #{@is_restricted.inspect}, is_ultra_restricted: #{@is_ultra_restricted.inspect}, name:"\
  " #{@name.inspect}, real_name: #{@real_name.inspect}, real_name_normalized:"\
  " #{@real_name_normalized.inspect}, team: #{@team.inspect}, additional_properties:"\
  " #{@additional_properties}>"
end

#to_sObject

Provides a human-readable string representation of the object.



152
153
154
155
156
157
158
159
160
# File 'lib/slack_web_api/models/objs_user_profile_short.rb', line 152

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} avatar_hash: #{@avatar_hash}, display_name: #{@display_name},"\
  " display_name_normalized: #{@display_name_normalized}, first_name: #{@first_name},"\
  " image_72: #{@image_72}, is_restricted: #{@is_restricted}, is_ultra_restricted:"\
  " #{@is_ultra_restricted}, name: #{@name}, real_name: #{@real_name}, real_name_normalized:"\
  " #{@real_name_normalized}, team: #{@team}, additional_properties:"\
  " #{@additional_properties}>"
end