Mail-Funnel is a Ruby on Rails Embedded Shopify App (Available in the Shopify App Store). It uses Her ORM to connect to it's REST Server.
Mail-Funnel Project:
Development - .env
APP_URL=http://localhost:3000/
REDIRECTION_URL=http://localhost:3000/auth/shopify/callback
We are using JWT, automaticaly added to the header on the Client, and added in the Rack on the server
# Client
https://www.sitepoint.com/introduction-to-using-jwt-in-rails/
# Both
https://github.com/nsarno/knock
# Server (and maybe client)
https://github.com/eigenbart/rack-jwt
https://github.com/jgalmeida/rack-jwt-auth
https://github.com/jwt/ruby-jwt
https://jwt.io/
Visit (Development)
http://localhost:3000
rake
# or
rake test
# Test Individual Client-API Tests
bundle exec rspec ./spec/models/apps_spec.rb # Tests Apps w/ ORM to Server-API
rake test
Deployment Process
Github -> Circle-CI Server -> Heroku-Staging -> Heroku-Production
Warning: You must To start the client execute this
bundle exec rails server
Then, to install this Shopify App, go to
http://localhost:3000/login (or /install or /auth)
Once you have added the client, you must add the server too
TODO: Server install URL is wrong
http://localhost:3001/auth
Then once you visit the client - you will be forwarded to your App's page in the Shopify store it was installed in.
NOTICE: Your app will not load by default, while it is being run on your localhost, because Chrome does not allow cross-site-scripting.
You MUST disable this by clicking the icon in the URL-bar, on the right, and telling it to load the script regardless
Visit App Install Page
http://localhost:3000 / mf-client.bluehelmet.io
This will foward you to the Shopify Store's internal Mail Client App URL.
http://your-store.myshopify.com
Mail-Funnel API Server (Dev) / (Staging) / (Production)
http://localhost:3001 / http://mf-server.bluehelmet.io
bluehelmet-dev ~ Apps ~ Shopify
Working with JavaScript in Rails — Ruby on Rails Guides
akzhan/jquery-ujs: Ruby on Rails unobtrusive scripting adapter for jQuery
ActionController::RequestForgeryProtection
Active Model Basics — Ruby on Rails Guides
Action View Overview — Ruby on Rails Guides
ActiveModel | Running with Ruby
Active Record Query Interface — Ruby on Rails Guides
External articles · rails/jquery-ujs Wiki
jquery-ujs/rails.js at asynchronous-call-to-confirm · akzhan/jquery-ujs
Rails 3 Remote Links and Forms: A Definitive Guide - Alfa Jango Blog
Rails 3 Remote Links and Forms Part 2: Data-type (with jQuery) - Alfa Jango Blog
Rails jQuery UJS: Now Interactive - Alfa Jango Blog
rails/jbuilder: Jbuilder: generate JSON objects with a Builder-style DSL
Class: ActiveResource::Schema — Documentation for activeresource (4.0.0)
Rails 4: How to partials & AJAX, dead easy (Example) | Coderwall
Rails 4 rendering a partial with ajax, jquery, :remote => true, and respond_to - Stack Overflow
jquery - How to asynchronously load a partial page in rails - Stack Overflow
sdrdis/jquery.flowchart: JQuery plugin that allows you to draw a flow chart.
jQuery.ajax() | jQuery API Documentation
Automatically adding CSRF tokens to ajax calls when using jQuery
Rails 3: How to return errors in a JSON request? - Stack Overflow