Skip to content

litencatt/samplar

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

52 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Samplar

Samplar is mountable engine for Rails. Generates API clients tester page.
Recommend only development env.

CircleCI

Support Rails version

gem 'rails', '~> 4.2.11'

Installation

Add to Gemfile.

gem 'samplar'

And then bundle.

$ bundle

Usage

# config/routes.rb

Rails.routes.draw do
  ...

  mount Samplar::Engine => "/samplar"
end

Create config/samplar.yaml

client:
  foo:
  bar:
    - arg1
    - arg2
  self:
    foo:
    bar:
      - arg1
      - arg2

Run rails server

$ bundle exec rails s

And then access to http://localhost:3000/samplar

Example

/sampler page

  • Show client name and methods list when access to /samplarpage.
  • These sample client classes are defined here.
  • And sample samplar.yml is here

image

No argument method

Click Client#foo.
image

Click execute.
Then show the output result.
Client#foo output execute instance method foo.
image

With 2 arguments method

Click Client#bar. This method needs 2 args to call.
image

Input args and click execute.
image

Then show the output result.
image

About LICENSE

This project rocks and uses MIT-LICENSE.