Add REST API stitching

This commit is contained in:
Vikram Rangnekar
2019-05-12 19:27:26 -04:00
parent 6c9accb628
commit f16e95ef22
40 changed files with 1127 additions and 479 deletions

View File

@ -1,3 +1,2 @@
class ApplicationController < ActionController::Base
before_action :authenticate_user!
end

View File

@ -1,4 +1,5 @@
class ProductsController < ApplicationController
before_action :authenticate_user!
before_action :set_product, only: [:show, :edit, :update, :destroy]
# GET /products

View File

@ -0,0 +1,55 @@
class StripeController < ApplicationController
# GET /stripe/1
# GET /stripe/1.json
def show
data = '{ "data": [
{
"id": 1,
"customer_id": "$id",
"object": "charge",
"amount": 100,
"amount_refunded": 0,
"date": "01/01/2019",
"application": null,
"billing_details": {
"address": "1 Infinity Drive",
"zipcode": "94024"
}
},
{
"id": 2,
"customer_id": "$id",
"object": "charge",
"amount": 150,
"amount_refunded": 0,
"date": "02/18/2019",
"billing_details": {
"address": "1 Infinity Drive",
"zipcode": "94024"
}
},
{
"id": 3,
"customer_id": "$id",
"object": "charge",
"amount": 150,
"amount_refunded": 50,
"date": "03/21/2019",
"billing_details": {
"address": "1 Infinity Drive",
"zipcode": "94024"
}
}
],
"data_type": "charges",
"total_count": 3,
"next_cursor": null
}'
data.gsub!("$id", params[:id])
result = JSON.parse(data)
render json: result
end
end