Project

referrals

0.0
No commit activity in last 3 years
No release in over 3 years
There's a lot of open issues
Responsible for handling referral links and all referral related operations like capture actions, show partner dashboard, payments etc.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
 Dependencies

Development

Runtime

>= 0
 Project Readme

referrals [under development - not yet production ready]

Build Status Code Climate Gem Version License: MIT

Referrals engine dedicated for Ruby on Rails based applications

Referrals

Short description and motivation.

Usage

How to use my plugin.

Installation

Add this line to your application's Gemfile:

gem 'referrals'

And then execute:

$ bundle

After that run:

bin/rails referrals:install:migrations

It will copy engine's migrations to your project. Now migrate:

# Rails 4
bin/rake db:migrate

# Rails 5
bin/rails db:migrate

Configuration file

@todo ...

Integration with Rails

Controller helpers

Handling referral cookies

# in your controller where you want to have cookies handling available
class ApplicationController < ActionController::Base
  include Referrals::CookiesConcern  
  # ...  
end  

Assigning referrals to partner

# in your controller where you want to assign user to partner
class RegistrationsController < ActionController::Base
  include Referrals::OperationsConcern  
  # ...  
  def register
    # eg: assign referrals to partner when user
    # just registered
    # Now resource under 'registered_user' will be assigned to partner
    # based on value in cookie
    assign_referral_to_partner(registered_user)
  end
end  

Capturing referral action

# in your controller where you want to capture referral action
class PaymentController < ActionController::Base
  # 1. First: include operations module
  include Referrals::OperationsConcern  
  
  def make_payment   
    #2. Second: capture action made by user eg: payment for subscription
    #   This way operation will be captured and proper amount will be added
    #   To partner's account. 
    capture_referral_action(referral: current_user, amount: Money.new(1030), info: 'Payment for subscription')
    
    # ...
    
    render plain: 'ok'
  end
  
  
end

Rescue from errors

@todo ...

Contributing

Contribution directions go here.

License

The gem is available as open source under the terms of the MIT License.