Class: SlackWebApi::Scopes

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

Overview

Scopes 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: SKIP, channel: SKIP, group: SKIP, im: SKIP, mpim: SKIP, team: SKIP, user: SKIP, additional_properties: nil) ⇒ Scopes

Returns a new instance of Scopes.



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

def initialize(app_home: SKIP, channel: SKIP, group: SKIP, im: SKIP,
               mpim: SKIP, team: SKIP, user: SKIP,
               additional_properties: nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @app_home = app_home unless app_home == SKIP
  @channel = channel unless channel == SKIP
  @group = group unless group == SKIP
  @im = im unless im == SKIP
  @mpim = mpim unless mpim == SKIP
  @team = team unless team == SKIP
  @user = user unless user == SKIP
  @additional_properties = additional_properties
end

Instance Attribute Details

#app_homeArray[String]

TODO: Write general description for this method

Returns:

  • (Array[String])


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

def app_home
  @app_home
end

#channelArray[String]

TODO: Write general description for this method

Returns:

  • (Array[String])


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

def channel
  @channel
end

#groupArray[String]

TODO: Write general description for this method

Returns:

  • (Array[String])


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

def group
  @group
end

#imArray[String]

TODO: Write general description for this method

Returns:

  • (Array[String])


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

def im
  @im
end

#mpimArray[String]

TODO: Write general description for this method

Returns:

  • (Array[String])


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

def mpim
  @mpim
end

#teamArray[String]

TODO: Write general description for this method

Returns:

  • (Array[String])


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

def team
  @team
end

#userArray[String]

TODO: Write general description for this method

Returns:

  • (Array[String])


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

def user
  @user
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



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
115
116
# File 'lib/slack_web_api/models/scopes.rb', line 88

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  app_home = hash.key?('app_home') ? hash['app_home'] : SKIP
  channel = hash.key?('channel') ? hash['channel'] : SKIP
  group = hash.key?('group') ? hash['group'] : SKIP
  im = hash.key?('im') ? hash['im'] : SKIP
  mpim = hash.key?('mpim') ? hash['mpim'] : SKIP
  team = hash.key?('team') ? hash['team'] : SKIP
  user = hash.key?('user') ? hash['user'] : 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.
  Scopes.new(app_home: app_home,
             channel: channel,
             group: group,
             im: im,
             mpim: mpim,
             team: team,
             user: user,
             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/scopes.rb', line 41

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['user'] = 'user'
  @_hash
end

.nullablesObject

An array for nullable fields



67
68
69
# File 'lib/slack_web_api/models/scopes.rb', line 67

def self.nullables
  []
end

.optionalsObject

An array for optional fields



54
55
56
57
58
59
60
61
62
63
64
# File 'lib/slack_web_api/models/scopes.rb', line 54

def self.optionals
  %w[
    app_home
    channel
    group
    im
    mpim
    team
    user
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



127
128
129
130
131
132
# File 'lib/slack_web_api/models/scopes.rb', line 127

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},"\
  " user: #{@user.inspect}, additional_properties: #{@additional_properties}>"
end

#to_sObject

Provides a human-readable string representation of the object.



119
120
121
122
123
124
# File 'lib/slack_web_api/models/scopes.rb', line 119

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}, user: #{@user}, additional_properties:"\
  " #{@additional_properties}>"
end