Sha256: 76cf6706ed752eb5d5e67360b3f92180f419c55dcade7c6f6991b4cb4ae084a8

Contents?: true

Size: 1.17 KB

Versions: 6

Compression:

Stored size: 1.17 KB

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"].lines.each do |l| %>
      # <%= l.strip %>
<% end %>
      #
<% data["args"].reject{|k, v| k=="token"}.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/aki017/slack-api-docs/blob/master/methods/<%= group %>.<%= name %>.md
      # @see https://github.com/aki017/slack-api-docs/blob/master/methods/<%= group %>.<%= name %>.json
      def <%= group %>_<%= name %>(options={})
<% data["args"].reject{|k, v| k=="token"}.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 %>
        options[:attachments] = options[:attachments].to_json if Hash === options[:attachments]
        post("<%= group %>.<%= name %>", options)
      end

<% end %>
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
slack-api-1.4.0 lib/generators/templates/method.rb.erb
slack-api-1.3.0 lib/generators/templates/method.rb.erb
slack-api-1.2.4 lib/generators/templates/method.rb.erb
slack-api-1.2.3 lib/generators/templates/method.rb.erb
slack-api-1.2.2 lib/generators/templates/method.rb.erb
slack-api-1.2.1 lib/generators/templates/method.rb.erb