Sha256: bc2cc9c60e79267a55e36d735a7c53ea2ca35e2d69a18396b354edbb05a9c3b9

Contents?: true

Size: 1.21 KB

Versions: 3

Compression:

Stored size: 1.21 KB

Contents

# This file was auto-generated by lib/slack/web/api/tasks/generate.rake

module Slack
  module Web
    module Api
      module Endpoints
        module <%= group.capitalize %>
<% names.each_with_index do |(name, data), index| %>
<% if index > 0 %>

<% end %>
          #
          # <%= data["desc"] %>
          #
<% data["args"].each do |arg_name, arg_v| %>
          # @option options [<%= arg_v["type"] %>] :<%= arg_name %>
<% arg_v["desc"].lines.each do |l| %>
<% if l.strip.length > 0 %>
          #   <%= l.strip %>
<% else %>
          #
<% end %>
<% end %>
<% end %>
          # @see https://api.slack.com/methods/<%= group %>.<%= name %>
          # @see https://github.com/slackhq/slack-api-docs/blob/master/methods/<%= group %>.<%= name %>.md
          # @see https://github.com/slackhq/slack-api-docs/blob/master/methods/<%= group %>.<%= name %>.json
          def <%= group %>_<%= name %>(options = {})
<% data["args"].select{|k,v| v["required"]}.each do |arg_name, arg_v| %>
            throw ArgumentError.new('Required arguments :<%= arg_name %> missing') if options[:<%= arg_name %>].nil?
<% end %>
            post('<%= group %>.<%= name %>', options)
          end
<% end %>
        end
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
slack-ruby-client-0.2.1 lib/slack/web/api/templates/method.erb
slack-ruby-client-0.2.0 lib/slack/web/api/templates/method.erb
slack-ruby-client-0.1.0 lib/slack/web/api/templates/method.erb