Sha256: 1758a86f015e7ef6422c90826c34c8ceadd71026dcd3c225abcc0c3b34995713

Contents?: true

Size: 937 Bytes

Versions: 3

Compression:

Stored size: 937 Bytes

Contents

# Generated REST API methods file - DO NOT EDIT!
# Date: <%= Time.now.strftime("%Y-%m-%d") %>
# ES version: <%= version %>

module Antbird
  module RestApi
    module RestApiV<%= class_version %>
      def common_params
        @common_params ||= <%= api_spec['_common.json'] || {} %>
      end
<% api_spec.each do |file_name, file_content| %>
<%  next if file_name == '_common.json' %>
<%  file_content.each do |api_name, api_spec| %>

      # <%= api_name %> <%= api_spec['methods'] %>
      # <%= api_spec['documentation'] %>
      def <%= api_name.tr('.', '_') %>(params = {})
        api_name = '<%= api_name %>'
        api_spec = @api_specs[api_name] ||= <%= api_spec %>
        request(api_name, api_spec, params)
      end
<%    if api_spec['methods'] == ['HEAD'] %>
      alias :<%= api_name.tr('.', '_') %>? :<%= api_name.tr('.', '_') %>
<%    end %>
<%  end # file_content.each %>
<% end # api_spec.each %>
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
antbird-0.0.9 script/rest_api_template.erb
antbird-0.0.8 script/rest_api_template.erb
antbird-0.0.7 script/rest_api_template.erb