exvo_notifications 0.2.2 → 0.2.3

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.
@@ -1,33 +1,6 @@
1
1
  module ExvoNotifications::Controllers::Access
2
2
  def self.included(base)
3
- base.send :include, InstanceMethods
3
+ base.send :include, ExvoNotifications::Controllers::Methods
4
4
  base.helper_method :check_access
5
5
  end
6
-
7
- module InstanceMethods
8
-
9
- protected
10
-
11
- def check_access
12
- check_access_on_store unless current_user.plan
13
- end
14
-
15
- def check_access_on_store
16
- begin
17
- consumer = ExvoAuth::Autonomous::Consumer.new(:provider_id => ENV['EXVO_STORE_CLIENT_ID'])
18
- response = consumer.get("/editions", { :query => { :user_uid => current_user.uid } } )
19
- if response.code == 200
20
- if response.parsed_response["edition"] == false
21
- redirect_to response.parsed_response["url"]
22
- else
23
- current_user.update_attributes(:plan => response.parsed_response["edition"])
24
- end
25
- else
26
- raise "unknown status"
27
- end
28
- rescue
29
- render :file => 'public/not_working.html', :layout => false
30
- end
31
- end
32
- end
33
6
  end
@@ -0,0 +1,27 @@
1
+ module ExvoNotifications::Controllers::Methods
2
+
3
+ protected
4
+
5
+ def check_access
6
+ check_access_on_store unless current_user.plan
7
+ end
8
+
9
+ def check_access_on_store
10
+ begin
11
+ consumer = ExvoAuth::Autonomous::Consumer.new(:provider_id => ENV['EXVO_STORE_CLIENT_ID'])
12
+ response = consumer.get("/editions", { :query => { :user_uid => current_user.uid } } )
13
+ if response.code == 200
14
+ if response.parsed_response["edition"] == false
15
+ redirect_to response.parsed_response["url"]
16
+ else
17
+ current_user.update_attributes(:plan => response.parsed_response["edition"])
18
+ end
19
+ else
20
+ raise "unknown status"
21
+ end
22
+ rescue
23
+ render :file => 'public/not_working.html', :layout => false
24
+ end
25
+ end
26
+
27
+ end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: exvo_notifications
3
3
  version: !ruby/object:Gem::Version
4
- hash: 19
4
+ hash: 17
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 2
9
- - 2
10
- version: 0.2.2
9
+ - 3
10
+ version: 0.2.3
11
11
  platform: ruby
12
12
  authors:
13
13
  - "Robert S\xC4\x99k"
@@ -33,6 +33,7 @@ files:
33
33
  - config/routes.rb
34
34
  - lib/exvo_notifications.rb
35
35
  - lib/exvo_notifications/controllers/access.rb
36
+ - lib/exvo_notifications/controllers/methods.rb
36
37
  - lib/exvo_notifications/engine.rb
37
38
  - lib/generators/exvo_notifications/exvo_notifications_generator.rb
38
39
  - lib/generators/exvo_notifications/templates/migration.rb