amastellone / mail-funnel-client

Mail-Funnel, a Shopify Embedded App available in the Shopify App Store
2 stars 3 forks source link
jquery rails rails5 ruby shopify

Mail-Funnel-Client

Coverage Status Coverage StatusStories in Ready

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:

App Store Config

Development - .env

APP_URL=http://localhost:3000/
REDIRECTION_URL=http://localhost:3000/auth/shopify/callback

Client Security Method

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/

Developmet

Visit (Development)
http://localhost:3000 

Testing

rake
# or
rake test

# Test Individual Client-API Tests
bundle exec rspec ./spec/models/apps_spec.rb # Tests Apps w/ ORM to Server-API

Development

rake test

Staging + Production

Deployment Process
Github -> Circle-CI Server -> Heroku-Staging -> Heroku-Production

Usage + Install

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

Developers

JS Resources for Funnel_Builder Ajax flowchart

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

ruby on rails 3 - Difference between Active Model, Active Record and Active Resource - Stack Overflow

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

A Tour of Rails’ jQuery UJS

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

rack/utils.rb at master · rack/rack