Class: SlackWebApi::Log

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

Overview

Log 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_id:, app_type:, change_type:, date:, scope:, user_id:, user_name:, admin_app_id: SKIP, channel: SKIP, service_id: SKIP, service_type: SKIP, additional_properties: nil) ⇒ Log

Returns a new instance of Log.



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

def initialize(app_id:, app_type:, change_type:, date:, scope:, user_id:,
               user_name:, admin_app_id: SKIP, channel: SKIP,
               service_id: SKIP, service_type: SKIP,
               additional_properties: nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @admin_app_id = admin_app_id unless admin_app_id == SKIP
  @app_id = app_id
  @app_type = app_type
  @change_type = change_type
  @channel = channel unless channel == SKIP
  @date = date
  @scope = scope
  @service_id = service_id unless service_id == SKIP
  @service_type = service_type unless service_type == SKIP
  @user_id = user_id
  @user_name = user_name
  @additional_properties = additional_properties
end

Instance Attribute Details

#admin_app_idString

TODO: Write general description for this method

Returns:

  • (String)


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

def admin_app_id
  @admin_app_id
end

#app_idString

TODO: Write general description for this method

Returns:

  • (String)


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

def app_id
  @app_id
end

#app_typeString

TODO: Write general description for this method

Returns:

  • (String)


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

def app_type
  @app_type
end

#change_typeString

TODO: Write general description for this method

Returns:

  • (String)


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

def change_type
  @change_type
end

#channelString

TODO: Write general description for this method

Returns:

  • (String)


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

def channel
  @channel
end

#dateString

TODO: Write general description for this method

Returns:

  • (String)


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

def date
  @date
end

#scopeString

TODO: Write general description for this method

Returns:

  • (String)


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

def scope
  @scope
end

#service_idString

TODO: Write general description for this method

Returns:

  • (String)


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

def service_id
  @service_id
end

#service_typeString

TODO: Write general description for this method

Returns:

  • (String)


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

def service_type
  @service_type
end

#user_idString

TODO: Write general description for this method

Returns:

  • (String)


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

def user_id
  @user_id
end

#user_nameString

TODO: Write general description for this method

Returns:

  • (String)


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

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

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  app_id = hash.key?('app_id') ? hash['app_id'] : nil
  app_type = hash.key?('app_type') ? hash['app_type'] : nil
  change_type = hash.key?('change_type') ? hash['change_type'] : nil
  date = hash.key?('date') ? hash['date'] : nil
  scope = hash.key?('scope') ? hash['scope'] : nil
  user_id = hash.key?('user_id') ? hash['user_id'] : nil
  user_name = hash.key?('user_name') ? hash['user_name'] : nil
  admin_app_id = hash.key?('admin_app_id') ? hash['admin_app_id'] : SKIP
  channel = hash.key?('channel') ? hash['channel'] : SKIP
  service_id = hash.key?('service_id') ? hash['service_id'] : SKIP
  service_type = hash.key?('service_type') ? hash['service_type'] : 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.
  Log.new(app_id: app_id,
          app_type: app_type,
          change_type: change_type,
          date: date,
          scope: scope,
          user_id: user_id,
          user_name: user_name,
          admin_app_id: admin_app_id,
          channel: channel,
          service_id: service_id,
          service_type: service_type,
          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/log.rb', line 57

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['admin_app_id'] = 'admin_app_id'
  @_hash['app_id'] = 'app_id'
  @_hash['app_type'] = 'app_type'
  @_hash['change_type'] = 'change_type'
  @_hash['channel'] = 'channel'
  @_hash['date'] = 'date'
  @_hash['scope'] = 'scope'
  @_hash['service_id'] = 'service_id'
  @_hash['service_type'] = 'service_type'
  @_hash['user_id'] = 'user_id'
  @_hash['user_name'] = 'user_name'
  @_hash
end

.nullablesObject

An array for nullable fields



84
85
86
# File 'lib/slack_web_api/models/log.rb', line 84

def self.nullables
  []
end

.optionalsObject

An array for optional fields



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

def self.optionals
  %w[
    admin_app_id
    channel
    service_id
    service_type
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



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

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} admin_app_id: #{@admin_app_id.inspect}, app_id: #{@app_id.inspect},"\
  " app_type: #{@app_type.inspect}, change_type: #{@change_type.inspect}, channel:"\
  " #{@channel.inspect}, date: #{@date.inspect}, scope: #{@scope.inspect}, service_id:"\
  " #{@service_id.inspect}, service_type: #{@service_type.inspect}, user_id:"\
  " #{@user_id.inspect}, user_name: #{@user_name.inspect}, additional_properties:"\
  " #{@additional_properties}>"
end

#to_sObject

Provides a human-readable string representation of the object.



149
150
151
152
153
154
155
# File 'lib/slack_web_api/models/log.rb', line 149

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} admin_app_id: #{@admin_app_id}, app_id: #{@app_id}, app_type: #{@app_type},"\
  " change_type: #{@change_type}, channel: #{@channel}, date: #{@date}, scope: #{@scope},"\
  " service_id: #{@service_id}, service_type: #{@service_type}, user_id: #{@user_id},"\
  " user_name: #{@user_name}, additional_properties: #{@additional_properties}>"
end