shopify-gold 4.0.0 → 4.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: 9fcecad6aca73ac1e0cc4f97b8f819d35907c32aa1bb00e40e6bbb19e35fc328
4
- data.tar.gz: 74f433ee134487242e44fa145273eacbc5a3bc933826490c1a024f34d7d10b89
3
+ metadata.gz: 3ae3534c766c64f75ddc836965f6ed350122bff113449ebd0d6cf36ca3490a10
4
+ data.tar.gz: e6334c900e2fead3533daf82accdb295a7322e45703b7f7378c17b02d7f310d9
5
5
  SHA512:
6
- metadata.gz: 2b0fcb9fa69c799007609982fc77717bc09efd13921373561e122c42b29a472bac7a51fc941c86ae57f5ccbcdd2c715970a8ee9f61b5b901ca8bcbe4c652f894
7
- data.tar.gz: d0408016b0e8995a3e3f57957b6fe0a42c7f1cb5fc8c6d527fbf7f1c0f67a02612f7cf31f389936954792c728a768d75ec7cf6839e7f40dbb39f2b9ca0f0e835
6
+ metadata.gz: d6e88dbb63de80478f8ed5c25b645571de75def9f1378b1e8f7729c9a32d2d508223507332441c7687600fc8c26674b993896399046545e5939546f5eb9fdc1a
7
+ data.tar.gz: 0244c687235812af8951ac46e9bc7e4d1938340984886a3540c0531e579b237d4e62fff74ce7cbbb1310d31955fee1c044d75d6bf2ffd4da50e53670951d64f1
data/README.md CHANGED
@@ -234,6 +234,14 @@ The shop will automatically be pushed through the state machine (new, accepted_t
234
234
  Note that the `tier_id` must match a tier setup in Gold. If that shop does not
235
235
  have a charge that matches the tier's price, a new charge will be requested.
236
236
 
237
+ ## Referral affiliates
238
+ Gold supports the ability to track affiliate codes that link back to a shop. A referral can
239
+ apply a discount to a shop when they sign up with a code. It works by sending merchants to a
240
+ link like `/referral?code=HELIUM`. They will be redirected to the URL setup in config.
241
+
242
+ The admin referral controller provides some basic CRUD operations for managing affiliates, but
243
+ your app will need to implement the logic for rendering referrals.
244
+
237
245
  ## Contributing
238
246
 
239
247
  Run tests with:
@@ -257,5 +265,8 @@ To release gem, run `gem release`, which depends on having `gem-release` install
257
265
  on your system.
258
266
 
259
267
  ## Changelog
268
+ Version 4.0.0
269
+ - Added referral affiliates
270
+
260
271
  Version 3.2.0
261
272
  - Removed `force_embedded_redirect` config option
@@ -11,7 +11,7 @@ module Gold
11
11
  flash[:danger] = "Failed to create, #{message}"
12
12
  end
13
13
 
14
- redirect_back(fallback_location: "/admin")
14
+ redirect_to "#{request.path}/#{referral.id}"
15
15
  end
16
16
 
17
17
  def update
@@ -27,6 +27,16 @@ module Gold
27
27
  redirect_back(fallback_location: "/admin")
28
28
  end
29
29
 
30
+ def delete
31
+ referral = Referral.find(params[:id])
32
+
33
+ referral.destroy!
34
+
35
+ flash[:success] = "Poof! Code #{referral.code} no longer exists"
36
+
37
+ redirect_to gold_admin_engine.referrals_path
38
+ end
39
+
30
40
  private
31
41
 
32
42
  def referral_params
@@ -43,8 +43,8 @@ module Gold
43
43
  billing # Expose the @billing variable to the view
44
44
 
45
45
  # Apply a referral tracking. Don't overwrite an existing code
46
- if !billing.referral && session[:gold_referral_code]
47
- referral = Gold::Referral.find_by(code: session[:gold_referral_code])
46
+ if !billing.referral && session[:gold_referral_id]
47
+ referral = Gold::Referral.find_by(id: session[:gold_referral_id])
48
48
 
49
49
  if referral
50
50
  billing.referral = referral
@@ -4,7 +4,7 @@ module Gold
4
4
  def track
5
5
  referral = Referral.find_by(code: params[:code])
6
6
 
7
- session[:gold_referral_code] = referral.code if referral
7
+ session[:gold_referral_id] = referral.id if referral
8
8
 
9
9
  redirect_to Gold.configuration.referral_redirect_url
10
10
  end
@@ -0,0 +1,3 @@
1
+ <%= form_for(referral, method: "delete", url: gold_admin_engine.delete_referral_path(referral.id)) do |f| %>
2
+ <%= submit_tag "Delete referral", confirm: "Are you sure want to permanently delete this referral?", class: "btn btn-danger" %>
3
+ <% end %>
data/config/routes.rb CHANGED
@@ -36,5 +36,6 @@ Gold::AdminEngine.routes.draw do
36
36
  scope :referrals do
37
37
  post "/", to: "admin/referrals#create", as: "referrals"
38
38
  patch "/:id", to: "admin/referrals#update", as: "referral"
39
+ delete "/:id", to: "admin/referrals#delete", as: "delete_referral"
39
40
  end
40
41
  end
data/lib/gold/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Gold
2
- VERSION = "4.0.0".freeze
2
+ VERSION = "4.0.1".freeze
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: shopify-gold
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.0.0
4
+ version: 4.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrew Smith
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2020-01-18 00:00:00.000000000 Z
12
+ date: 2020-01-20 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails
@@ -155,16 +155,16 @@ dependencies:
155
155
  name: shopify_app
156
156
  requirement: !ruby/object:Gem::Requirement
157
157
  requirements:
158
- - - ">="
158
+ - - "~>"
159
159
  - !ruby/object:Gem::Version
160
- version: '0'
160
+ version: 11.3.0
161
161
  type: :development
162
162
  prerelease: false
163
163
  version_requirements: !ruby/object:Gem::Requirement
164
164
  requirements:
165
- - - ">="
165
+ - - "~>"
166
166
  - !ruby/object:Gem::Version
167
- version: '0'
167
+ version: 11.3.0
168
168
  - !ruby/object:Gem::Dependency
169
169
  name: sqlite3
170
170
  requirement: !ruby/object:Gem::Requirement
@@ -259,6 +259,7 @@ files:
259
259
  - app/views/gold/admin/billing/_tier.erb
260
260
  - app/views/gold/admin/billing/_trial_days.erb
261
261
  - app/views/gold/admin/referrals/_billings.erb
262
+ - app/views/gold/admin/referrals/_delete.erb
262
263
  - app/views/gold/admin/referrals/_form.erb
263
264
  - app/views/gold/billing/_inner_head.html.erb
264
265
  - app/views/gold/billing/declined_charge.html.erb
@@ -314,7 +315,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
314
315
  - !ruby/object:Gem::Version
315
316
  version: '0'
316
317
  requirements: []
317
- rubygems_version: 3.0.1
318
+ rubygems_version: 3.0.3
318
319
  signing_key:
319
320
  specification_version: 4
320
321
  summary: Helium's approach to billing for Shopify apps