Class: SlackWebApi::DndInfoSchema
- Defined in:
- lib/slack_web_api/models/dnd_info_schema.rb
Overview
Schema for successful response from dnd.info method
Instance Attribute Summary collapse
-
#dnd_enabled ⇒ TrueClass | FalseClass
TODO: Write general description for this method.
-
#next_dnd_end_ts ⇒ Integer
TODO: Write general description for this method.
-
#next_dnd_start_ts ⇒ Integer
TODO: Write general description for this method.
-
#ok ⇒ String
readonly
TODO: Write general description for this method.
-
#snooze_enabled ⇒ TrueClass | FalseClass
TODO: Write general description for this method.
-
#snooze_endtime ⇒ Integer
TODO: Write general description for this method.
-
#snooze_remaining ⇒ Integer
TODO: Write general description for this method.
Class Method Summary collapse
-
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
-
.names ⇒ Object
A mapping from model property names to API property names.
-
.nullables ⇒ Object
An array for nullable fields.
-
.optionals ⇒ Object
An array for optional fields.
Instance Method Summary collapse
-
#initialize(dnd_enabled:, next_dnd_end_ts:, next_dnd_start_ts:, snooze_enabled: SKIP, snooze_endtime: SKIP, snooze_remaining: SKIP, additional_properties: nil) ⇒ DndInfoSchema
constructor
A new instance of DndInfoSchema.
-
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
-
#to_s ⇒ Object
Provides a human-readable string representation of the object.
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_enabled ⇒ TrueClass | FalseClass
TODO: Write general description for this method
14 15 16 |
# File 'lib/slack_web_api/models/dnd_info_schema.rb', line 14 def dnd_enabled @dnd_enabled end |
#next_dnd_end_ts ⇒ Integer
TODO: Write general description for this method
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_ts ⇒ Integer
TODO: Write general description for this method
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 |
#ok ⇒ String (readonly)
TODO: Write general description for this method
26 27 28 |
# File 'lib/slack_web_api/models/dnd_info_schema.rb', line 26 def ok @ok end |
#snooze_enabled ⇒ TrueClass | FalseClass
TODO: Write general description for this method
30 31 32 |
# File 'lib/slack_web_api/models/dnd_info_schema.rb', line 30 def snooze_enabled @snooze_enabled end |
#snooze_endtime ⇒ Integer
TODO: Write general description for this method
34 35 36 |
# File 'lib/slack_web_api/models/dnd_info_schema.rb', line 34 def snooze_endtime @snooze_endtime end |
#snooze_remaining ⇒ Integer
TODO: Write general description for this method
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 |
.names ⇒ Object
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 |
.nullables ⇒ Object
An array for nullable fields
63 64 65 |
# File 'lib/slack_web_api/models/dnd_info_schema.rb', line 63 def self.nullables [] end |
.optionals ⇒ Object
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
#inspect ⇒ Object
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_s ⇒ Object
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 |