module Slack::Web::Api::Endpoints::Views

Public Instance Methods

views_open(options = {}) click to toggle source

Open a view for a user.

@option options [Object] :trigger_id

Exchange a trigger to post to the user.

@option options [Object] :view

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

@see api.slack.com/methods/views.open @see github.com/slack-ruby/slack-api-ref/blob/master/methods/views/views.open.json

# File lib/slack/web/api/endpoints/views.rb, line 18
def views_open(options = {})
  throw ArgumentError.new('Required arguments :trigger_id missing') if options[:trigger_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.open', options)
end
views_publish(options = {}) click to toggle source

Publish a static view for a User.

@option options [Object] :user_id

id of the user you want publish a view to.

@option options [Object] :view

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

@option options [Object] :hash

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

@see api.slack.com/methods/views.publish @see github.com/slack-ruby/slack-api-ref/blob/master/methods/views/views.publish.json

# 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
views_push(options = {}) click to toggle source

Push a view onto the stack of a root view.

@option options [Object] :trigger_id

Exchange a trigger to post to the user.

@option options [Object] :view

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

@see api.slack.com/methods/views.push @see github.com/slack-ruby/slack-api-ref/blob/master/methods/views/views.push.json

# File lib/slack/web/api/endpoints/views.rb, line 60
def views_push(options = {})
  throw ArgumentError.new('Required arguments :trigger_id missing') if options[:trigger_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.push', options)
end
views_update(options = {}) click to toggle source

Update an existing view.

@option options [Object] :view

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

@option options [Object] :external_id

A unique identifier of the view set by the developer. Must be unique for all views on a team. Max length of 255 characters. Either view_id or external_id is required.

@option options [Object] :hash

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

@option options [Object] :view_id

A unique identifier of the view to be updated. Either view_id or external_id is required.

@see api.slack.com/methods/views.update @see github.com/slack-ruby/slack-api-ref/blob/master/methods/views/views.update.json

# File lib/slack/web/api/endpoints/views.rb, line 84
def views_update(options = {})
  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.update', options)
end