referral_box 0.1.8 → 0.1.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d8ba983787c512d738d87748d8aef25955fc322c491bdabfd47ad8fda6980984
4
- data.tar.gz: 29a2e05f19614deee0edde3005fc56788efeea814c78bdd0eed3eee37953f054
3
+ metadata.gz: d94d16e8f914150bbac4001084c46567dba26ce702c3671496f1bfd93537d5aa
4
+ data.tar.gz: 726b0ce463ca8d89d32d3087a133c38b8d30fea686841951cef5bcd7dd6df25c
5
5
  SHA512:
6
- metadata.gz: bddb9b69fa3af2ad73bbd3ff32ca2de283611f75853731bf704bcf98b976c5b61da069ff1ce4364fc5382c323fe63aefb9b4b45c5131e5fc556566dfdd3e0f5f
7
- data.tar.gz: 76dd52bfcbff503d155135d408bb81d4ec1095c3021a642f42d7bbf2abb352ffcdc04519478765e7f0bfcc1291886dcda4b18113eb5054b6c19014cb224f1c54
6
+ metadata.gz: 05063a5582c13068d7f9ff0afe4137e9377da78b0537804c0a271f7f04811255a1784b521d8e28886d01b35491ca1f1d1c54abb26cc86a0b99771df5691516fd
7
+ data.tar.gz: 38fb4955c59317e2e362599739c75bc04684bef7b6c90cc1efff2d6ba73c63bae05bdce07754577f96ea74c5f2130decd907853a57938a47500956b62645e549
data/CHANGELOG.md CHANGED
@@ -7,6 +7,18 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [0.1.9] - 2025-01-XX
11
+
12
+ ### Added
13
+ - **Logo**: Added ReferralBox logo to the gem and README
14
+ - **Better Model Injection**: Improved generator to handle different model inheritance patterns
15
+ - **Manual Instructions**: Clear instructions when automatic model injection fails
16
+
17
+ ### Fixed
18
+ - **Generator Issues**: Fixed "File unchanged" error by improving model method injection logic
19
+ - **Model Detection**: Better handling of models that inherit from different base classes
20
+ - **User Experience**: Clearer error messages and manual setup instructions
21
+
10
22
  ## [0.1.8] - 2025-01-XX
11
23
 
12
24
  ### Added
data/README.md CHANGED
@@ -1,5 +1,7 @@
1
1
  # ReferralBox 📦
2
2
 
3
+ ![ReferralBox Logo](logo.png)
4
+
3
5
  A flexible Ruby gem for building loyalty and referral systems in Rails apps.
4
6
 
5
7
  * 🎁 Reward users with points based on their activity
@@ -59,18 +59,30 @@ module ReferralBox
59
59
  model_file = "app/models/#{@model_class.underscore}.rb"
60
60
 
61
61
  if File.exist?(model_file)
62
- # Check if methods already exist
63
62
  content = File.read(model_file)
63
+
64
+ # Check if methods already exist
64
65
  if content.include?('has_many :referral_box_transactions')
65
66
  puts "ReferralBox methods already exist in #{@model_class} model."
66
67
  else
67
- inject_into_file model_file, after: "class #{@model_class} < ApplicationRecord" do
68
- "\n " + generate_model_methods(@model_class)
68
+ # Try to inject after the class definition
69
+ if content.match(/class #{@model_class}\s+<\s+ApplicationRecord/)
70
+ inject_into_file model_file, after: "class #{@model_class} < ApplicationRecord" do
71
+ "\n " + generate_model_methods(@model_class)
72
+ end
73
+ puts "Added ReferralBox methods to #{@model_class} model."
74
+ elsif content.match(/class #{@model_class}\s+<\s+ActiveRecord::Base/)
75
+ inject_into_file model_file, after: "class #{@model_class} < ActiveRecord::Base" do
76
+ "\n " + generate_model_methods(@model_class)
77
+ end
78
+ puts "Added ReferralBox methods to #{@model_class} model."
79
+ else
80
+ # If we can't find the class definition, show manual instructions
81
+ show_manual_model_instructions(@model_class)
69
82
  end
70
- puts "Added ReferralBox methods to #{@model_class} model."
71
83
  end
72
84
  else
73
- puts "Warning: #{model_file} not found. Please manually add ReferralBox methods to your #{@model_class} model."
85
+ show_manual_model_instructions(@model_class)
74
86
  end
75
87
  end
76
88
  end
@@ -89,6 +101,17 @@ module ReferralBox
89
101
 
90
102
  private
91
103
 
104
+ def show_manual_model_instructions(model_class)
105
+ puts "\n" + "="*60
106
+ puts "Manual Model Setup Required"
107
+ puts "="*60
108
+ puts "\nPlease manually add the following methods to your #{model_class} model:"
109
+ puts "\nFile: app/models/#{model_class.underscore}.rb"
110
+ puts "\nAdd this inside your #{model_class} class:"
111
+ puts "\n" + generate_model_methods(model_class)
112
+ puts "\n" + "="*60
113
+ end
114
+
92
115
  def update_initializer_with_model(model_class)
93
116
  initializer_path = "config/initializers/referral_box.rb"
94
117
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module ReferralBox
4
- VERSION = "0.1.8"
4
+ VERSION = "0.1.9"
5
5
  end
data/logo.png ADDED
@@ -0,0 +1,3 @@
1
+ <?xml version="1.0" encoding="utf-8"?><Error><Code>AuthenticationFailed</Code><Message>Server failed to authenticate the request. Make sure the value of Authorization header is formed correctly including the signature.
2
+ RequestId:0c3a4660-c01e-00b0-62e3-fecd34000000
3
+ Time:2025-07-27T10:47:25.3812938Z</Message><AuthenticationErrorDetail>Signed expiry time [Sun, 27 Jul 2025 01:33:43 GMT] must be after signed start time [Sun, 27 Jul 2025 10:47:25 GMT]</AuthenticationErrorDetail></Error>
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: referral_box
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.8
4
+ version: 0.1.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kapil Dev Pal
@@ -185,6 +185,7 @@ files:
185
185
  - lib/referral_box/models/referral_log.rb
186
186
  - lib/referral_box/models/transaction.rb
187
187
  - lib/referral_box/version.rb
188
+ - logo.png
188
189
  homepage: https://github.com/KapilDevPal/referral_box
189
190
  licenses:
190
191
  - MIT