Class: OpenapiSdkGenerator::Parser

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(file_path) ⇒ Parser

Returns a new instance of Parser.



5
6
7
8
9
10
11
12
# File 'lib/openapi_sdk_generator/parser.rb', line 5

def initialize(file_path)
  @file_path = file_path
  @spec = load_spec
  @endpoints = []
  @models = {}
  @api_info = {}
  parse_spec
end

Instance Attribute Details

#api_infoObject (readonly)

Returns the value of attribute api_info.



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

def api_info
  @api_info
end

#base_urlObject (readonly)

Returns the value of attribute base_url.



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

def base_url
  @base_url
end

#endpointsObject (readonly)

Returns the value of attribute endpoints.



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

def endpoints
  @endpoints
end

#modelsObject (readonly)

Returns the value of attribute models.



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

def models
  @models
end

#specObject (readonly)

Returns the value of attribute spec.



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

def spec
  @spec
end

Instance Method Details

#api_descriptionObject



22
23
24
# File 'lib/openapi_sdk_generator/parser.rb', line 22

def api_description
  @api_info[:description] || 'API client generated from OpenAPI specification'
end

#api_titleObject



14
15
16
# File 'lib/openapi_sdk_generator/parser.rb', line 14

def api_title
  @api_info[:title] || 'Generated API Client'
end

#api_versionObject



18
19
20
# File 'lib/openapi_sdk_generator/parser.rb', line 18

def api_version
  @api_info[:version] || '1.0.0'
end