Class: Swagger::Docs::ApiDeclarationFile

Inherits:
Object
  • Object
show all
Defined in:
lib/swagger/docs/api_declaration_file.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(metadata, apis, models) ⇒ ApiDeclarationFile

Returns a new instance of ApiDeclarationFile.



6
7
8
9
10
# File 'lib/swagger/docs/api_declaration_file.rb', line 6

def initialize(, apis, models)
  @metadata = 
  @apis = camelize_keys_deep apis
  @models = models
end

Instance Attribute Details

#apis ⇒ Object (readonly)

Returns the value of attribute apis.



4
5
6
# File 'lib/swagger/docs/api_declaration_file.rb', line 4

def apis
  @apis
end

#metadata ⇒ Object (readonly)

Returns the value of attribute metadata.



4
5
6
# File 'lib/swagger/docs/api_declaration_file.rb', line 4

def 
  @metadata
end

Instance Method Details

#api_version ⇒ Object



31
32
33
# File 'lib/swagger/docs/api_declaration_file.rb', line 31

def api_version
  .api_version
end

#base_path ⇒ Object



19
20
21
# File 'lib/swagger/docs/api_declaration_file.rb', line 19

def base_path
  .base_path
end

#camelize_model_properties ⇒ Object



39
40
41
# File 'lib/swagger/docs/api_declaration_file.rb', line 39

def camelize_model_properties
  .camelize_model_properties
end

#controller_base_path ⇒ Object



35
36
37
# File 'lib/swagger/docs/api_declaration_file.rb', line 35

def controller_base_path
  .controller_base_path
end

#generate_resource ⇒ Object



12
13
14
15
16
17
# File 'lib/swagger/docs/api_declaration_file.rb', line 12

def generate_resource
  resource = build_resource_root_hash
  # Add the already-normalized models to the resource.
  resource = resource.merge({:models => models}) if models.present?
  resource
end

#models ⇒ Object



51
52
53
# File 'lib/swagger/docs/api_declaration_file.rb', line 51

def models
  normalize_model_properties @models
end

#path ⇒ Object



23
24
25
# File 'lib/swagger/docs/api_declaration_file.rb', line 23

def path
  .path
end

#resource_file_path ⇒ Object



47
48
49
# File 'lib/swagger/docs/api_declaration_file.rb', line 47

def resource_file_path
  trim_leading_slash(debased_path.to_s.underscore)
end

#resource_path ⇒ Object



43
44
45
# File 'lib/swagger/docs/api_declaration_file.rb', line 43

def resource_path
  demod
end

#swagger_version ⇒ Object



27
28
29
# File 'lib/swagger/docs/api_declaration_file.rb', line 27

def swagger_version
  .swagger_version
end