Class: Grape::ClientGenerator::Ruby::Api

Inherits:
ClientFile
  • Object
show all
Defined in:
lib/grape/client-generator/ruby/files.rb

Instance Attribute Summary

Attributes inherited from ClientFile

#generator

Instance Method Summary collapse

Methods inherited from ClientFile

#initialize, #render

Constructor Details

This class inherits a constructor from Grape::ClientGenerator::Ruby::ClientFile

Instance Method Details

#input_fileObject



49
50
51
# File 'lib/grape/client-generator/ruby/files.rb', line 49

def input_file
  mustache_file_for("api")
end

#output_file_nameObject



45
46
47
# File 'lib/grape/client-generator/ruby/files.rb', line 45

def output_file_name
  "api.rb"
end

#paramsObject



53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
# File 'lib/grape/client-generator/ruby/files.rb', line 53

def params
  {
    :namespace => generator.namespace,
    :class_name => generator.class_name,
    :default_version => generator.default_version,
    :default_format => generator.response_types.first,
    :endpoints => generator.map_endpoints do |endpoint|
      {
        :path => route_options_for(endpoint)[:path],
        :path_params => route_options_for(endpoint)[:params].keys,
        :name => endpoint.settings[:name],  # expected to be set by all endpoints
        :verb => endpoint.options[:method].first.downcase
      }
    end
  }
end