refer 0.5.3 → 1.0.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: df22afceb80a13a9fa4f04bea4107628f39dc91a2d2d952f1aef86fe20196555
4
- data.tar.gz: a2c77cbb2c59568fc7df60a0383f0daf0d7276869bda44b64cbf7be21b8f2649
3
+ metadata.gz: bde22f4ffb206d7186ae2426170e1e321698faa890263ec441a1591694765580
4
+ data.tar.gz: c3e1d75252657910068d342e12433220a99a6097431cdf984b9fd120133296b7
5
5
  SHA512:
6
- metadata.gz: fd600da5fe3d3809e23444f5ffc839c337ce84cb1fd7495664660f257a4389b9f57344144059406b83c99906b9bf6c70b47b4eb4a393799b185bb3c8cde3ef17
7
- data.tar.gz: 4750eaca271ed54939b0de254fbae45b8ee74ff967d32f907aca52064cb7508e1a9b4ccf91d2ac8a595b86b63e3585508e7a7403f58ee4ff2b8a72ce65e623fe
6
+ metadata.gz: 8938f27931aa94c8215924c0289a2c995a8504d574626e171f596a3e3f221851dc1ac933bd66aac1795bd98fafc0c64658d9a2cc7b181d7e7a3c6ba61fe9a3f1
7
+ data.tar.gz: 94f3bdeff953bd1c41afb13b6a18f893eae3189d845ac69d8203f2cdac89c511cac6976b209799b2c9bdb41ad9ef6a24e1602496c96b37c2f90600c526fc97ca
@@ -1,4 +1,4 @@
1
- class CreateReferVisits < ActiveRecord::Migration[7.2]
1
+ class CreateReferVisits < ActiveRecord::Migration[6.1]
2
2
  def change
3
3
  create_table :refer_visits do |t|
4
4
  t.belongs_to :referral_code, null: false, foreign_key: { to_table: :refer_referral_codes }
@@ -14,12 +14,12 @@ module Refer
14
14
 
15
15
  private
16
16
 
17
- def set_refer_cookie(param_name: Refer.param_name, cookie_name: Refer.cookie_name)
18
- code = params[param_name]
17
+ def set_refer_cookie(param_name: Refer.param_name, cookie_name: Refer.cookie_name, code: nil, track_visit: Refer.track_visits)
18
+ code ||= params[param_name]
19
19
  return if code.blank?
20
20
 
21
21
  cookies[cookie_name] = Refer.cookie(code) if Refer.overwrite_cookie || cookies[cookie_name].blank?
22
- ReferralCode.find_by(code: code)&.track_visit(request) if Refer.track_visits
22
+ ReferralCode.find_by(code: code)&.track_visit(request) if track_visit
23
23
  end
24
24
  end
25
25
  end
data/lib/refer/model.rb CHANGED
@@ -3,9 +3,9 @@ module Refer
3
3
  extend ActiveSupport::Concern
4
4
 
5
5
  included do
6
- has_many :referral_codes, inverse_of: :referrer, class_name: "Refer::ReferralCode", dependent: :destroy
7
- has_many :referrals, inverse_of: :referrer, class_name: "Refer::Referral", dependent: :destroy
8
- has_one :referral, inverse_of: :referee, class_name: "Refer::Referral", dependent: :destroy
6
+ has_many :referral_codes, as: :referrer, class_name: "Refer::ReferralCode", dependent: :destroy
7
+ has_many :referrals, as: :referrer, class_name: "Refer::Referral", dependent: :destroy
8
+ has_one :referral, as: :referee, class_name: "Refer::Referral", dependent: :destroy
9
9
  delegate :referrer, to: :referral
10
10
  end
11
11
  end
data/lib/refer/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Refer
2
- VERSION = "0.5.3"
2
+ VERSION = "1.0.1"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: refer
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.3
4
+ version: 1.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chris Oliver
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-09-05 00:00:00.000000000 Z
11
+ date: 2024-11-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: 6.1.0
19
+ version: 7.1.0
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - ">="
25
25
  - !ruby/object:Gem::Version
26
- version: 6.1.0
26
+ version: 7.1.0
27
27
  description: Referral codes & affiliate links for Ruby on Rails apps
28
28
  email:
29
29
  - excid3@gmail.com
@@ -75,7 +75,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
75
75
  - !ruby/object:Gem::Version
76
76
  version: '0'
77
77
  requirements: []
78
- rubygems_version: 3.5.13
78
+ rubygems_version: 3.5.23
79
79
  signing_key:
80
80
  specification_version: 4
81
81
  summary: Referral codes & affiliate links for Ruby on Rails apps