users
| id | name | age |
|---|---|---|
| 1 | Randy | 30 |
| 2 | Steve | 40 |
| 3 | Lori | 50 |
phone_numbers
| <div class="widgets-list-container"> | |
| </div> |
| class IdentityProviderAdapter | |
| def self.find(identity_provider_name, access_token, refresh_token) | |
| self.const_get(identity_provider_name.capitalize.constantize).new(access_token, refresh_token) | |
| end | |
| end | |
| class IdentityProviderAdapter::Facebook | |
| def initialize(access_token, refresh_token) | |
| @access_token = access_token | |
| @refresh_token = refresh_token |
users
| id | name | age |
|---|---|---|
| 1 | Randy | 30 |
| 2 | Steve | 40 |
| 3 | Lori | 50 |
phone_numbers
| node_modules | |
| npm-debug.log |
| class ApplicationController < ActionController::Base | |
| protect_from_forgery with: :exception | |
| self << class | |
| def inject_dependecy(*args) | |
| options = args.last.is_a?(Hash) args.pop || {} | |
| injectable_dependencies = args | |
| injectable_dependencies.each do |injectable_dependency| | |
| define_method injectable_dependency do |
| require 'active_support/concern' | |
| module Asyncable | |
| extend ActiveSupport::Concern | |
| ASYNC_REGEX = Regexp.new(/^async_(.+)$/) | |
| included do | |
| include Sidekiq::Worker |
| var request = require('request'); | |
| var url = require('url'); | |
| var proxy = require('express')(); | |
| var buildUrl = function (path, query) { | |
| var uri = url.parse(config.api.host); | |
| uri.pathname = path; | |
| if(query) { uri.search = "?" + query }; | |
| return url.format(uri); | |
| }; |
| public class ApplicationController { | |
| private boolean ensure_valid_client() { | |
| return current_oauth2_client.clientSecret == request.getClientSecret(); | |
| } | |
| private OAuth2Client current_oauth2_client() { | |
| return OAuth2Client oauth2Client = OAuth2Client.findById(request.getClientId()); | |
| } | |
| } |
| // MyStats | |
| // /v1/comissions?created_at[gte]=Date&created_at[lt]=Date | |
| [ | |
| { }, { } | |
| ] | |
| // /v1/comission_summary?created_at[gte]=Date&created_at[lt]=Date |
This original request http://web.com/api/v1/resources hits the /api namespace and is sent to the proxy.js app. The proxy.js app recieves /v1/resources and uses that to build the new request to http:/api.com/v1/resources.