Skip to content

Latest commit

 

History

History
137 lines (97 loc) · 4.14 KB

README-Merge-Conflict.md

File metadata and controls

137 lines (97 loc) · 4.14 KB

Mail-Funnel-Server API

Rails JSON API RESTful Server, that also handles Shopify Webhooks and a Rails Cron-Job Worker.

Server-Features

The purpose of this server is to serve the mail-funnel-client (soon available in app-store) with the following services: Shopify Webhooks, REST CRUD JSON Web-Services and a Ruby background-job worker.

Shopify Webhooks

  • Shopify Webhooks - Shopify-API is configured and authenticated and the hooks are ready in /app/api/api.rb

REST JSON Web-Services

Background-Jobs Worker

  • A background process (IE: Job / Worker)
  • Worker runs every 5 minutes , iterating through each row in the Jobs table
  • The Worker checks each Job's and evaluates if it should be executed based on the following algorithm.

Job-Algorithm

  1. Evaluate the Job's "frequency" value and "frequency-value" value.
  • Frequency:String = execute_once (default), (currently disabled: execute_twice, execute_thrice)
  • Frequency-Value::Integer (military-style / minutes are multiples of 5) = 0030, 1100, 1345, 2005
  1. Check the Executed:Boolean param, check if job has been executed yet
  • (Disabled)'Executed_Count:Integer` param (record how many times it has been executed)

Development

  • First download and install Ngrok (http://ngrok.com but we have a in our apps/bin), and run it

Developer Setup

./ngrok http 3001   # This starts ngrok

You will need to configure your .env first. The .env can be used with the gem 'dotenv'

RAILS_ENV=Development
APP_NAME=mailfunnel-server
APP_KEY=##KEY########
APP_SECRET=##SECRET###
APP_URL=http://GENERATED-URL.ngrok.io/api/ # Or your servers URL
APP_SCOPE = "read_orders, read_products"

Then run the server on port 3001

rails s -p 3001

Mail-Funnel REST Server

Endpoints

Rails JSON REST API
http://mailfunnel.bluehelmet.io

Shopify API Endpoint
http://mailfunnel.bluehelmet.io/api/

Developer Resources

Rails JSON JWT

API JSON Authentication OLD-DEPRACATED

API Docs:

Workers

Mailers / Sendgrid Mailers

Deployment / Servers / Services

  • Github
  • Pushed to GitHub
  • Code-Analysis Service(s) Executed Automatically
  • Circle-CI
  • coveralls.io - Test Coverage Executed
  • depbot.io - Dependency Analysis
  • Heroku-Staging
  • Builds temporary Heroku server, destroys 5 days after last use
  • Creates new Heroku server to test production data
  • Heroku-Production
    • Rollbar.io - Error / Log Monitoring + Reporting Tool
  • Mail-Funnel-Client
  • Rack::JWT - This gem provides JSON Web Token (JWT) based authentication.

Production Server

Heroku

Travis-CI OR Circle-CI

Reviewable.io

Sentry.io

Dependency Security Analyzer