refer 0.5.0 → 0.5.2

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: 5695d0df8966228572d9447611c31055e39fb9d18c3f2a8b98cf951efe5db86a
4
- data.tar.gz: 985bcb344c25e6a78caa7c507bea05b54c8404e674fd1e11c749090482f6cfae
3
+ metadata.gz: fe5b190436ed75e3b12069591ee8f8342cee2fdfbfe70e2babeb46b5d0fdac06
4
+ data.tar.gz: fcee40d122046e1d10bb971c13dd8bf545d2e451420b9491b2bd491df177244b
5
5
  SHA512:
6
- metadata.gz: d04f1b17398ceaf1f6b405d29d5f3e6136caad0438f5bc3b735d167ff41586f4d869bcf04fbcf823b0030de221145cd44263bf72f2834a5aa02fa45c9dc0bb61
7
- data.tar.gz: 74b1a140b5856cb05fef1ffcbaa51bd1730cc83eee0ca8497c84a2a4bb9d15bd39857549087ba54c198a4e115e72a5e50e20f8677909965a6b05ca0d87bc86e5
6
+ metadata.gz: bfd83cbe5bd79a76bb35b04aa1e2a6b6a142014eb1a8d1dd345d2235202a425efb41a82aff46b05d6dec906f63cc9f1220338714144909869a0563046e62ea2e
7
+ data.tar.gz: 2fbbf930f66c5e68b629eb8d5153e10e00766acc1e9ada8ba09d201a0127fb447f2c95bc228062fc5d422c67ed76e9d62f34a7c20a18d3c7c6da1c538e08fa4c
data/README.md CHANGED
@@ -27,7 +27,7 @@ bin/rails db:migrate
27
27
 
28
28
  ## 🧑‍💻 Usage
29
29
 
30
- Refer adds a models to your Rails application for tracking referrals and referral codes.
30
+ Refer adds a model to your Rails application for tracking referrals and referral codes.
31
31
 
32
32
  To track referrals, you'll need to
33
33
 
@@ -48,7 +48,7 @@ user.referral_codes.create(code: "chris")
48
48
  To customize the referral code generator:
49
49
 
50
50
  ```ruby
51
- Refer.code_generator = ->(referrer) { [id, SecureRandom.alphanumeric(8)].join("-") }
51
+ Refer.code_generator = ->(referrer) { [referrer.id, SecureRandom.alphanumeric(8)].join("-") }
52
52
  #=> generates codes like "1-7frb5fUw"
53
53
  ```
54
54
 
data/lib/refer/engine.rb CHANGED
@@ -1,5 +1,15 @@
1
1
  module Refer
2
2
  class Engine < ::Rails::Engine
3
3
  isolate_namespace Refer
4
+
5
+ initializer "refer.hooks" do
6
+ ActiveSupport.on_load(:active_record) do
7
+ include Refer::HasReferrals
8
+ end
9
+
10
+ ActiveSupport.on_load(:action_controller) do
11
+ include Refer::Controller
12
+ end
13
+ end
4
14
  end
5
15
  end
data/lib/refer/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Refer
2
- VERSION = "0.5.0"
2
+ VERSION = "0.5.2"
3
3
  end
data/lib/refer.rb CHANGED
@@ -5,6 +5,10 @@ require "securerandom"
5
5
  module Refer
6
6
  include ActiveSupport::Configurable
7
7
 
8
+ autoload :Controller, "refer/controller"
9
+ autoload :HasReferrals, "refer/has_referrals"
10
+ autoload :Model, "refer/model"
11
+
8
12
  config_accessor :code_generator, default: ->(referrer) { SecureRandom.alphanumeric(8) }
9
13
  config_accessor :cookie_length, default: 30.days
10
14
  config_accessor :cookie_name, default: :refer_code
@@ -53,12 +57,4 @@ module Refer
53
57
  end
54
58
  end
55
59
 
56
- ActiveSupport.on_load(:active_record) do
57
- include Refer::HasReferrals
58
- end
59
-
60
- ActiveSupport.on_load(:action_controller) do
61
- include Refer::Controller
62
- end
63
-
64
60
  ActiveSupport.run_load_hooks(:refer, Refer)
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.0
4
+ version: 0.5.2
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-07-17 00:00:00.000000000 Z
11
+ date: 2024-09-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -34,9 +34,6 @@ files:
34
34
  - MIT-LICENSE
35
35
  - README.md
36
36
  - Rakefile
37
- - app/controllers/concerns/refer/controller.rb
38
- - app/models/concerns/refer/has_referrals.rb
39
- - app/models/concerns/refer/model.rb
40
37
  - app/models/refer/application_record.rb
41
38
  - app/models/refer/referral.rb
42
39
  - app/models/refer/referral_code.rb
@@ -50,7 +47,10 @@ files:
50
47
  - lib/generators/refer/model/USAGE
51
48
  - lib/generators/refer/model/model_generator.rb
52
49
  - lib/refer.rb
50
+ - lib/refer/controller.rb
53
51
  - lib/refer/engine.rb
52
+ - lib/refer/has_referrals.rb
53
+ - lib/refer/model.rb
54
54
  - lib/refer/version.rb
55
55
  - lib/tasks/refer_tasks.rake
56
56
  homepage: https://github.com/excid3/refer
@@ -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.14
78
+ rubygems_version: 3.5.13
79
79
  signing_key:
80
80
  specification_version: 4
81
81
  summary: Referral codes & affiliate links for Ruby on Rails apps
File without changes