API
Facade for introspected API data.
Entry point for accessing all API data. Access resources via #resources, types via #types, enums via #enums.
Example
ruby
api = Apiwork::API.introspect('/api/v1', locale: :fr)
api.info.title # => "Mon API"
api.types[:address].description # => "Type d'adresse"
api.enums[:status].values # => ["draft", "published"]
api.resources.each_value do |resource|
resource.actions.each_value do |action|
# ...
end
endModules
Instance Methods
#base_path
#base_path
The base path for this API.
Returns
String, nil
#enums
#enums
The enums for this API.
Returns
Hash{Symbol => Enum}
#error_codes
#error_codes
The error codes for this API.
Returns
Hash{Symbol => ErrorCode}
#info
#info
The info for this API.
Returns
API::Info, nil
#resources
#resources
The resources for this API.
Returns
Hash{Symbol => API::Resource}
#to_h
#to_h
Converts this API to a hash.
Returns
Hash
#types
#types
The types for this API.
Returns
Hash{Symbol => Type}