Class: Slk::Models::ProfileField

Inherits:
Data
  • Object
show all
Defined in:
lib/slk/models/profile_field.rb

Overview

A single custom profile field from users.profile.get + team.profile.get schema.

‘value` is the raw string from Slack: a date as YYYY-MM-DD for type:date, a comma-separated list of user IDs for type:user, a URL for type:link. `alt` is Slack’s optional display label (e.g. link text).

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#altObject (readonly)

Returns the value of attribute alt

Returns:

  • (Object)

    the current value of alt



10
11
12
# File 'lib/slk/models/profile_field.rb', line 10

def alt
  @alt
end

#hiddenObject (readonly)

Returns the value of attribute hidden

Returns:

  • (Object)

    the current value of hidden



10
11
12
# File 'lib/slk/models/profile_field.rb', line 10

def hidden
  @hidden
end

#idObject (readonly)

Returns the value of attribute id

Returns:

  • (Object)

    the current value of id



10
11
12
# File 'lib/slk/models/profile_field.rb', line 10

def id
  @id
end

#inverseObject (readonly)

Returns the value of attribute inverse

Returns:

  • (Object)

    the current value of inverse



10
11
12
# File 'lib/slk/models/profile_field.rb', line 10

def inverse
  @inverse
end

#labelObject (readonly)

Returns the value of attribute label

Returns:

  • (Object)

    the current value of label



10
11
12
# File 'lib/slk/models/profile_field.rb', line 10

def label
  @label
end

#orderingObject (readonly)

Returns the value of attribute ordering

Returns:

  • (Object)

    the current value of ordering



10
11
12
# File 'lib/slk/models/profile_field.rb', line 10

def ordering
  @ordering
end

#section_idObject (readonly)

Returns the value of attribute section_id

Returns:

  • (Object)

    the current value of section_id



10
11
12
# File 'lib/slk/models/profile_field.rb', line 10

def section_id
  @section_id
end

#typeObject (readonly)

Returns the value of attribute type

Returns:

  • (Object)

    the current value of type



10
11
12
# File 'lib/slk/models/profile_field.rb', line 10

def type
  @type
end

#valueObject (readonly)

Returns the value of attribute value

Returns:

  • (Object)

    the current value of value



10
11
12
# File 'lib/slk/models/profile_field.rb', line 10

def value
  @value
end

Instance Method Details

#empty?Boolean

Returns:

  • (Boolean)


13
14
15
# File 'lib/slk/models/profile_field.rb', line 13

def empty?
  value.to_s.empty?
end


24
25
26
# File 'lib/slk/models/profile_field.rb', line 24

def link_text
  alt.to_s.empty? ? value.to_s : alt.to_s
end

#user_idsObject

type:user values can be multi-value (comma-separated user IDs).



18
19
20
21
22
# File 'lib/slk/models/profile_field.rb', line 18

def user_ids
  return [] unless type == 'user'

  value.to_s.split(',').map(&:strip).reject(&:empty?)
end