dblock/slack-ruby-client

View on GitHub
lib/slack/web/api/endpoints/users_profile.rb

Summary

Maintainability
A
0 mins
Test Coverage
# frozen_string_literal: true
# This file was auto-generated by lib/tasks/web.rake

module Slack
  module Web
    module Api
      module Endpoints
        module UsersProfile
          #
          # Retrieve a user's profile information, including their custom status.
          #
          # @option options [boolean] :include_labels
          #   Include labels for each ID in custom profile fields. Using this parameter will heavily rate-limit your requests and is not recommended.
          # @option options [user] :user
          #   User to retrieve profile info for.
          # @see https://api.slack.com/methods/users.profile.get
          # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/users.profile/users.profile.get.json
          def users_profile_get(options = {})
            options = options.merge(user: users_id(options)['user']['id']) if options[:user]
            post('users.profile.get', options)
          end

          #
          # Set a user's profile information, including custom status.
          #
          # @option options [string] :name
          #   Name of a single key to set. Usable only if profile is not passed.
          # @option options [string] :profile
          #   Collection of key:value pairs presented as a URL-encoded JSON hash. At most 50 fields may be set. Each field name is limited to 255 characters.
          # @option options [user] :user
          #   ID of user to change. This argument may only be specified by admins on paid teams.
          # @option options [string] :value
          #   Value to set a single key to. Usable only if profile is not passed.
          # @see https://api.slack.com/methods/users.profile.set
          # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/users.profile/users.profile.set.json
          def users_profile_set(options = {})
            options = options.merge(user: users_id(options)['user']['id']) if options[:user]
            options = encode_options_as_json(options, %i[profile])
            post('users.profile.set', options)
          end
        end
      end
    end
  end
end