refer 0.5.2 → 1.0.0

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: fe5b190436ed75e3b12069591ee8f8342cee2fdfbfe70e2babeb46b5d0fdac06
4
- data.tar.gz: fcee40d122046e1d10bb971c13dd8bf545d2e451420b9491b2bd491df177244b
3
+ metadata.gz: d15eaaaf713682be3a0baa1dcf1a8152d5e26fd21e3efd979c94446811b2b015
4
+ data.tar.gz: 7e073982ea5562f86928538e6e75f1283a01c8f16ce094c9097a86b30c6fe344
5
5
  SHA512:
6
- metadata.gz: bfd83cbe5bd79a76bb35b04aa1e2a6b6a142014eb1a8d1dd345d2235202a425efb41a82aff46b05d6dec906f63cc9f1220338714144909869a0563046e62ea2e
7
- data.tar.gz: 2fbbf930f66c5e68b629eb8d5153e10e00766acc1e9ada8ba09d201a0127fb447f2c95bc228062fc5d422c67ed76e9d62f34a7c20a18d3c7c6da1c538e08fa4c
6
+ metadata.gz: b0fcd6b0b868db46dbd2f874f0677e3473bf718b16878aa45cd1cce36e814e340072fe8a26ebc4602479d48f383d2bd882724f3726e36be3c62b6074f29ab6cb
7
+ data.tar.gz: ae3f4f3a5edeef1cbd0951f65c984c32e7b6f75bd93118f57c19332611ec3972f33ad4de3ce02943bcf179e8d5067166c568c15eeeedb3df7c3f52addb9f4a3c
@@ -6,7 +6,7 @@ module Refer
6
6
 
7
7
  validates :code, presence: true, uniqueness: true
8
8
 
9
- before_validation if: -> { Refer.code_generator } do
9
+ before_validation if: -> { !code? && Refer.code_generator } do
10
10
  self.code = Refer.code_generator.call(referrer)
11
11
  end
12
12
 
@@ -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/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Refer
2
- VERSION = "0.5.2"
2
+ VERSION = "1.0.0"
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.2
4
+ version: 1.0.0
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.22
79
79
  signing_key:
80
80
  specification_version: 4
81
81
  summary: Referral codes & affiliate links for Ruby on Rails apps