class ApiSpec::Spec

Attributes

endpoints[RW]

Public Class Methods

endpoint(name) { |endpoint| ... } click to toggle source
# File lib/api_spec/lib/api_spec/generator.rb, line 102
def self.endpoint(name)
  endpoint = Endpoint.new(name)
  yield endpoint
  endpoints << endpoint
end
to_hash() click to toggle source
# File lib/api_spec/lib/api_spec/generator.rb, line 94
def self.to_hash
  { 'endpoints' => endpoints.map(&:to_hash) }
end
write_spec(path) click to toggle source
# File lib/api_spec/lib/api_spec/generator.rb, line 98
def self.write_spec(path)
  File.open(path, 'w') { |f| f.write(JSON.pretty_generate(to_hash)) }
end