platform 3.1.1 → 3.1.2
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.
- data/Gemfile.lock +1 -3
- data/README.rdoc +140 -3
- data/app/assets/images/platform/help/app_reg.png +0 -0
- data/app/assets/images/platform/help/app_reg_ext.png +0 -0
- data/app/assets/images/platform/help/app_reg_web.png +0 -0
- data/app/assets/images/platform/help/auth_desktop.png +0 -0
- data/app/assets/images/platform/help/auth_iframe.png +0 -0
- data/app/assets/images/platform/help/auth_iphone.png +0 -0
- data/app/assets/images/platform/help/auth_web.png +0 -0
- data/app/assets/images/platform/help/authorize.png +0 -0
- data/app/assets/images/platform/help/ext.png +0 -0
- data/app/assets/images/platform/help/login_desktop.png +0 -0
- data/app/assets/images/platform/help/login_iphone.png +0 -0
- data/app/assets/images/platform/help/login_web.png +0 -0
- data/app/assets/images/platform/help/register_desktop.png +0 -0
- data/app/assets/images/platform/help/register_iphone.png +0 -0
- data/app/assets/javascripts/platform/platform.js +1 -1
- data/app/controllers/platform/api/base_controller.rb +24 -14
- data/app/controllers/platform/apps_controller.rb +16 -0
- data/app/controllers/platform/developer/help_controller.rb +2 -15
- data/app/controllers/platform/oauth_controller.rb +3 -3
- data/app/helpers/platform/admin/categories_helper.rb +1 -1
- data/app/helpers/platform/developer/help_helper.rb +2 -1
- data/app/models/platform/application.rb +2 -0
- data/app/models/platform/developer.rb +2 -0
- data/app/models/platform/logged_exception.rb +1 -1
- data/app/views/platform/admin/clientsdk/index.html.erb +12 -12
- data/app/views/platform/apps/_search_apps_module.html.erb +1 -1
- data/app/views/platform/apps/settings.html.erb +77 -0
- data/app/views/platform/developer/api_explorer/options.html.erb +0 -2
- data/app/views/platform/developer/dashboard/index.html.erb +1 -1
- data/app/views/platform/developer/help/_navigation.html.erb +1 -1
- data/app/views/platform/developer/help/oauth_client_side.html.erb +17 -15
- data/app/views/platform/developer/help/oauth_extensions.html.erb +1 -1
- data/app/views/platform/developer/help/oauth_mobile.html.erb +12 -12
- data/app/views/platform/developer/help/oauth_server_side.html.erb +6 -6
- data/app/views/platform/developer/help/sdk_ios.html.erb +3 -3
- data/app/views/platform/developer/help/sdk_js.html.erb +13 -185
- data/app/views/platform/developer/info/_basic_info.html.erb +1 -1
- data/app/views/platform/developer/info/_header.html.erb +3 -3
- data/app/views/platform/developer/registration/index.html.erb +30 -30
- data/app/views/platform/oauth/_authorization_box.html.erb +6 -7
- data/app/views/platform/oauth/_authorization_popup.html.erb +1 -1
- data/app/views/platform/oauth/authorize_desktop.html.erb +1 -76
- data/config/routes.rb +2 -4
- data/lib/generators/platform/proxy_generator.rb +78 -0
- data/lib/generators/platform/templates/config/platform/api/0/platform.yml +55 -0
- data/lib/generators/platform/templates/config/platform/api/0/platform_application.yml +37 -0
- data/lib/generators/platform/templates/config/platform/api/0/platform_developer.yml +22 -0
- data/{config → lib/generators/platform/templates/config}/platform/config.yml +22 -19
- data/{config → lib/generators/platform/templates/config}/platform/data/default_applications.yml +0 -0
- data/{config → lib/generators/platform/templates/config}/platform/data/default_categories.yml +0 -0
- data/{config → lib/generators/platform/templates/config}/platform/data/default_permissions.yml +0 -0
- data/{config → lib/generators/platform/templates/config}/platform/site/features.yml +0 -0
- data/lib/platform.rb +23 -0
- data/lib/platform/api/proxy/base.rb +5 -2
- data/lib/platform/cache.rb +1 -1
- data/lib/platform/config.rb +20 -3
- data/lib/platform/engine.rb +23 -0
- data/lib/platform/exception.rb +1 -1
- data/lib/platform/extensions/action_view_extension.rb +25 -0
- data/lib/platform/helper.rb +1 -1
- data/lib/platform/logger.rb +1 -1
- data/lib/platform/random_password_generator.rb +1 -1
- data/lib/platform/simple_string_permissions.rb +1 -1
- data/lib/platform/version.rb +24 -1
- data/lib/tasks/platform.rake +1 -1
- data/platform.gemspec +1 -1
- data/test/dummy/.pryrc +15 -0
- data/test/dummy/app/controllers/api/base_controller.rb +0 -1
- data/test/dummy/app/controllers/api/bookmarks_controller.rb +6 -1
- data/{app/controllers/platform/developer/resources_controller.rb → test/dummy/app/controllers/api/platform_controller.rb} +16 -2
- data/test/dummy/app/controllers/api/users_controller.rb +1 -0
- data/test/dummy/app/controllers/login_controller.rb +2 -1
- data/test/dummy/app/models/user.rb +8 -0
- data/test/dummy/app/views/layouts/_header.html.erb +1 -0
- data/test/dummy/app/views/layouts/blank.html.erb +24 -0
- data/test/dummy/app/views/layouts/mobile.html.erb +68 -0
- data/test/dummy/app/views/login/index.html.erb +1 -2
- data/test/dummy/app/views/login/register.html.erb +3 -3
- data/test/dummy/config/application.rb +1 -1
- data/test/dummy/config/platform/api/1/bookmark.yml +23 -3
- data/test/dummy/config/platform/api/1/platform.yml +55 -0
- data/test/dummy/config/platform/api/1/platform_application.yml +37 -0
- data/test/dummy/config/platform/api/1/platform_developer.yml +22 -0
- data/test/dummy/config/platform/api/1/user.yml +1 -1
- data/test/dummy/config/platform/config.yml +5 -4
- data/test/dummy/config/routes.rb +4 -0
- data/test/dummy/config/tr8n/config.yml +1 -1
- data/test/dummy/lib/platform/api/platform_application_proxy_0.rb +28 -0
- data/test/dummy/lib/platform/api/platform_developer_proxy_0.rb +19 -0
- metadata +72 -65
- data/app/assets/images/platform/help/login.png +0 -0
- data/app/assets/javascripts/platform/jsdk.js +0 -539
- data/app/controllers/platform/api/apps_controller.rb +0 -40
- data/app/views/platform/developer/resources/index.html.erb +0 -23
- data/test/dummy/config/platform/site/sample_apps.yml +0 -100
data/Gemfile.lock
CHANGED
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
PATH
|
|
2
2
|
remote: .
|
|
3
3
|
specs:
|
|
4
|
-
platform (3.1.
|
|
4
|
+
platform (3.1.2)
|
|
5
5
|
acts_as_state_machine
|
|
6
6
|
acts_as_tree
|
|
7
7
|
coffee-script
|
|
8
8
|
kaminari
|
|
9
9
|
rails (>= 3.1.0)
|
|
10
|
-
rmagick
|
|
11
10
|
sass
|
|
12
11
|
tr8n (>= 3.1.1)
|
|
13
12
|
will_filter (>= 3.1.2)
|
|
@@ -119,7 +118,6 @@ GEM
|
|
|
119
118
|
thor (~> 0.14.6)
|
|
120
119
|
rake (0.9.2)
|
|
121
120
|
rdoc (3.9.4)
|
|
122
|
-
rmagick (2.13.1)
|
|
123
121
|
rr (1.0.4)
|
|
124
122
|
rspec (2.6.0)
|
|
125
123
|
rspec-core (~> 2.6.0)
|
data/README.rdoc
CHANGED
|
@@ -1,5 +1,142 @@
|
|
|
1
|
-
= Platform
|
|
1
|
+
= Welcome to the Rails Platform Engine
|
|
2
|
+
|
|
3
|
+
Platform is a Rails Engine Plugin/Gem that provides a framework for extending any Rails application with 3rd party applications.
|
|
4
|
+
|
|
5
|
+
As web applications become more and more social, and new devices, such as iPhone and Android, become the new web interface standard for consuming web services data,
|
|
6
|
+
it is crucial to ensure that 3rd party developers can access your API and extend your application functionality as well as provide
|
|
7
|
+
new access points to your application through "Connect with" functionality. This engine comes loaded with features that make it easy to provide 3rd party developers with tools,
|
|
8
|
+
SDKs and documentation to extend your application and consume/contribute to your service data. And for you, the platform makes it easy to develop, deploy, test and document your APIs.
|
|
9
|
+
You can use the platform for your internal applications or you can expose it to the 3rd party developers. It is your call.
|
|
10
|
+
|
|
11
|
+
Here are some of the main features:
|
|
12
|
+
|
|
13
|
+
* Full support for OAuth 2.0 spec, which allows 3rd party applications to be authorized by your users or allows your own applications to authorize themselves and get access tokens.
|
|
14
|
+
* API core classes that support OAuth and Cookie based authentication and authorization.
|
|
15
|
+
* API documentation tools that allow you to easily generated API docs for your API.
|
|
16
|
+
* API versioning mechanism that allows you to version your API and support multiple versions of the API and documentation at the same time.
|
|
17
|
+
* Platform developer tools that allow your 3rd party developers to register multiple applications with your web site, monitor their activity, participate in discussions and explore your API.
|
|
18
|
+
* Application directory, where your developers submit their applications and your users discover apps, rate them, discuss them and launch them.
|
|
19
|
+
* Administrative tools that allow you to closely monitor developers activity, API calls, manage Application Directory and much more.
|
|
20
|
+
* The platform comes with Tr8n engine, which makes it international out of the box - with hundreds of languages. (Actual translations will be available in the near future.)
|
|
21
|
+
|
|
22
|
+
= Installation Instructions
|
|
23
|
+
|
|
24
|
+
Add the following gems to your Gemfile:
|
|
25
|
+
|
|
26
|
+
gem 'kaminari'
|
|
27
|
+
gem 'will_filter', "~> 3.1.2"
|
|
28
|
+
gem 'tr8n', "~> 3.1.1"
|
|
29
|
+
gem 'platform', "~> 3.1.1"
|
|
30
|
+
gem 'sass'
|
|
31
|
+
gem 'coffee-script'
|
|
32
|
+
gem 'acts_as_tree'
|
|
33
|
+
gem 'acts_as_state_machine'
|
|
34
|
+
gem 'rmagick'
|
|
35
|
+
|
|
36
|
+
And run:
|
|
37
|
+
|
|
38
|
+
$ bundle install
|
|
39
|
+
|
|
40
|
+
At the top of your routes.rb file, add the following lines:
|
|
41
|
+
|
|
42
|
+
mount WillFilter::Engine => "/will_filter"
|
|
43
|
+
mount Tr8n::Engine => "/tr8n"
|
|
44
|
+
mount Platform::Engine => "/platform"
|
|
45
|
+
|
|
46
|
+
To configure and initialize Platform engine, run the following commands:
|
|
47
|
+
|
|
48
|
+
$ rails generate will_filter
|
|
49
|
+
$ rails generate tr8n
|
|
50
|
+
$ rails generate platform
|
|
51
|
+
$ rake db:migrate
|
|
52
|
+
$ rake tr8n:init
|
|
53
|
+
$ rake platform:init
|
|
54
|
+
$ rails s
|
|
55
|
+
|
|
56
|
+
Open your browser and point to:
|
|
57
|
+
|
|
58
|
+
http://localhost:3000
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
= Integration Instructions
|
|
62
|
+
|
|
63
|
+
The best way to get going with Platform is to run the gem as a stand-alone application and follow the instructions and documentation in the app:
|
|
64
|
+
|
|
65
|
+
$ git clone git://github.com/berk/platform.git
|
|
66
|
+
$ cd platform/test/dummy
|
|
67
|
+
$ rake db:migrate
|
|
68
|
+
$ rake tr8n:init
|
|
69
|
+
$ rake platform:init
|
|
70
|
+
$ rails s
|
|
71
|
+
|
|
72
|
+
Open your browser and point to:
|
|
73
|
+
|
|
74
|
+
http://localhost:3000
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
= Platform Screenshots
|
|
78
|
+
|
|
79
|
+
Below are a few screenshots of what the Platform looks like inside a sample test application:
|
|
80
|
+
|
|
81
|
+
http://wiki.tr8n.org/images/0/0c/Platform_Welcome.png
|
|
82
|
+
|
|
83
|
+
= Developer Tools
|
|
84
|
+
|
|
85
|
+
http://wiki.tr8n.org/images/8/8a/Developer_Applications.png
|
|
86
|
+
|
|
87
|
+
== Developer Dashboard
|
|
88
|
+
|
|
89
|
+
http://wiki.tr8n.org/images/e/eb/Developer_Dashboard.png
|
|
90
|
+
|
|
91
|
+
== API Explorer
|
|
92
|
+
|
|
93
|
+
http://wiki.tr8n.org/images/b/b3/API_Explorer_Results.png
|
|
94
|
+
|
|
95
|
+
== API Explorer with OAuth Authorization Window
|
|
96
|
+
|
|
97
|
+
http://wiki.tr8n.org/images/3/34/Oauth_Authorization_Popup.png
|
|
98
|
+
|
|
99
|
+
== API Explorer Method Hints
|
|
100
|
+
|
|
101
|
+
http://wiki.tr8n.org/images/b/bf/API_Explorer_Methods.png
|
|
102
|
+
|
|
103
|
+
== OAuth Help
|
|
104
|
+
|
|
105
|
+
http://wiki.tr8n.org/images/4/42/Oauth_Help.png
|
|
106
|
+
|
|
107
|
+
== API Generated Help
|
|
108
|
+
|
|
109
|
+
http://wiki.tr8n.org/images/6/67/API_Help.png
|
|
110
|
+
|
|
111
|
+
= Application Directory
|
|
112
|
+
|
|
113
|
+
== Applications by Category with Featured Applications
|
|
114
|
+
|
|
115
|
+
http://wiki.tr8n.org/images/0/01/Application_Directory.png
|
|
116
|
+
|
|
117
|
+
== Application Search Results
|
|
118
|
+
|
|
119
|
+
http://wiki.tr8n.org/images/6/61/Application_Search.png
|
|
120
|
+
|
|
121
|
+
== Application Details
|
|
122
|
+
|
|
123
|
+
http://wiki.tr8n.org/images/4/40/Application_Details2.png
|
|
124
|
+
|
|
125
|
+
== Application Authorization Screen for Web or Embedded Applications
|
|
126
|
+
|
|
127
|
+
http://wiki.tr8n.org/images/a/af/Oauth_Authorization_Request.png
|
|
128
|
+
|
|
129
|
+
== Embedded Application Launched in an iFrame
|
|
130
|
+
|
|
131
|
+
http://wiki.tr8n.org/images/a/a1/Embedded_App.png
|
|
132
|
+
|
|
133
|
+
== User Authorized Applications
|
|
134
|
+
|
|
135
|
+
http://wiki.tr8n.org/images/0/06/My_Applications.png
|
|
136
|
+
|
|
137
|
+
= Administrative Tools
|
|
138
|
+
|
|
139
|
+
http://wiki.tr8n.org/images/2/28/Admin_Tools.png
|
|
140
|
+
|
|
2
141
|
|
|
3
|
-
This project rocks and uses MIT-LICENSE.
|
|
4
142
|
|
|
5
|
-
Instructions are coming soon... Stay tuned.
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/****************************************************************************
|
|
2
|
-
Copyright (c) 2011 Michael Berkovich, Ian McDaniel
|
|
2
|
+
Copyright (c) 2011 Michael Berkovich, Ian McDaniel
|
|
3
3
|
|
|
4
4
|
Permission is hereby granted, free of charge, to any person obtaining
|
|
5
5
|
a copy of this software and associated documentation files (the
|
|
@@ -182,13 +182,17 @@ module Platform
|
|
|
182
182
|
############################################################################
|
|
183
183
|
def render_response(obj, opts={})
|
|
184
184
|
to_opts = params.merge(:max_models => limit, :viewer => current_user, :api_version => api_version)
|
|
185
|
-
|
|
185
|
+
|
|
186
186
|
if obj.is_a?(Array)
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
187
|
+
if obj.size == 1 and not only_list?
|
|
188
|
+
obj = obj.first
|
|
189
|
+
else
|
|
190
|
+
hash = {'results' => obj.collect{|o| o.to_api_hash(to_opts)}}
|
|
191
|
+
hash['page'] = page if page > 1 || limit == obj.size
|
|
192
|
+
hash['previous_page'] = prev_page if page > 1
|
|
193
|
+
hash['next_page'] = next_page if limit == obj.size
|
|
194
|
+
obj = hash
|
|
195
|
+
end
|
|
192
196
|
end
|
|
193
197
|
|
|
194
198
|
respond_to do |format|
|
|
@@ -258,7 +262,7 @@ module Platform
|
|
|
258
262
|
end
|
|
259
263
|
|
|
260
264
|
def page_models
|
|
261
|
-
@page_models ||= model_class.where(page_model_conditions).limit(limit).offset(offset).order('id ASC')
|
|
265
|
+
@page_models ||= model_class.where(page_model_conditions).limit(limit).offset(offset).order('id ASC').all
|
|
262
266
|
end
|
|
263
267
|
|
|
264
268
|
def page_model
|
|
@@ -267,7 +271,9 @@ module Platform
|
|
|
267
271
|
|
|
268
272
|
def page_model_conditions(id_fields=nil)
|
|
269
273
|
id_fields ||= self.class.id_fields
|
|
270
|
-
|
|
274
|
+
page_ids = ids(id_fields)
|
|
275
|
+
return nil if page_ids.empty?
|
|
276
|
+
{:id => page_ids}
|
|
271
277
|
end
|
|
272
278
|
|
|
273
279
|
# default id fields
|
|
@@ -288,11 +294,7 @@ module Platform
|
|
|
288
294
|
end
|
|
289
295
|
|
|
290
296
|
def default_model_ids
|
|
291
|
-
|
|
292
|
-
end
|
|
293
|
-
|
|
294
|
-
def default_models
|
|
295
|
-
raise Exception.new("must be implemented in the extanding class")
|
|
297
|
+
[]
|
|
296
298
|
end
|
|
297
299
|
|
|
298
300
|
def success_message
|
|
@@ -365,6 +367,10 @@ module Platform
|
|
|
365
367
|
end
|
|
366
368
|
end
|
|
367
369
|
|
|
370
|
+
def only_list?
|
|
371
|
+
params[:only_list] || false
|
|
372
|
+
end
|
|
373
|
+
|
|
368
374
|
def request_limit
|
|
369
375
|
@request_limit ||= Platform::Config.api_request_limit
|
|
370
376
|
end
|
|
@@ -421,9 +427,13 @@ module Platform
|
|
|
421
427
|
end
|
|
422
428
|
|
|
423
429
|
def ensure_logged_in
|
|
424
|
-
raise LoginError unless logged_in?
|
|
430
|
+
raise LoginError.new("You must be logged in to use this API") unless logged_in?
|
|
425
431
|
end
|
|
426
432
|
|
|
433
|
+
def ensure_ids_provided
|
|
434
|
+
raise ApiError.new("Provide an id or ids for the object") if ids.empty?
|
|
435
|
+
end
|
|
436
|
+
|
|
427
437
|
# should be overwritten by the implementing class - this is cutsom stuff for some apps
|
|
428
438
|
def ensure_ownership(user=current_user, models=page_models)
|
|
429
439
|
raise ForbiddenError.new('Permission denied') unless models.all? { |ii| ii.user == current_user }
|
|
@@ -93,6 +93,22 @@ class Platform::AppsController < Platform::BaseController
|
|
|
93
93
|
render :layout => false
|
|
94
94
|
end
|
|
95
95
|
|
|
96
|
+
def settings
|
|
97
|
+
@app_users = Platform::ApplicationUser.where("user_id = ?", current_user.id).order("updated_at desc")
|
|
98
|
+
end
|
|
99
|
+
|
|
100
|
+
def remove
|
|
101
|
+
if request.post?
|
|
102
|
+
app_user = Platform::ApplicationUser.find_by_id(params[:app_user_id])
|
|
103
|
+
if app_user
|
|
104
|
+
app_user.destroy
|
|
105
|
+
trfn("{app} has been removed from your account and will no longer have access to your account information.", "", :app => app_user.application.name)
|
|
106
|
+
end
|
|
107
|
+
end
|
|
108
|
+
|
|
109
|
+
redirect_to :action => :settings
|
|
110
|
+
end
|
|
111
|
+
|
|
96
112
|
def run
|
|
97
113
|
@app = Platform::Application.find_by_canvas_name(params[:canvas_name])
|
|
98
114
|
return render(:action => :canvas_app) unless @app
|
|
@@ -84,25 +84,12 @@ class Platform::Developer::HelpController < Platform::Developer::BaseController
|
|
|
84
84
|
trfe("API path must be provided")
|
|
85
85
|
return redirect_to(:action => :index, :version => @version)
|
|
86
86
|
end
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
parts.delete(parts.first) if [''].include?(parts.first)
|
|
90
|
-
|
|
91
|
-
@api = ref[parts.first]
|
|
87
|
+
|
|
88
|
+
@api = Platform::Config.api_reference_by_path(@version, params[:path])
|
|
92
89
|
unless @api
|
|
93
90
|
trfe("Unsupported API path")
|
|
94
91
|
return redirect_to(:action => :index, :version => @version)
|
|
95
92
|
end
|
|
96
|
-
|
|
97
|
-
if parts.size > 1
|
|
98
|
-
if @api[:actions] and @api[:actions][parts.last]
|
|
99
|
-
action_api = @api[:actions][parts.last]
|
|
100
|
-
action_api[:parent] = @api
|
|
101
|
-
@api = action_api
|
|
102
|
-
else
|
|
103
|
-
trfe("Unsupported API path")
|
|
104
|
-
end
|
|
105
|
-
end
|
|
106
93
|
end
|
|
107
94
|
|
|
108
95
|
private
|
|
@@ -153,8 +153,8 @@ class Platform::OauthController < Platform::BaseController
|
|
|
153
153
|
# implement authorized user
|
|
154
154
|
if client_application.authorized_user?
|
|
155
155
|
# add access token to the redirect
|
|
156
|
-
access_token = client_application.create_access_token(:user=>
|
|
157
|
-
refresh_token = client_application.create_refresh_token(:user=>
|
|
156
|
+
access_token = client_application.create_access_token(:user=>Platform.current_user, :scope=>scope)
|
|
157
|
+
refresh_token = client_application.create_refresh_token(:user=>Platform.current_user, :scope=>scope)
|
|
158
158
|
return redirect_with_response(:status => "authorized", :access_token => access_token.token, :refresh_token => refresh_token.token, :expires_in => (access_token.valid_to.to_i - Time.now.to_i))
|
|
159
159
|
end
|
|
160
160
|
|
|
@@ -346,7 +346,7 @@ private
|
|
|
346
346
|
end
|
|
347
347
|
|
|
348
348
|
def redirect_url_valid?(url)
|
|
349
|
-
return true if xd?
|
|
349
|
+
return true if xd? or mobile?
|
|
350
350
|
|
|
351
351
|
begin
|
|
352
352
|
URI.parse(url)
|
|
@@ -33,7 +33,8 @@ module Platform::Developer::HelpHelper
|
|
|
33
33
|
end
|
|
34
34
|
|
|
35
35
|
def documentation_field_link_tag(name, type)
|
|
36
|
-
|
|
36
|
+
path = Platform::Config.api_reference(params[:version] || Platform::Config.api_default_version)[type.underscore]["path"]
|
|
37
|
+
link_to(name, :controller => "/platform/developer/help", :action => :api, :path => path)
|
|
37
38
|
end
|
|
38
39
|
|
|
39
40
|
private
|
|
@@ -24,6 +24,8 @@
|
|
|
24
24
|
class Platform::Developer < ActiveRecord::Base
|
|
25
25
|
set_table_name :platform_developers
|
|
26
26
|
|
|
27
|
+
has_platform_api_proxy
|
|
28
|
+
|
|
27
29
|
belongs_to :user, :class_name => Platform::Config.user_class_name, :foreign_key => :user_id
|
|
28
30
|
|
|
29
31
|
has_many :applications, :class_name => "Platform::Application"
|
|
@@ -278,7 +278,7 @@ class Platform::LoggedException < ActiveRecord::Base
|
|
|
278
278
|
message = []
|
|
279
279
|
|
|
280
280
|
message << "Subject: #{log.exception_class}: #{log.message}\n"
|
|
281
|
-
message << "Exception URL:
|
|
281
|
+
message << "Exception URL: #{Platform.site_url}/admin/exceptions/show/#{log.id}"
|
|
282
282
|
message << "Backtrace:\n#{log.backtrace.join("\n")}" if log.backtrace
|
|
283
283
|
|
|
284
284
|
Net::SMTP.start(LOCAL_SMTP_SETTINGS[:address], LOCAL_SMTP_SETTINGS[:port]) do |smtp|
|
|
@@ -2,11 +2,11 @@
|
|
|
2
2
|
<%= render :partial => "tabs" %>
|
|
3
3
|
|
|
4
4
|
<%=javascript_include_tag("https://ajax.googleapis.com/ajax/libs/jquery/1.6.1/jquery.min.js")%>
|
|
5
|
-
<%=javascript_include_tag("/
|
|
5
|
+
<%=javascript_include_tag("https://raw.github.com/berk/platform_js_clientsdk/master/jsdk.js")%>
|
|
6
6
|
|
|
7
7
|
<ul id="debug" style="font-family:arial;font-size:11px;position:absolute;right:0;top:0;background:lightyellow;padding:10px;margin:0;list-style-type:none;white-space:nowrap"></ul>
|
|
8
8
|
|
|
9
|
-
<h1>
|
|
9
|
+
<h1>Platform Connect</h1>
|
|
10
10
|
<p>Authorization not working right now :(</p>
|
|
11
11
|
|
|
12
12
|
<button id="connect_btn">Connect</button>
|
|
@@ -18,16 +18,16 @@
|
|
|
18
18
|
<pre style="font-size:11px;background:#f5f5f5;padding:10px;width:500px">
|
|
19
19
|
|
|
20
20
|
// Authorize App
|
|
21
|
-
|
|
21
|
+
Platform.Auth.connect();
|
|
22
22
|
|
|
23
23
|
// Revoke Application Authorization
|
|
24
|
-
|
|
24
|
+
Platform.Auth.disconnect();
|
|
25
25
|
|
|
26
|
-
// Logout of
|
|
27
|
-
|
|
26
|
+
// Logout of Platform
|
|
27
|
+
Platform.Auth.logout();
|
|
28
28
|
|
|
29
29
|
// Make API Call
|
|
30
|
-
|
|
30
|
+
Platform.api('/profile',function(r) {
|
|
31
31
|
var html = '<table>';
|
|
32
32
|
for (var key in r) {
|
|
33
33
|
html += (
|
|
@@ -49,20 +49,20 @@ Geni.api('/profile',function(r) {
|
|
|
49
49
|
|
|
50
50
|
|
|
51
51
|
$('#connect_btn').click(function(){
|
|
52
|
-
|
|
52
|
+
Platform.Auth.connect();
|
|
53
53
|
})
|
|
54
54
|
|
|
55
55
|
$('#disconnect_btn').click(function(){
|
|
56
|
-
|
|
56
|
+
Platform.Auth.disconnect();
|
|
57
57
|
})
|
|
58
58
|
|
|
59
59
|
$('#logout_btn').click(function(){
|
|
60
|
-
|
|
60
|
+
Platform.Auth.logout();
|
|
61
61
|
})
|
|
62
62
|
|
|
63
63
|
$('#user_btn').click(function(){
|
|
64
64
|
var div = document.getElementById('profile_data');
|
|
65
|
-
|
|
65
|
+
Platform.api('/profile',function(r) {
|
|
66
66
|
var html = '<table>';
|
|
67
67
|
for (var key in r) {
|
|
68
68
|
html += (
|
|
@@ -78,7 +78,7 @@ $('#user_btn').click(function(){
|
|
|
78
78
|
|
|
79
79
|
|
|
80
80
|
|
|
81
|
-
|
|
81
|
+
Platform.Event.bind('log',function(args) {
|
|
82
82
|
$('#debug')[0].innerHTML += "<li>" + args + "</li>";
|
|
83
83
|
|
|
84
84
|
|