How to generate swagger without writing spec files - ruby-on-rails-3

I am looking for a gem which will generate swagger doc and showed it on the swagger UI, I came across rswag gem but it requires spec file needs to be present for generating the swagger doc
Is there any gem that will auto generate swagger doc if I put it in on the API controller?

I built an open-source tool to make this easy. Instead of integrating at the code level, the project uses a local proxy to analyze real development traffic and updates your API spec when it observes new behavior in the API. https://github.com/opticdev/optic
For Rails, the only change you have to make is to make the switch from using:
rails server
To starting your API with Optic's start command.
api start
When new API behavior is detected, you can add it to your spec using our UI. Here's an example.

Related

How do I create my own API in Yii2?

I want to create API methods which you can access form another platform. Just see the following diagram.
In the above image you can see how to fetch data from Yii2 app using another application, I wanna use same procedure when I going to push data into Yii2 application from the another application. That's means Yii2 just provides api methods to clint to push/pull data.
Give me some suggestion?
Yii2 provides ready to use RESTful Web Service API. http://www.yiiframework.com/doc-2.0/guide-rest-quick-start.html
First of all, you will need separate module for API.
If you use Advanced template (with backend, frontend), you'll need to create api directory in root level of your project. If your project is big, and API will changes in future and your API is for many clients, you should make versioning API. Create directory "modules" in api directory, then create directory "v1" in "modules". In future, if you'll need make a huge changes, create second directory, like "v2".
If you use Basic template, just create modules directory, then create API module.

Building a Custom API on top of Parse.com?

I'm planning on building a developer API similar to what Uber and Yo have done. Is it possible to build such API if my app's backend is powered by parse.com? I don't want my custom API pointing to parse, but instead my own site.
I'm planning on using ruby, and was wondering if there would be any limitations over other options (not sure what options I have). Thanks
I'm not sure if it is possible using ruby, but I know it's definitely possible to build your own REST API.
We have decided to go a bit further and wrote a parse-angular seed project for developing web apps. It can be found here.
After you pulled it, do a npm install
As usual,
cloud code should go into cloud/main.js
express code: cloud/app.js
angular code: cloud/public/js/
Note that: You will need to change your AppId and AppKey in
config/global.json
cloud/public/js/app.js
As for custom apis, you can define your own in cloud/routes/api.js.
At this point you should have a nice parse-angular project set up and good to go.
If there's anything wrong, please feel free to open a pull request. :)

How to add web hook on specific build in TeamCity

How to trigger build and add web hook on it via REST API? Or simply, how to add web hook on build by ID via API?
I viewed all the TC REST documentation but didn't find the answer.
Thank you.
There is documentation for triggering a build via REST API since TeamCity 8.1 here. Basically, you need to sent a POST request to http://[server]/httpAuth/app/rest/buildQueue with the build node as the content. There are build node examples in the documentation. If you're using an earlier version of TeamCity, you can trigger a build via script by following the instructions here.
I haven't worked with it, but there's a plugin, tcWebHookTrigger, that you can use to make working with TeamCity's inbound API calls easier here and it has documentation that should be able to get you started.

How to extend heroku-buildpack-core-data with a complete web frontend

I'm impressed with the Heroku recently added heroku-buildpack-core-data by #mattt (more info here) that helps a lot in building a web API for core-data backed iOS Apps. I would like to extend it to have also a web front-end. I see that it has a Sinatra+Sequel app inside.
Which is the heroku-friendly way to add this?
Do I have to fork and extend the buildpack?
You can find instructions on how to extend this functionality with Rack::CoreData on the Core Data Buildpack Repository:
The Core Data Buildpack is designed to encourage rapid prototyping, but should not be used on its own in production applications.
Rather, you are encouraged to create an application using Rack::CoreData directly, which allows you to extend the Core Data scaffolding with Rack applications, such as Rails or Sinatra, and middleware. Here's an example config.ru file:
config.ru
require 'bundler'
Bundler.require
DB = Sequel.connect(ENV['DATABASE_URL'])
run Rack::CoreData('./Example.xcdatamodeld')

fileupload and backbone.js + Rails

I managed to create a small app that uses backbone.js for CRUD process.
Now i am trying to include file upload as well in "Create". i m using "paperclip" to upload image. As i am learning about backbone.js please tell me some approach to making it?
You cannot do this with backbone models. You will have to create a form (including the file field) on the client side and post form to the server.
You can use something like that on the client:
http://www.williambharding.com/blog/rails/rails-ajax-image-uploading-made-simple-with-jquery/
You may want to check out the jquery.iframe.transport plugin. Since you're using rails 3, you can use remotipart instead (it bundles the iframe.transport plugin), which hooks into rails's ujs driver to automatically add support for file upload in ajax requests.