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.
Files changed (97) hide show
  1. data/Gemfile.lock +1 -3
  2. data/README.rdoc +140 -3
  3. data/app/assets/images/platform/help/app_reg.png +0 -0
  4. data/app/assets/images/platform/help/app_reg_ext.png +0 -0
  5. data/app/assets/images/platform/help/app_reg_web.png +0 -0
  6. data/app/assets/images/platform/help/auth_desktop.png +0 -0
  7. data/app/assets/images/platform/help/auth_iframe.png +0 -0
  8. data/app/assets/images/platform/help/auth_iphone.png +0 -0
  9. data/app/assets/images/platform/help/auth_web.png +0 -0
  10. data/app/assets/images/platform/help/authorize.png +0 -0
  11. data/app/assets/images/platform/help/ext.png +0 -0
  12. data/app/assets/images/platform/help/login_desktop.png +0 -0
  13. data/app/assets/images/platform/help/login_iphone.png +0 -0
  14. data/app/assets/images/platform/help/login_web.png +0 -0
  15. data/app/assets/images/platform/help/register_desktop.png +0 -0
  16. data/app/assets/images/platform/help/register_iphone.png +0 -0
  17. data/app/assets/javascripts/platform/platform.js +1 -1
  18. data/app/controllers/platform/api/base_controller.rb +24 -14
  19. data/app/controllers/platform/apps_controller.rb +16 -0
  20. data/app/controllers/platform/developer/help_controller.rb +2 -15
  21. data/app/controllers/platform/oauth_controller.rb +3 -3
  22. data/app/helpers/platform/admin/categories_helper.rb +1 -1
  23. data/app/helpers/platform/developer/help_helper.rb +2 -1
  24. data/app/models/platform/application.rb +2 -0
  25. data/app/models/platform/developer.rb +2 -0
  26. data/app/models/platform/logged_exception.rb +1 -1
  27. data/app/views/platform/admin/clientsdk/index.html.erb +12 -12
  28. data/app/views/platform/apps/_search_apps_module.html.erb +1 -1
  29. data/app/views/platform/apps/settings.html.erb +77 -0
  30. data/app/views/platform/developer/api_explorer/options.html.erb +0 -2
  31. data/app/views/platform/developer/dashboard/index.html.erb +1 -1
  32. data/app/views/platform/developer/help/_navigation.html.erb +1 -1
  33. data/app/views/platform/developer/help/oauth_client_side.html.erb +17 -15
  34. data/app/views/platform/developer/help/oauth_extensions.html.erb +1 -1
  35. data/app/views/platform/developer/help/oauth_mobile.html.erb +12 -12
  36. data/app/views/platform/developer/help/oauth_server_side.html.erb +6 -6
  37. data/app/views/platform/developer/help/sdk_ios.html.erb +3 -3
  38. data/app/views/platform/developer/help/sdk_js.html.erb +13 -185
  39. data/app/views/platform/developer/info/_basic_info.html.erb +1 -1
  40. data/app/views/platform/developer/info/_header.html.erb +3 -3
  41. data/app/views/platform/developer/registration/index.html.erb +30 -30
  42. data/app/views/platform/oauth/_authorization_box.html.erb +6 -7
  43. data/app/views/platform/oauth/_authorization_popup.html.erb +1 -1
  44. data/app/views/platform/oauth/authorize_desktop.html.erb +1 -76
  45. data/config/routes.rb +2 -4
  46. data/lib/generators/platform/proxy_generator.rb +78 -0
  47. data/lib/generators/platform/templates/config/platform/api/0/platform.yml +55 -0
  48. data/lib/generators/platform/templates/config/platform/api/0/platform_application.yml +37 -0
  49. data/lib/generators/platform/templates/config/platform/api/0/platform_developer.yml +22 -0
  50. data/{config → lib/generators/platform/templates/config}/platform/config.yml +22 -19
  51. data/{config → lib/generators/platform/templates/config}/platform/data/default_applications.yml +0 -0
  52. data/{config → lib/generators/platform/templates/config}/platform/data/default_categories.yml +0 -0
  53. data/{config → lib/generators/platform/templates/config}/platform/data/default_permissions.yml +0 -0
  54. data/{config → lib/generators/platform/templates/config}/platform/site/features.yml +0 -0
  55. data/lib/platform.rb +23 -0
  56. data/lib/platform/api/proxy/base.rb +5 -2
  57. data/lib/platform/cache.rb +1 -1
  58. data/lib/platform/config.rb +20 -3
  59. data/lib/platform/engine.rb +23 -0
  60. data/lib/platform/exception.rb +1 -1
  61. data/lib/platform/extensions/action_view_extension.rb +25 -0
  62. data/lib/platform/helper.rb +1 -1
  63. data/lib/platform/logger.rb +1 -1
  64. data/lib/platform/random_password_generator.rb +1 -1
  65. data/lib/platform/simple_string_permissions.rb +1 -1
  66. data/lib/platform/version.rb +24 -1
  67. data/lib/tasks/platform.rake +1 -1
  68. data/platform.gemspec +1 -1
  69. data/test/dummy/.pryrc +15 -0
  70. data/test/dummy/app/controllers/api/base_controller.rb +0 -1
  71. data/test/dummy/app/controllers/api/bookmarks_controller.rb +6 -1
  72. data/{app/controllers/platform/developer/resources_controller.rb → test/dummy/app/controllers/api/platform_controller.rb} +16 -2
  73. data/test/dummy/app/controllers/api/users_controller.rb +1 -0
  74. data/test/dummy/app/controllers/login_controller.rb +2 -1
  75. data/test/dummy/app/models/user.rb +8 -0
  76. data/test/dummy/app/views/layouts/_header.html.erb +1 -0
  77. data/test/dummy/app/views/layouts/blank.html.erb +24 -0
  78. data/test/dummy/app/views/layouts/mobile.html.erb +68 -0
  79. data/test/dummy/app/views/login/index.html.erb +1 -2
  80. data/test/dummy/app/views/login/register.html.erb +3 -3
  81. data/test/dummy/config/application.rb +1 -1
  82. data/test/dummy/config/platform/api/1/bookmark.yml +23 -3
  83. data/test/dummy/config/platform/api/1/platform.yml +55 -0
  84. data/test/dummy/config/platform/api/1/platform_application.yml +37 -0
  85. data/test/dummy/config/platform/api/1/platform_developer.yml +22 -0
  86. data/test/dummy/config/platform/api/1/user.yml +1 -1
  87. data/test/dummy/config/platform/config.yml +5 -4
  88. data/test/dummy/config/routes.rb +4 -0
  89. data/test/dummy/config/tr8n/config.yml +1 -1
  90. data/test/dummy/lib/platform/api/platform_application_proxy_0.rb +28 -0
  91. data/test/dummy/lib/platform/api/platform_developer_proxy_0.rb +19 -0
  92. metadata +72 -65
  93. data/app/assets/images/platform/help/login.png +0 -0
  94. data/app/assets/javascripts/platform/jsdk.js +0 -539
  95. data/app/controllers/platform/api/apps_controller.rb +0 -40
  96. data/app/views/platform/developer/resources/index.html.erb +0 -23
  97. data/test/dummy/config/platform/site/sample_apps.yml +0 -100
@@ -0,0 +1,22 @@
1
+ platform_developer:
2
+ type: "struct"
3
+ title: "Platform Developer"
4
+ path: "platform/developer"
5
+ description: "Returns information about a developer."
6
+
7
+ fields:
8
+ id:
9
+ description: "The developer's id"
10
+ type: "Number"
11
+ name:
12
+ description: "The developer's name"
13
+ type: "String"
14
+ about:
15
+ description: "The developer's description"
16
+ type: "String"
17
+ url:
18
+ description: "The developer's url"
19
+ type: "String"
20
+ created_at:
21
+ description: "The developer's creation timestamp"
22
+ type: "Number"
@@ -17,7 +17,7 @@ defaults: &defaults
17
17
  enable_developer_agreement: false
18
18
  enable_app_statistics: false
19
19
  enable_api_verification: false
20
- api_explorer_app_id: -1
20
+ api_explorer_app_id: 1 # make sure to create an application for the test tool
21
21
 
22
22
  #############################################################################
23
23
  # Platform best run with caching enabled
@@ -36,7 +36,8 @@ defaults: &defaults
36
36
  #############################################################################
37
37
  caching:
38
38
  enabled: false
39
- adapter: "Platform::CacheAdapter"
39
+ adapter: "ActiveSupport::Cache"
40
+ cache_store: ["mem_cache_store", "localhost:11211"]
40
41
  version: 1 # you can change the version to invalidate the cache
41
42
 
42
43
  #############################################################################
@@ -51,18 +52,23 @@ defaults: &defaults
51
52
  # Site Integration Settings
52
53
  #############################################################################
53
54
  site_info:
54
- title: "Sample"
55
+ title: "Sample Application"
56
+ logo_url: "/assets/platform/platform5.png"
55
57
  base_url: "localhost:3000"
56
- contact_email: platform@geni.com
58
+ contact_email: feedback@oauthx.com
57
59
  default_url: "/home"
58
60
  login_url: "/login"
61
+ logout_url: "/login/out"
59
62
  platform_layout: application
60
63
  admin_layout: admin
61
- oauth_layout: minimal
64
+ oauth_web_layout: minimal
65
+ oauth_popup_layout: popup
66
+ oauth_iframe_layout: blank
67
+ oauth_mobile_layout: mobile
68
+ oauth_desktop_layout: popup
62
69
  system_user_id: 10
63
70
  media_directory: "/media/p1"
64
71
  user_info:
65
- enabled: true
66
72
  current_user_method: current_user
67
73
  logout_method: "logout!"
68
74
  class_name: User
@@ -70,17 +76,17 @@ defaults: &defaults
70
76
  id: id
71
77
  name: name
72
78
  email: "email"
73
- link: path
74
- mugshot: square_mugshot_url
79
+ link: link
80
+ mugshot: mugshot
75
81
  admin: admin?
76
82
  guest: guest?
77
83
  locale: language
78
84
  media_info:
79
- enabled: true
85
+ enabled: false # use internal implementation
80
86
  class_name: "Platform::Media::Image"
81
87
  write_method: "write"
82
- logo_url_method: "media_url(:logo)"
83
- icon_url_method: "media_url(:icon)"
88
+ logo_url_method: "url"
89
+ icon_url_method: "url"
84
90
 
85
91
  #############################################################################
86
92
  # API Settings
@@ -88,9 +94,11 @@ defaults: &defaults
88
94
  API:
89
95
  enabled: true
90
96
  base_url: "localhost:3000/api"
97
+ scheme: "http" # can also provide an array ["http", "https"]
91
98
  config_path: "config/platform/api"
99
+ proxies_path: "lib/platform/api"
92
100
  logging_enabled: true
93
- admin_email: scott.steadman@geni.com
101
+ admin_email: feedback@oauthx.com
94
102
  allow_public: true
95
103
  cookies_enabled: true
96
104
  max_models: 50
@@ -100,8 +108,8 @@ defaults: &defaults
100
108
  supported_versions: ['1', '0']
101
109
  default_version: '1'
102
110
  explorer_groups:
103
- '0': [['document', 'photo'], ['project', 'video', 'union'], ['profile']]
104
- '1': [['user', 'project', 'photo_album', 'union', 'surname'], ['document', 'photo', 'video', 'revision'], ['profile']]
111
+ '0': [['user'], ['bookmark']]
112
+ '1': [['platform', 'user'], ['bookmark']]
105
113
  user:
106
114
  create_enabled: true
107
115
 
@@ -111,8 +119,6 @@ defaults: &defaults
111
119
  #############################################################################
112
120
  development:
113
121
  <<: *defaults
114
- enable_api_verification: true
115
- api_explorer_app_id: "TBUDuxvLLqY7ndxjzS5hnPykVMl1hIN29RwfKjh1"
116
122
 
117
123
  test:
118
124
  <<: *defaults
@@ -122,12 +128,9 @@ qa:
122
128
 
123
129
  stage:
124
130
  <<: *defaults
125
- api_explorer_app_id: "ci9EG77hmXg53AEsKlRuDe9TL2beeGupq6slAHMX"
126
131
 
127
132
  production:
128
133
  <<: *defaults
129
- api_explorer_app_id: "ci9EG77hmXg53AEsKlRuDe9TL2beeGupq6slAHMX"
130
134
 
131
135
  sandbox:
132
136
  <<: *defaults
133
- api_explorer_app_id: "tAGjqNSsCYfbDP3At9Qaf3UDrcZfIHbJH7Jp29Nn"
@@ -1,3 +1,26 @@
1
+ #--
2
+ # Copyright (c) 2011 Michael Berkovich
3
+ #
4
+ # Permission is hereby granted, free of charge, to any person obtaining
5
+ # a copy of this software and associated documentation files (the
6
+ # "Software"), to deal in the Software without restriction, including
7
+ # without limitation the rights to use, copy, modify, merge, publish,
8
+ # distribute, sublicense, and/or sell copies of the Software, and to
9
+ # permit persons to whom the Software is furnished to do so, subject to
10
+ # the following conditions:
11
+ #
12
+ # The above copyright notice and this permission notice shall be
13
+ # included in all copies or substantial portions of the Software.
14
+ #
15
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
16
+ # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
17
+ # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
18
+ # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
19
+ # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
20
+ # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
21
+ # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
22
+ #++
23
+
1
24
  require File.join(File.dirname(__FILE__), 'platform/railtie')
2
25
  require File.join(File.dirname(__FILE__), 'platform/engine')
3
26
 
@@ -1,5 +1,3 @@
1
- require 'platform/api/proxy'
2
-
3
1
  module Platform
4
2
  module Api
5
3
  module Proxy
@@ -55,6 +53,11 @@ module Platform
55
53
  "#{Platform::Config.api_scheme}://#{Platform::Config.api_base_url}/#{instance.class.name.underscore}/#{instance.id}"
56
54
  end
57
55
 
56
+ def full_url(url)
57
+ return url if url.index('http')
58
+ "http://#{Platform::Config.site_base_url}#{url}"
59
+ end
60
+
58
61
  end # class Base
59
62
 
60
63
  end # module Proxy
@@ -1,5 +1,5 @@
1
1
  #--
2
- # Copyright (c) 2011 Michael Berkovich, Geni Inc
2
+ # Copyright (c) 2011 Michael Berkovich
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
@@ -1,5 +1,5 @@
1
1
  #--
2
- # Copyright (c) 2011 Michael Berkovich, Geni Inc
2
+ # Copyright (c) 2011 Michael Berkovich
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
@@ -606,12 +606,12 @@ module Platform
606
606
  !api_explorer_app_id.blank?
607
607
  end
608
608
 
609
- def self.proxies_path
609
+ def self.api_proxies_path
610
610
  api[:proxies_path]
611
611
  end
612
612
 
613
613
  def self.load_proxies
614
- Dir["#{root}/#{proxies_path}/*_proxy_*.rb"].each do |file|
614
+ Dir["#{root}/#{api_proxies_path}/*_proxy_*.rb"].each do |file|
615
615
  require_or_load file
616
616
  end
617
617
  end
@@ -640,6 +640,23 @@ module Platform
640
640
  @api_reference[api_version]
641
641
  end
642
642
 
643
+ def self.api_reference_by_path(api_version, path)
644
+ @api_reference_by_path ||= {}
645
+ @api_reference_by_path[api_version] ||= begin
646
+ api = api_reference(api_version)
647
+ by_path = {}
648
+ api.each do |key, defs|
649
+ by_path[defs["path"]] = api[key]
650
+ (defs[:actions] || []).each do |act_key, acts|
651
+ path = acts["path"] || "#{defs["path"]}/#{act_key}"
652
+ by_path[path] = defs[:actions][act_key]
653
+ end
654
+ end
655
+ by_path
656
+ end
657
+ @api_reference_by_path[api_version][path]
658
+ end
659
+
643
660
  def self.api_explorer_groups(api_version = api_default_version)
644
661
  api[:explorer_groups][api_version]
645
662
  end
@@ -1,3 +1,26 @@
1
+ #--
2
+ # Copyright (c) 2011 Michael Berkovich
3
+ #
4
+ # Permission is hereby granted, free of charge, to any person obtaining
5
+ # a copy of this software and associated documentation files (the
6
+ # "Software"), to deal in the Software without restriction, including
7
+ # without limitation the rights to use, copy, modify, merge, publish,
8
+ # distribute, sublicense, and/or sell copies of the Software, and to
9
+ # permit persons to whom the Software is furnished to do so, subject to
10
+ # the following conditions:
11
+ #
12
+ # The above copyright notice and this permission notice shall be
13
+ # included in all copies or substantial portions of the Software.
14
+ #
15
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
16
+ # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
17
+ # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
18
+ # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
19
+ # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
20
+ # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
21
+ # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
22
+ #++
23
+
1
24
  module Platform
2
25
  class Engine < Rails::Engine
3
26
  isolate_namespace Platform
@@ -1,5 +1,5 @@
1
1
  #--
2
- # Copyright (c) 2011 Michael Berkovich, Geni Inc
2
+ # Copyright (c) 2011 Michael Berkovich
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
@@ -163,6 +163,31 @@ module Platform
163
163
  def platform_stringify_url(path, params)
164
164
  "#{path}#{path.index('?') ? '&' : '?'}#{params.collect{|n,v| "#{n}=#{CGI.escape(v.to_s)}"}.join("&")}"
165
165
  end
166
+
167
+ def platform_when_string_tr(key, opts = {})
168
+ tr(key, 'Time reference', opts)
169
+ end
170
+
171
+ def platform_display_time(time, format)
172
+ time.tr(format).gsub('/ ', '/').sub(/^[0:]*/,"")
173
+ end
174
+
175
+ def platform_when_string_tag(time, opts = {})
176
+ elapsed_seconds = Time.now - time
177
+ return platform_when_string_tr("Today") if time.today_in_time_zone? if opts[:days_only]
178
+ return platform_when_string_tr('In the future, Marty!') if elapsed_seconds < 0
179
+ return platform_when_string_tr('A moment ago') if elapsed_seconds < 2.minutes
180
+ return platform_when_string_tr("{minutes||minute} ago", :minutes => (elapsed_seconds / 1.minute).to_i) if elapsed_seconds < 1.hour
181
+ return platform_when_string_tr("{hours||hour} ago", :hours => 1) if elapsed_seconds < 1.75.hours
182
+ return platform_when_string_tr("{hours||hour} ago", :hours => 2) if elapsed_seconds < 2.hours
183
+ return platform_when_string_tr("{hours||hour} ago", :hours => (elapsed_seconds / 1.hour).to_i) if elapsed_seconds < 1.day
184
+ return platform_when_string_tr("Yesterday") if elapsed_seconds < 48.hours
185
+ return platform_when_string_tr("{days||day} ago", :days => elapsed_seconds.to_i / 1.day) if elapsed_seconds < 14.days
186
+ return platform_when_string_tr("{weeks||week} ago", :weeks => (elapsed_seconds / 1.day / 7).to_i) if elapsed_weeks < 4
187
+ return platform_display_time(time, :monthname_abbr) if Date.today.year == time.year
188
+ return platform_display_time(time, :monthname_abbr_year)
189
+ end
190
+
166
191
  end
167
192
  end
168
193
  end
@@ -1,5 +1,5 @@
1
1
  #--
2
- # Copyright (c) 2011 Michael Berkovich, Geni Inc
2
+ # Copyright (c) 2011 Michael Berkovich
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
@@ -1,5 +1,5 @@
1
1
  #--
2
- # Copyright (c) 2011 Michael Berkovich, Geni Inc
2
+ # Copyright (c) 2011 Michael Berkovich
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
@@ -1,5 +1,5 @@
1
1
  #--
2
- # Copyright (c) 2011 Michael Berkovich, Geni Inc
2
+ # Copyright (c) 2011 Michael Berkovich
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
@@ -1,5 +1,5 @@
1
1
  #--
2
- # Copyright (c) 2011 Michael Berkovich, Geni Inc
2
+ # Copyright (c) 2011 Michael Berkovich
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
@@ -1,3 +1,26 @@
1
+ #--
2
+ # Copyright (c) 2011 Michael Berkovich
3
+ #
4
+ # Permission is hereby granted, free of charge, to any person obtaining
5
+ # a copy of this software and associated documentation files (the
6
+ # "Software"), to deal in the Software without restriction, including
7
+ # without limitation the rights to use, copy, modify, merge, publish,
8
+ # distribute, sublicense, and/or sell copies of the Software, and to
9
+ # permit persons to whom the Software is furnished to do so, subject to
10
+ # the following conditions:
11
+ #
12
+ # The above copyright notice and this permission notice shall be
13
+ # included in all copies or substantial portions of the Software.
14
+ #
15
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
16
+ # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
17
+ # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
18
+ # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
19
+ # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
20
+ # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
21
+ # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
22
+ #++
23
+
1
24
  module Platform
2
- VERSION = "3.1.1"
25
+ VERSION = "3.1.2"
3
26
  end
@@ -1,5 +1,5 @@
1
1
  #--
2
- # Copyright (c) 2011 Michael Berkovich, Geni Inc
2
+ # Copyright (c) 2011 Michael Berkovich
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
@@ -30,7 +30,7 @@ Gem::Specification.new do |s|
30
30
  s.add_dependency 'coffee-script', ['>= 0']
31
31
  s.add_dependency 'acts_as_tree', ['>= 0']
32
32
  s.add_dependency 'acts_as_state_machine', ['>= 0']
33
- s.add_dependency 'rmagick', ['>= 0']
33
+ # s.add_dependency 'rmagick', ['>= 0']
34
34
  s.add_development_dependency 'pry', ['>= 0']
35
35
  s.add_development_dependency 'bundler', ['>= 1.0.0']
36
36
  s.add_development_dependency 'sqlite3', ['>= 0']
@@ -0,0 +1,15 @@
1
+ rails = File.join Dir.getwd, 'config', 'environment.rb'
2
+
3
+ if File.exist?(rails) && ENV['SKIP_RAILS'].nil?
4
+ require rails
5
+
6
+ if Rails.version[0..0] == "2"
7
+ require 'console_app'
8
+ require 'console_with_helpers'
9
+ elsif Rails.version[0..0] == "3"
10
+ require 'rails/console/app'
11
+ require 'rails/console/helpers'
12
+ else
13
+ warn "[WARN] cannot load Rails console commands (Not on Rails2 or Rails3?)"
14
+ end
15
+ end
@@ -1,5 +1,4 @@
1
1
  # This is where all of the custom application stuff goes
2
2
  class Api::BaseController < Platform::Api::BaseController
3
3
 
4
-
5
4
  end
@@ -2,10 +2,13 @@ class Api::BookmarksController < Api::BaseController
2
2
 
3
3
  def index
4
4
  ensure_get
5
- render_response page_model
5
+ ensure_ids_provided
6
+ ensure_ownership
7
+ render_response page_models
6
8
  end
7
9
 
8
10
  def create
11
+ ensure_logged_in
9
12
  raise BadRequestError.new("Title and url must be provided") if params[:title].blank? or params[:url].blank?
10
13
  bookmark = Bookmark.create(:user => current_user, :title => params[:title], :url => params[:url])
11
14
  return redirect_to(params[:url]) if params[:bookmarklet]
@@ -13,6 +16,7 @@ class Api::BookmarksController < Api::BaseController
13
16
  end
14
17
 
15
18
  def update
19
+ ensure_logged_in
16
20
  ensure_ownership
17
21
  raise BadRequestError.new("Title and url must be provided") if params[:title].blank? or params[:url].blank?
18
22
  page_model.update_attributes(params.slice(:title, :url))
@@ -20,6 +24,7 @@ class Api::BookmarksController < Api::BaseController
20
24
  end
21
25
 
22
26
  def delete
27
+ ensure_logged_in
23
28
  ensure_post
24
29
  ensure_ownership
25
30
  page_model.destroy
@@ -21,10 +21,24 @@
21
21
  # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
22
22
  #++
23
23
 
24
- class Platform::Developer::ResourcesController < Platform::Developer::BaseController
24
+ class Api::PlatformController < Api::BaseController
25
25
 
26
26
  def index
27
-
27
+ render_response(:status => "ok")
28
+ end
29
+
30
+ def apps
31
+ render_response(page_models)
32
+ end
33
+
34
+ def services
35
+ render_response Platform::Config.api_reference(api_version)
36
+ end
37
+
38
+ private
39
+
40
+ def model_class
41
+ Platform::Application
28
42
  end
29
43
 
30
44
  end