Class: RamlRubyClient::Parser

Inherits:
Object
  • Object
show all
Defined in:
lib/raml_ruby_client/generator/parser.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(raml_file) ⇒ Parser

Returns a new instance of Parser.



5
6
7
# File 'lib/raml_ruby_client/generator/parser.rb', line 5

def initialize(raml_file)
  @raml_object = Raml.parse_file(raml_file)
end

Instance Attribute Details

#raml_objectObject (readonly)

Returns the value of attribute raml_object.



3
4
5
# File 'lib/raml_ruby_client/generator/parser.rb', line 3

def raml_object
  @raml_object
end

Instance Method Details

#apisObject



17
18
19
# File 'lib/raml_ruby_client/generator/parser.rb', line 17

def apis
  @apis ||= raml_object.resources.map {|key, resource| parse_apis(key, resource) }.flatten
end

#base_uriObject



9
10
11
# File 'lib/raml_ruby_client/generator/parser.rb', line 9

def base_uri
  raml_object.base_uri
end

#config_keysObject



13
14
15
# File 'lib/raml_ruby_client/generator/parser.rb', line 13

def config_keys
  ['endpoint']
end

#library_pathObject



29
30
31
# File 'lib/raml_ruby_client/generator/parser.rb', line 29

def library_path
  namespace.gsub("/", "_").downcase
end

#module_nameObject



25
26
27
# File 'lib/raml_ruby_client/generator/parser.rb', line 25

def module_name
  namespace.camelize.gsub('::', '')
end

#namespaceObject



21
22
23
# File 'lib/raml_ruby_client/generator/parser.rb', line 21

def namespace
  @namespace ||= raml_object.title.gsub(" ", "/")
end