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):

  • :trigger_id (Object)

    Exchange a trigger to post to the user.

  • :view (Object)

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

See Also:



18
19
20
21
22
23
24
25
26
27
# 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 = {}) ⇒ 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

#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):

  • :trigger_id (Object)

    Exchange a trigger to post to the user.

  • :view (Object)

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

See Also:



60
61
62
63
64
65
66
67
68
69
# 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 = {}) ⇒ Object

Update an existing view.

Parameters:

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

    a customizable set of options

Options Hash (options):

  • :view (Object)

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

  • :external_id (Object)

    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.

  • :hash (Object)

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

  • :view_id (Object)

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

See Also:



84
85
86
87
88
89
90
91
92
# 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