disco_app 0.4.0 → 0.4.1

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: 84b367b23693d3ddba896f2aa9cef23fa26bdf6523ce0f93f867eef242fc28cb
4
- data.tar.gz: '09560067f905d48b0ac8563f08fed04a102e5f89eca8d7f7cf8b3d033b644536'
3
+ metadata.gz: 51df5228e93760350ad608d44a2fcba99d5025c5e15c1698aa77f62925fcd737
4
+ data.tar.gz: 69c051d636b71953583bf996e975d619246ab59fdbdc08925fc76f5582366edf
5
5
  SHA512:
6
- metadata.gz: d7f310cfc58f909be8477ee236c6102b838ff39aed149030502257aae325accd478a181ee0ba3136aa75985b9e90bcab13a6b0c4684476c5e564a519cb5e9d00
7
- data.tar.gz: 1a9f06ec962d765f10f1b7cb866e5155d4e6d1d634506bb51e2ed956912501b51019ef71c4c5dbb99fd69eff33134e43ba0dec5745c679a2b03827d2881487bb
6
+ metadata.gz: 0edf00974329538404e8ca34362c60e514f9ec4c8fd15aca7c63a0177557d25c26e7c59a355d80c4eedb6f564126e8361affbf67b5fe12733550e80fbdebe3c5
7
+ data.tar.gz: 0f9059c29371ed0c98a1a429b2f315a50d3a7319090be70027688b4aca8b2711bc9a26e35982d61819cbb294212d33aba07c4b26cd5e75ca8218e36688424421
@@ -0,0 +1,18 @@
1
+ module DiscoApp
2
+ class AppUninstalledJob < DiscoApp::ShopJob
3
+
4
+ before_enqueue { @shop.awaiting_uninstall! }
5
+ before_perform { @shop.uninstalling! }
6
+ after_perform { @shop.uninstalled! }
7
+
8
+ def perform(domain, shop_data)
9
+
10
+ # Mark the shop's charge status as "cancelled" unless charges have been waived.
11
+ unless @shop.charge_waived?
12
+ @shop.charge_cancelled!
13
+ end
14
+
15
+ end
16
+
17
+ end
18
+ end
@@ -0,0 +1,16 @@
1
+ module DiscoApp
2
+ class ShopUpdateJob < DiscoApp::ShopJob
3
+
4
+ def perform(domain, shop_data = nil)
5
+ # If we weren't provided with shop data (eg from a webhook), fetch it.
6
+ shop_data ||= ActiveSupport::JSON::decode(ShopifyAPI::Shop.current.to_json)
7
+
8
+ # Ensure we can access shop data through symbols.
9
+ shop_data = HashWithIndifferentAccess.new(shop_data)
10
+
11
+ # Update model attributes present in both our model and the data hash.
12
+ @shop.update_attributes(shop_data.except(:id, :created_at).slice(*::Shop.column_names))
13
+ end
14
+
15
+ end
16
+ end
@@ -1,3 +1,3 @@
1
1
  module DiscoApp
2
- VERSION = "0.4.0"
2
+ VERSION = "0.4.1"
3
3
  end
@@ -1,16 +1,2 @@
1
- class AppUninstalledJob < DiscoApp::ShopJob
2
-
3
- before_enqueue { @shop.awaiting_uninstall! }
4
- before_perform { @shop.uninstalling! }
5
- after_perform { @shop.uninstalled! }
6
-
7
- def perform(domain, shop_data)
8
-
9
- # Mark the shop's charge status as "cancelled" unless charges have been waived.
10
- unless @shop.charge_waived?
11
- @shop.charge_cancelled!
12
- end
13
-
14
- end
15
-
1
+ class AppUninstalledJob < DiscoApp::AppUninstalledJob
16
2
  end
@@ -1,14 +1,2 @@
1
- class ShopUpdateJob < DiscoApp::ShopJob
2
-
3
- def perform(domain, shop_data = nil)
4
- # If we weren't provided with shop data (eg from a webhook), fetch it.
5
- shop_data ||= ActiveSupport::JSON::decode(ShopifyAPI::Shop.current.to_json)
6
-
7
- # Ensure we can access shop data through symbols.
8
- shop_data = HashWithIndifferentAccess.new(shop_data)
9
-
10
- # Update model attributes present in both our model and the data hash.
11
- @shop.update_attributes(shop_data.except(:id, :created_at).slice(*::Shop.column_names))
12
- end
13
-
14
- end
1
+ class ShopUpdateJob < DiscoApp::ShopUpdateJob
2
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: disco_app
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 0.4.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gavin Ballard
@@ -155,7 +155,9 @@ files:
155
155
  - app/controllers/disco_app/webhooks_controller.rb
156
156
  - app/helpers/disco_app/application_helper.rb
157
157
  - app/jobs/disco_app/app_installed_job.rb
158
+ - app/jobs/disco_app/app_uninstalled_job.rb
158
159
  - app/jobs/disco_app/shop_job.rb
160
+ - app/jobs/disco_app/shop_update_job.rb
159
161
  - app/models/disco_app/shop.rb
160
162
  - app/services/disco_app/charges_service.rb
161
163
  - app/views/disco_app/charges/activate.html.erb