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 +4 -4
- data/app/jobs/disco_app/app_uninstalled_job.rb +18 -0
- data/app/jobs/disco_app/shop_update_job.rb +16 -0
- data/lib/disco_app/version.rb +1 -1
- data/lib/generators/disco_app/templates/jobs/app_uninstalled_job.rb +1 -15
- data/lib/generators/disco_app/templates/jobs/shop_update_job.rb +2 -14
- metadata +3 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 51df5228e93760350ad608d44a2fcba99d5025c5e15c1698aa77f62925fcd737
|
4
|
+
data.tar.gz: 69c051d636b71953583bf996e975d619246ab59fdbdc08925fc76f5582366edf
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
data/lib/disco_app/version.rb
CHANGED
@@ -1,16 +1,2 @@
|
|
1
|
-
class AppUninstalledJob < DiscoApp::
|
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::
|
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.
|
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
|