Sha256: 6d107e775c8bae5ab693bd6e5ece4fc806759b0809a9a323a22fa0392868b12f

Contents?: true

Size: 1011 Bytes

Versions: 6

Compression:

Stored size: 1011 Bytes

Contents

# This file was auto-generated by lib/generators/tasks/generate.rb

module Slack
  module Endpoint
    module <%= group.capitalize %>
<% names.each do |name, data| %>
      #
      # <%= data["desc"] %>
      #
<% data["args"].each do |arg_name, arg_v| %>
      # @option options [<%= arg_v["type"] %>] :<%= arg_name %>
<% arg_v["desc"].lines.each do |l| %>
      #   <%= l.strip %>
<% 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

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
slack-api-1.1.4 lib/generators/templates/method.rb.erb
slack-api-1.1.3 lib/generators/templates/method.rb.erb
slack-api-1.1.2 lib/generators/templates/method.rb.erb
slack-api-1.1.1 lib/generators/templates/method.rb.erb
slack-api-1.1.0 lib/generators/templates/method.rb.erb
slack-api-1.0.0 lib/generators/templates/method.rb.erb