Class: SlackWebApi::DndInfoSchema

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

Overview

Schema for successful response from dnd.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(dnd_enabled:, next_dnd_end_ts:, next_dnd_start_ts:, snooze_enabled: SKIP, snooze_endtime: SKIP, snooze_remaining: SKIP, additional_properties: nil) ⇒ DndInfoSchema

Returns a new instance of DndInfoSchema.



67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
# File 'lib/slack_web_api/models/dnd_info_schema.rb', line 67

def initialize(dnd_enabled:, next_dnd_end_ts:, next_dnd_start_ts:,
               snooze_enabled: SKIP, snooze_endtime: SKIP,
               snooze_remaining: SKIP, additional_properties: nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @dnd_enabled = dnd_enabled
  @next_dnd_end_ts = next_dnd_end_ts
  @next_dnd_start_ts = next_dnd_start_ts
  @ok = 'True'
  @snooze_enabled = snooze_enabled unless snooze_enabled == SKIP
  @snooze_endtime = snooze_endtime unless snooze_endtime == SKIP
  @snooze_remaining = snooze_remaining unless snooze_remaining == SKIP
  @additional_properties = additional_properties
end

Instance Attribute Details

#dnd_enabledTrueClass | FalseClass

TODO: Write general description for this method

Returns:

  • (TrueClass | FalseClass)


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

def dnd_enabled
  @dnd_enabled
end

#next_dnd_end_tsInteger

TODO: Write general description for this method

Returns:

  • (Integer)


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

def next_dnd_end_ts
  @next_dnd_end_ts
end

#next_dnd_start_tsInteger

TODO: Write general description for this method

Returns:

  • (Integer)


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

def next_dnd_start_ts
  @next_dnd_start_ts
end

#okString (readonly)

TODO: Write general description for this method

Returns:

  • (String)


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

def ok
  @ok
end

#snooze_enabledTrueClass | FalseClass

TODO: Write general description for this method

Returns:

  • (TrueClass | FalseClass)


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

def snooze_enabled
  @snooze_enabled
end

#snooze_endtimeInteger

TODO: Write general description for this method

Returns:

  • (Integer)


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

def snooze_endtime
  @snooze_endtime
end

#snooze_remainingInteger

TODO: Write general description for this method

Returns:

  • (Integer)


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

def snooze_remaining
  @snooze_remaining
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



84
85
86
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
115
# File 'lib/slack_web_api/models/dnd_info_schema.rb', line 84

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  dnd_enabled = hash.key?('dnd_enabled') ? hash['dnd_enabled'] : nil
  next_dnd_end_ts =
    hash.key?('next_dnd_end_ts') ? hash['next_dnd_end_ts'] : nil
  next_dnd_start_ts =
    hash.key?('next_dnd_start_ts') ? hash['next_dnd_start_ts'] : nil
  snooze_enabled =
    hash.key?('snooze_enabled') ? hash['snooze_enabled'] : SKIP
  snooze_endtime =
    hash.key?('snooze_endtime') ? hash['snooze_endtime'] : SKIP
  snooze_remaining =
    hash.key?('snooze_remaining') ? hash['snooze_remaining'] : 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.
  DndInfoSchema.new(dnd_enabled: dnd_enabled,
                    next_dnd_end_ts: next_dnd_end_ts,
                    next_dnd_start_ts: next_dnd_start_ts,
                    snooze_enabled: snooze_enabled,
                    snooze_endtime: snooze_endtime,
                    snooze_remaining: snooze_remaining,
                    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/dnd_info_schema.rb', line 41

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['dnd_enabled'] = 'dnd_enabled'
  @_hash['next_dnd_end_ts'] = 'next_dnd_end_ts'
  @_hash['next_dnd_start_ts'] = 'next_dnd_start_ts'
  @_hash['ok'] = 'ok'
  @_hash['snooze_enabled'] = 'snooze_enabled'
  @_hash['snooze_endtime'] = 'snooze_endtime'
  @_hash['snooze_remaining'] = 'snooze_remaining'
  @_hash
end

.nullablesObject

An array for nullable fields



63
64
65
# File 'lib/slack_web_api/models/dnd_info_schema.rb', line 63

def self.nullables
  []
end

.optionalsObject

An array for optional fields



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

def self.optionals
  %w[
    snooze_enabled
    snooze_endtime
    snooze_remaining
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



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

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} dnd_enabled: #{@dnd_enabled.inspect}, next_dnd_end_ts:"\
  " #{@next_dnd_end_ts.inspect}, next_dnd_start_ts: #{@next_dnd_start_ts.inspect}, ok:"\
  " #{@ok.inspect}, snooze_enabled: #{@snooze_enabled.inspect}, snooze_endtime:"\
  " #{@snooze_endtime.inspect}, snooze_remaining: #{@snooze_remaining.inspect},"\
  " additional_properties: #{@additional_properties}>"
end

#to_sObject

Provides a human-readable string representation of the object.



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

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} dnd_enabled: #{@dnd_enabled}, next_dnd_end_ts: #{@next_dnd_end_ts},"\
  " next_dnd_start_ts: #{@next_dnd_start_ts}, ok: #{@ok}, snooze_enabled: #{@snooze_enabled},"\
  " snooze_endtime: #{@snooze_endtime}, snooze_remaining: #{@snooze_remaining},"\
  " additional_properties: #{@additional_properties}>"
end