Class: ApiCanon::Swagger::ApiDeclaration::Api

Inherits:
ActiveModel::Serializer
  • Object
show all
Defined in:
lib/api_canon/swagger/api_declaration.rb

Defined Under Namespace

Classes: Operation

Instance Method Summary collapse

Instance Method Details

#operationsObject



35
36
37
# File 'lib/api_canon/swagger/api_declaration.rb', line 35

def operations
  [ Operation.new(object) ]
end

#pathObject



15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/api_canon/swagger/api_declaration.rb', line 15

def path
  url_params = {
    :controller => object.controller_name,
    :action => object.action_name,
    :only_path => true
  }

  object.params.keys.each do |name|
    url_params[name] = '{name}' unless name == :format
  end

  url = URI.unescape url_for(url_params)

  # This is required because we dont know if the params are
  # path params or query params, this way we dont care.
  url = url.split('?').first

  "#{url}.{format}"
end