Method: Slack::Web::Api::Endpoints::Views#views_publish

Defined in:
lib/slack/web/api/endpoints/views.rb

#views_publish(options = {}) ⇒ Object

Publish a static view for a User.

Parameters:

  • options (Hash) (defaults to: {})

    a customizable set of options

Options Hash (options):

  • :user_id (Object)

    id of the user you want publish a view to.

  • :view (Object)

    A view payload. This must be a JSON-encoded string.

  • :hash (Object)

    A string that represents view state to protect against possible race conditions.

See Also:



40
41
42
43
44
45
46
47
48
49
# File 'lib/slack/web/api/endpoints/views.rb', line 40

def views_publish(options = {})
  throw ArgumentError.new('Required arguments :user_id missing') if options[:user_id].nil?
  throw ArgumentError.new('Required arguments :view missing') if options[:view].nil?
  if options.key?(:view)
    view = options[:view]
    view = JSON.dump(view) unless view.is_a?(String)
    options = options.merge(view: view)
  end
  post('views.publish', options)
end