Module: Swagger::Docs::Methods::ClassMethods

Defined in:
lib/swagger/docs/methods.rb

Instance Method Summary collapse

Instance Method Details

#swagger_actionsObject



16
17
18
19
20
21
22
23
24
25
# File 'lib/swagger/docs/methods.rb', line 16

def swagger_actions
  swagger_dsl = {}
  Array(@swagger_dsl).each do |action, params, controller, block|
    dsl = SwaggerDSL.call(action, controller, &block)
    swagger_dsl[action] ||= {}
    swagger_dsl[action].deep_merge!(dsl) { |key, old, new| Array(old) + Array(new) }
    swagger_dsl[action].deep_merge!(params) # merge in user api parameters
  end
  swagger_dsl
end

#swagger_api(action, params = {}, &block) ⇒ Object



40
41
42
43
# File 'lib/swagger/docs/methods.rb', line 40

def swagger_api(action, params = {}, &block)
  @swagger_dsl ||= []
  @swagger_dsl << [action, params, self, block]
end

#swagger_configObject



36
37
38
# File 'lib/swagger/docs/methods.rb', line 36

def swagger_config
  @swagger_config ||= {}
end

#swagger_controller(controller, description, params = {}) ⇒ Object



10
11
12
13
14
# File 'lib/swagger/docs/methods.rb', line 10

def swagger_controller(controller, description, params = {})
  swagger_config[:controller] = controller
  swagger_config[:description] = description
  swagger_config[:resource_path] = params[:resource_path]
end

#swagger_model(model_name, &block) ⇒ Object



45
46
47
48
# File 'lib/swagger/docs/methods.rb', line 45

def swagger_model(model_name, &block)
  @swagger_model_dsls ||= []
  @swagger_model_dsls << [model_name, self, block]
end

#swagger_modelsObject



27
28
29
30
31
32
33
34
# File 'lib/swagger/docs/methods.rb', line 27

def swagger_models
  swagger_model_dsls ||= {}
  Array(@swagger_model_dsls).each do |model_name, controller, block|
    model_dsl = SwaggerModelDSL.call(model_name, controller, &block)
    swagger_model_dsls[model_name] = model_dsl
  end
  swagger_model_dsls
end