Class: SlackWebApi::ApiMethodUsersGetPresence

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

Overview

Generated from users.getPresence with shasum e7251aec575d8863f9e0eb38663ae9dc26655f65

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(presence:, auto_away: SKIP, connection_count: SKIP, last_activity: SKIP, manual_away: SKIP, online: SKIP, additional_properties: nil) ⇒ ApiMethodUsersGetPresence

Returns a new instance of ApiMethodUsersGetPresence.



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

def initialize(presence:, auto_away: SKIP, connection_count: SKIP,
               last_activity: SKIP, manual_away: SKIP, online: SKIP,
               additional_properties: nil)
  # Add additional model properties to the instance

  additional_properties = {} if additional_properties.nil?

  @auto_away = auto_away unless auto_away == SKIP
  @connection_count = connection_count unless connection_count == SKIP
  @last_activity = last_activity unless last_activity == SKIP
  @manual_away = manual_away unless manual_away == SKIP
  @ok = 'True'
  @online = online unless online == SKIP
  @presence = presence
  @additional_properties = additional_properties
end

Instance Attribute Details

#auto_awayTrueClass | FalseClass

TODO: Write general description for this method

Returns:

  • (TrueClass | FalseClass)


15
16
17
# File 'lib/slack_web_api/models/api_method_users_get_presence.rb', line 15

def auto_away
  @auto_away
end

#connection_countInteger

TODO: Write general description for this method

Returns:

  • (Integer)


19
20
21
# File 'lib/slack_web_api/models/api_method_users_get_presence.rb', line 19

def connection_count
  @connection_count
end

#last_activityInteger

TODO: Write general description for this method

Returns:

  • (Integer)


23
24
25
# File 'lib/slack_web_api/models/api_method_users_get_presence.rb', line 23

def last_activity
  @last_activity
end

#manual_awayTrueClass | FalseClass

TODO: Write general description for this method

Returns:

  • (TrueClass | FalseClass)


27
28
29
# File 'lib/slack_web_api/models/api_method_users_get_presence.rb', line 27

def manual_away
  @manual_away
end

#okString (readonly)

TODO: Write general description for this method

Returns:

  • (String)


31
32
33
# File 'lib/slack_web_api/models/api_method_users_get_presence.rb', line 31

def ok
  @ok
end

#onlineTrueClass | FalseClass

TODO: Write general description for this method

Returns:

  • (TrueClass | FalseClass)


35
36
37
# File 'lib/slack_web_api/models/api_method_users_get_presence.rb', line 35

def online
  @online
end

#presenceString

TODO: Write general description for this method

Returns:

  • (String)


39
40
41
# File 'lib/slack_web_api/models/api_method_users_get_presence.rb', line 39

def presence
  @presence
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



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
# File 'lib/slack_web_api/models/api_method_users_get_presence.rb', line 87

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.

  presence = hash.key?('presence') ? hash['presence'] : nil
  auto_away = hash.key?('auto_away') ? hash['auto_away'] : SKIP
  connection_count =
    hash.key?('connection_count') ? hash['connection_count'] : SKIP
  last_activity = hash.key?('last_activity') ? hash['last_activity'] : SKIP
  manual_away = hash.key?('manual_away') ? hash['manual_away'] : SKIP
  online = hash.key?('online') ? hash['online'] : 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.

  ApiMethodUsersGetPresence.new(presence: presence,
                                auto_away: auto_away,
                                connection_count: connection_count,
                                last_activity: last_activity,
                                manual_away: manual_away,
                                online: online,
                                additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



42
43
44
45
46
47
48
49
50
51
52
# File 'lib/slack_web_api/models/api_method_users_get_presence.rb', line 42

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['auto_away'] = 'auto_away'
  @_hash['connection_count'] = 'connection_count'
  @_hash['last_activity'] = 'last_activity'
  @_hash['manual_away'] = 'manual_away'
  @_hash['ok'] = 'ok'
  @_hash['online'] = 'online'
  @_hash['presence'] = 'presence'
  @_hash
end

.nullablesObject

An array for nullable fields



66
67
68
# File 'lib/slack_web_api/models/api_method_users_get_presence.rb', line 66

def self.nullables
  []
end

.optionalsObject

An array for optional fields



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

def self.optionals
  %w[
    auto_away
    connection_count
    last_activity
    manual_away
    online
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



125
126
127
128
129
130
131
# File 'lib/slack_web_api/models/api_method_users_get_presence.rb', line 125

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} auto_away: #{@auto_away.inspect}, connection_count:"\
  " #{@connection_count.inspect}, last_activity: #{@last_activity.inspect}, manual_away:"\
  " #{@manual_away.inspect}, ok: #{@ok.inspect}, online: #{@online.inspect}, presence:"\
  " #{@presence.inspect}, additional_properties: #{@additional_properties}>"
end

#to_sObject

Provides a human-readable string representation of the object.



117
118
119
120
121
122
# File 'lib/slack_web_api/models/api_method_users_get_presence.rb', line 117

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} auto_away: #{@auto_away}, connection_count: #{@connection_count},"\
  " last_activity: #{@last_activity}, manual_away: #{@manual_away}, ok: #{@ok}, online:"\
  " #{@online}, presence: #{@presence}, additional_properties: #{@additional_properties}>"
end