exvo_notifications 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/app/controllers/exvo_notifications/notifications_controller.rb +19 -0
- data/config/routes.rb +5 -0
- data/lib/exvo_notifications/controllers/access.rb +28 -0
- data/lib/exvo_notifications/engine.rb +12 -0
- data/lib/exvo_notifications/pages/not_working.html +131 -0
- data/lib/exvo_notifications/tasks/tasks.rake +6 -0
- data/lib/exvo_notifications.rb +3 -0
- data/lib/generators/exvo_notifications/exvo_notifications_generator.rb +24 -0
- data/lib/generators/exvo_notifications/templates/migration.rb +9 -0
- metadata +76 -0
@@ -0,0 +1,19 @@
|
|
1
|
+
module ExvoNotifications
|
2
|
+
class NotificationsController < ApplicationController
|
3
|
+
|
4
|
+
unloadable
|
5
|
+
|
6
|
+
def create
|
7
|
+
user = User.find_or_create_by_uid(params[:user_uid])
|
8
|
+
user.update_attributes(:plan => params[:edition_title])
|
9
|
+
render :json => { :status => 200 }
|
10
|
+
end
|
11
|
+
|
12
|
+
def destroy
|
13
|
+
user = User.find_or_create_by_uid(params[:user_uid])
|
14
|
+
user.update_attributes(:plan => nil)
|
15
|
+
render :json => { :status => 200 }
|
16
|
+
end
|
17
|
+
|
18
|
+
end
|
19
|
+
end
|
data/config/routes.rb
ADDED
@@ -0,0 +1,5 @@
|
|
1
|
+
Rails.application.routes.draw do |map|
|
2
|
+
resources :accounts, :controller => 'exvo_notifications/accounts', :only => [:new, :create]
|
3
|
+
match "/notifications", :to => "exvo_notifications/notifications#create", :via => "post"
|
4
|
+
match "/notifications", :to => "exvo_notifications/notifications#destroy", :via => "delete"
|
5
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
module ExvoNotifications::Controllers::Access
|
2
|
+
def self.included(base)
|
3
|
+
base.send :include, InstanceMethods
|
4
|
+
end
|
5
|
+
|
6
|
+
module InstanceMethods
|
7
|
+
|
8
|
+
protected
|
9
|
+
|
10
|
+
def check_access
|
11
|
+
check_access_on_store unless current_user.plan
|
12
|
+
end
|
13
|
+
|
14
|
+
def check_access_on_store
|
15
|
+
begin
|
16
|
+
consumer = ExvoAuth::Autonomous::Consumer.new(:provider_id => ENV['EXVO_STORE_CLIENT_ID'])
|
17
|
+
response = consumer.get("/editions", { :query => { :user_uid => current_user.uid } } )
|
18
|
+
if response.parsed_response["edition"] == false
|
19
|
+
redirect_to response.parsed_response["url"]
|
20
|
+
else
|
21
|
+
current_user.update_attributes(:plan => response.parsed_response["edition"])
|
22
|
+
end
|
23
|
+
rescue
|
24
|
+
render :file => 'public/not_working.html', :layout => false
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
@@ -0,0 +1,12 @@
|
|
1
|
+
require "exvo_notifications"
|
2
|
+
require "rails"
|
3
|
+
|
4
|
+
module ExvoNotifications
|
5
|
+
class Engine < Rails::Engine
|
6
|
+
# engine_name :exvo_notifications
|
7
|
+
config.exvo_notifications = ActiveSupport::OrderedOptions.new
|
8
|
+
rake_tasks do
|
9
|
+
load "exvo_notifications/tasks/tasks.rake"
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
@@ -0,0 +1,131 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<title>500 Something Went Wrong</title>
|
5
|
+
<link href='https://themes.exvo.com/stylesheets/themes/carbon/all.css' rel='stylesheet' type='text/css'>
|
6
|
+
<link href='https://themes.exvo.com/stylesheets/themes/ice/layout.css' rel='stylesheet' type='text/css'>
|
7
|
+
<link href='https://themes.exvo.com/stylesheets/themes/common/error_pages.css' rel='stylesheet' type='text/css'>
|
8
|
+
</head>
|
9
|
+
<body>
|
10
|
+
<div class='layout'>
|
11
|
+
<div class='row dock_imitation' id='dock'>
|
12
|
+
<div class='cell third shortcuts left'>
|
13
|
+
<div class='shortcut desktop' data-href='http://exvo.com'>
|
14
|
+
<div class='icon small'>
|
15
|
+
<div class='image'></div>
|
16
|
+
</div>
|
17
|
+
<h3>Desktop</h3>
|
18
|
+
</div>
|
19
|
+
<div class='shortcut apps' data-href='http://store.exvo.com'>
|
20
|
+
<div class='icon small'>
|
21
|
+
<div class='image'></div>
|
22
|
+
</div>
|
23
|
+
<h3>Apps</h3>
|
24
|
+
</div>
|
25
|
+
</div>
|
26
|
+
<div class='cell'></div>
|
27
|
+
<div class='cell exvo_logo right_flat_background'>
|
28
|
+
<img class='exvo' src='https://themes.exvo.com/stylesheets/images/icons/exvo.png'>
|
29
|
+
</div>
|
30
|
+
</div>
|
31
|
+
<div class='row tool bar'>
|
32
|
+
<div class='cell third left'>
|
33
|
+
|
34
|
+
</div>
|
35
|
+
<div class='cell third center'>
|
36
|
+
<h2>This App is not working properly at the moment. Please return later'</h2>
|
37
|
+
</div>
|
38
|
+
<div class='cell third right'>
|
39
|
+
|
40
|
+
</div>
|
41
|
+
</div>
|
42
|
+
<div class='row content'>
|
43
|
+
<img class='screw left' src='/stylesheets/images/common/screwTopLeft.png'>
|
44
|
+
<img class='screw right' src='/stylesheets/images/common/screwTopRight.png'>
|
45
|
+
<div class='row'>
|
46
|
+
<div class='cell half warning'>
|
47
|
+
<p>We're sorry but you can not view this page</p>
|
48
|
+
Please navigate to a different page or try again later
|
49
|
+
</div>
|
50
|
+
<div class='cell half blog'>
|
51
|
+
<p>Take a look at our Blog</p>
|
52
|
+
For the latest updates, check out our Blog
|
53
|
+
<a href='http://blog.exvo.com'>
|
54
|
+
<img src='https://themes.exvo.com/stylesheets/images/dock/chevronBlack.png'>
|
55
|
+
</a>
|
56
|
+
</div>
|
57
|
+
</div>
|
58
|
+
<div class='row' id='more'>More at Exvo</div>
|
59
|
+
<div class='row more'>
|
60
|
+
<div class='cell fifth'>
|
61
|
+
<div class='alternative'>
|
62
|
+
<img class='logo' src='https://themes.exvo.com/stylesheets/images/error_pages/Desktop.png'>
|
63
|
+
<br>
|
64
|
+
<span>Desktop</span>
|
65
|
+
<br>
|
66
|
+
<br>
|
67
|
+
<p>Your personal starting point to use the web in a whole new way.</p>
|
68
|
+
<br>
|
69
|
+
<br>
|
70
|
+
<a class='button ice' href='http://exvo.com'>Visit</a>
|
71
|
+
</div>
|
72
|
+
</div>
|
73
|
+
<div class='cell fifth'>
|
74
|
+
<div class='alternative'>
|
75
|
+
<img class='logo' src='https://themes.exvo.com/stylesheets/images/error_pages/Apps.png'>
|
76
|
+
<br>
|
77
|
+
<span>Apps</span>
|
78
|
+
<br>
|
79
|
+
<br>
|
80
|
+
<p>Explore the Apps Store to find great apps you can start using right away.</p>
|
81
|
+
<br>
|
82
|
+
<br>
|
83
|
+
<a class='button ice' href='http://store.exvo.com/apps'>Visit</a>
|
84
|
+
</div>
|
85
|
+
</div>
|
86
|
+
<div class='cell fifth'>
|
87
|
+
<div class='alternative'>
|
88
|
+
<img class='logo' src='https://themes.exvo.com/stylesheets/images/error_pages/Documents.png'>
|
89
|
+
<br>
|
90
|
+
<span>Documents</span>
|
91
|
+
<br>
|
92
|
+
<br>
|
93
|
+
<p>Store your files online. Viewable on any internet enabled device</p>
|
94
|
+
<br>
|
95
|
+
<br>
|
96
|
+
<a class='button ice' href='http://documents.exvo.com'>Visit</a>
|
97
|
+
</div>
|
98
|
+
</div>
|
99
|
+
<div class='cell fifth'>
|
100
|
+
<div class='alternative'>
|
101
|
+
<img class='logo' src='https://themes.exvo.com/stylesheets/images/error_pages/Company.png'>
|
102
|
+
<br>
|
103
|
+
<span>Company</span>
|
104
|
+
<br>
|
105
|
+
<br>
|
106
|
+
<p>Your personal starting poin to user the web in a whole new way</p>
|
107
|
+
<br>
|
108
|
+
<br>
|
109
|
+
<a class='button ice' href='http://store.exvo.com/opencompany'>Visit</a>
|
110
|
+
</div>
|
111
|
+
</div>
|
112
|
+
<div class='cell fifth'>
|
113
|
+
<div class='alternative'>
|
114
|
+
<img class='logo' src='https://themes.exvo.com/stylesheets/images/error_pages/Teams.png'>
|
115
|
+
<br>
|
116
|
+
<span>Teams</span>
|
117
|
+
<br>
|
118
|
+
<br>
|
119
|
+
<p>A powerful way for entrepreneurs big and small to run their company</p>
|
120
|
+
<br>
|
121
|
+
<br>
|
122
|
+
<a class='button ice' href='http://store.exvo.com/teams'>Visit</a>
|
123
|
+
</div>
|
124
|
+
</div>
|
125
|
+
</div>
|
126
|
+
<img class='screw bottom left' src='https://themes.exvo.com/stylesheets/images/common/screwBottomLeft.png'>
|
127
|
+
<img class='screw bottom right' src='https://themes.exvo.com/stylesheets/images/common/screwBottomRight.png'>
|
128
|
+
</div>
|
129
|
+
</div>
|
130
|
+
</body>
|
131
|
+
</html>
|
@@ -0,0 +1,24 @@
|
|
1
|
+
require 'rails/generators'
|
2
|
+
require 'rails/generators/migration'
|
3
|
+
|
4
|
+
class ExvoNotificationsGenerator < Rails::Generators::Base
|
5
|
+
desc "Create migration => add_plan_to_user"
|
6
|
+
|
7
|
+
include Rails::Generators::Migration
|
8
|
+
|
9
|
+
def self.source_root
|
10
|
+
@source_root ||= File.join(File.dirname(__FILE__), 'templates')
|
11
|
+
end
|
12
|
+
|
13
|
+
def self.next_migration_number(dirname)
|
14
|
+
if ActiveRecord::Base.timestamped_migrations
|
15
|
+
Time.now.utc.strftime("%Y%m%d%H%M%S")
|
16
|
+
else
|
17
|
+
"%.3d" % (current_migration_number(dirname) + 1)
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
def create_migration_file
|
22
|
+
migration_template 'migration.rb', 'db/migrate/add_plan_to_user.rb'
|
23
|
+
end
|
24
|
+
end
|
metadata
ADDED
@@ -0,0 +1,76 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: exvo_notifications
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
hash: 27
|
5
|
+
prerelease: false
|
6
|
+
segments:
|
7
|
+
- 0
|
8
|
+
- 1
|
9
|
+
- 0
|
10
|
+
version: 0.1.0
|
11
|
+
platform: ruby
|
12
|
+
authors:
|
13
|
+
- "Robert S\xC4\x99k"
|
14
|
+
autorequire:
|
15
|
+
bindir: bin
|
16
|
+
cert_chain: []
|
17
|
+
|
18
|
+
date: 2010-10-13 00:00:00 +02:00
|
19
|
+
default_executable:
|
20
|
+
dependencies: []
|
21
|
+
|
22
|
+
description: Maintain Exvo Notifications in external apps
|
23
|
+
email:
|
24
|
+
- sekupyna@gmail.com
|
25
|
+
executables: []
|
26
|
+
|
27
|
+
extensions: []
|
28
|
+
|
29
|
+
extra_rdoc_files: []
|
30
|
+
|
31
|
+
files:
|
32
|
+
- app/controllers/exvo_notifications/notifications_controller.rb
|
33
|
+
- config/routes.rb
|
34
|
+
- lib/exvo_notifications.rb
|
35
|
+
- lib/exvo_notifications/controllers/access.rb
|
36
|
+
- lib/exvo_notifications/engine.rb
|
37
|
+
- lib/exvo_notifications/pages/not_working.html
|
38
|
+
- lib/exvo_notifications/tasks/tasks.rake
|
39
|
+
- lib/generators/exvo_notifications/exvo_notifications_generator.rb
|
40
|
+
- lib/generators/exvo_notifications/templates/migration.rb
|
41
|
+
has_rdoc: true
|
42
|
+
homepage:
|
43
|
+
licenses: []
|
44
|
+
|
45
|
+
post_install_message:
|
46
|
+
rdoc_options:
|
47
|
+
- --charset=UTF-8
|
48
|
+
require_paths:
|
49
|
+
- lib
|
50
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
51
|
+
none: false
|
52
|
+
requirements:
|
53
|
+
- - ">="
|
54
|
+
- !ruby/object:Gem::Version
|
55
|
+
hash: 3
|
56
|
+
segments:
|
57
|
+
- 0
|
58
|
+
version: "0"
|
59
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
60
|
+
none: false
|
61
|
+
requirements:
|
62
|
+
- - ">="
|
63
|
+
- !ruby/object:Gem::Version
|
64
|
+
hash: 3
|
65
|
+
segments:
|
66
|
+
- 0
|
67
|
+
version: "0"
|
68
|
+
requirements: []
|
69
|
+
|
70
|
+
rubyforge_project:
|
71
|
+
rubygems_version: 1.3.7
|
72
|
+
signing_key:
|
73
|
+
specification_version: 3
|
74
|
+
summary: Maintain Exvo Notifications
|
75
|
+
test_files: []
|
76
|
+
|