Module: Slack::Web::Api::Endpoints::Views

Included in:
Slack::Web::Api::Endpoints
Defined in:
lib/slack/web/api/endpoints/views.rb

Instance Method Summary collapse

Instance Method Details

#views_open(options = {}) ⇒ Object

Open a view for a user.

Parameters:

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

    a customizable set of options

Options Hash (options):

  • :view (view as string)

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

  • :trigger_id (string)

    Exchange a trigger to post to the user.

  • :interactivity_pointer (string)

    Exchange an interactivity pointer to post to the user.

Raises:

  • (ArgumentError)

See Also:



20
21
22
23
24
25
# File 'lib/slack/web/api/endpoints/views.rb', line 20

def views_open(options = {})
  raise ArgumentError, 'Required arguments :view missing' if options[:view].nil?
  raise ArgumentError, 'Exactly one of :trigger_id, :interactivity_pointer is required' unless options[:trigger_id].nil? ^ options[:interactivity_pointer].nil?
  options = encode_options_as_json(options, %i[view])
  post('views.open', options)
end

#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 (string)

    id of the user you want publish a view to.

  • :view (view as string)

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

  • :hash (string)

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

Raises:

  • (ArgumentError)

See Also:



38
39
40
41
42
43
# File 'lib/slack/web/api/endpoints/views.rb', line 38

def views_publish(options = {})
  raise ArgumentError, 'Required arguments :user_id missing' if options[:user_id].nil?
  raise ArgumentError, 'Required arguments :view missing' if options[:view].nil?
  options = encode_options_as_json(options, %i[view])
  post('views.publish', options)
end

#views_push(options = {}) ⇒ Object

Push a view onto the stack of a root view.

Parameters:

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

    a customizable set of options

Options Hash (options):

  • :view (view as string)

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

  • :trigger_id (string)

    Exchange a trigger to post to the user.

  • :interactivity_pointer (string)

    Exchange an interactivity pointer to post to the user.

Raises:

  • (ArgumentError)

See Also:



56
57
58
59
60
61
# File 'lib/slack/web/api/endpoints/views.rb', line 56

def views_push(options = {})
  raise ArgumentError, 'Required arguments :view missing' if options[:view].nil?
  raise ArgumentError, 'Exactly one of :trigger_id, :interactivity_pointer is required' unless options[:trigger_id].nil? ^ options[:interactivity_pointer].nil?
  options = encode_options_as_json(options, %i[view])
  post('views.push', options)
end

#views_update(options = {}) ⇒ Object

Update an existing view.

Parameters:

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

    a customizable set of options

Options Hash (options):

  • :view (view as string)

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

  • :external_id (string)

    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.

  • :view_id (string)

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

  • :hash (string)

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

Raises:

  • (ArgumentError)

See Also:



76
77
78
79
80
81
# File 'lib/slack/web/api/endpoints/views.rb', line 76

def views_update(options = {})
  raise ArgumentError, 'Required arguments :view missing' if options[:view].nil?
  raise ArgumentError, 'Exactly one of :external_id, :view_id is required' unless options[:external_id].nil? ^ options[:view_id].nil?
  options = encode_options_as_json(options, %i[view])
  post('views.update', options)
end