Class: Swgr2rb::SwaggerJsonFetcher
- Inherits:
-
Object
- Object
- Swgr2rb::SwaggerJsonFetcher
- Defined in:
- lib/json_fetcher/swagger_json_fetcher.rb
Overview
SwaggerJsonFetcher fetches a Swagger JSON given its path. Since the path can either be a URL of Swagger or a path to a .json file, SwaggerJsonFetcher either makes a GET request to the given URL and returns its response, or reads and parses a specified .json file.
Class Method Summary collapse
Class Method Details
.get_swagger_json(path) ⇒ Object
14 15 16 17 18 19 20 |
# File 'lib/json_fetcher/swagger_json_fetcher.rb', line 14 def get_swagger_json(path) if URI.extract(path).present? send_request_to_swagger(path) else read_file(path) end end |