openstax_api 0.2.1 → 1.0.0
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 +8 -8
- data/app/controllers/openstax/api/v1/api_controller.rb +18 -6
- data/app/models/openstax/api/api_user.rb +1 -1
- data/lib/openstax/api/route_extensions.rb +4 -3
- data/lib/openstax/api/version.rb +1 -1
- data/lib/openstax_api.rb +19 -0
- data/spec/{app/controllers → controllers}/openstax/api/v1/api_controller_spec.rb +0 -0
- data/spec/dummy/app/controllers/application_controller.rb +4 -0
- data/spec/dummy/config/initializers/openstax_api.rb +1 -0
- data/spec/dummy/db/test.sqlite3 +0 -0
- data/spec/dummy/log/development.log +137 -0
- data/spec/dummy/log/test.log +78 -0
- data/spec/{app/models → models}/openstax/api/api_user_spec.rb +0 -0
- data/spec/{app/representers → representers}/openstax/api/v1/representable_schema_printer_spec.rb +0 -0
- metadata +8 -11
- data/app/controllers/openstax/api/v1/oauth_based_api_controller.rb +0 -15
- data/spec/app/controllers/openstax/api/v1/oauth_based_api_controller_spec.rb +0 -11
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
MGIwMjBlNDc2YWY3YzVkZjdiYjg0NWNhYTU3ZDY2NTYwZmZhMTFiMw==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
ZmQ0MGZmMWFkMmNiMjM0MGRlZWQyMDE0YThmODgwYmVlMGNhNDJhNQ==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
NGUwM2NkODE3Njk2MzlhNmY1OGNjZTY0NjkwMDVhYzg0YmI1MmIwNGRiMWMy
|
10
|
+
ZDVhNDY1ODIwY2I0OGMyYzNiNzBlODRkMmU4ZjQ2ODMzMWQ1NGZiYWE3ZTUx
|
11
|
+
NWY5YjM2ZjQwM2Q0ZWFmYzQzMzhjMmJlNzQyZDIxMTNiZjI2Yzc=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
MzM5MjJmMjgxNTA2ODIwMjEwNmFjMjhlMTA0OTcwMzZlNjIzNDJiYzYwOWUw
|
14
|
+
YzlhNGZkMzQ1ZjY4MzhhMTJmOWU0MGIyYjQ1NmUxNmU0MzJkMjg4OGIwMmYy
|
15
|
+
YjY2YWQ5OGJjNzczNWYwOGVjMjg2ZWE2YTYxYTEwZjI2NTI0NmE=
|
@@ -20,26 +20,38 @@ module OpenStax
|
|
20
20
|
skip_protect_beta if respond_to? :skip_protect_beta
|
21
21
|
|
22
22
|
skip_before_filter :authenticate_user!
|
23
|
+
doorkeeper_for :all, :unless => :application_user_without_token?
|
24
|
+
skip_before_filter :verify_authenticity_token,
|
25
|
+
:unless => :application_user_without_token?
|
23
26
|
|
24
27
|
respond_to :json
|
25
28
|
rescue_from Exception, :with => :rescue_from_exception
|
26
29
|
|
30
|
+
# Keep old current_user method so we can use it
|
31
|
+
alias_method :current_application_user,
|
32
|
+
OpenStax::Api.configuration.current_user_method
|
33
|
+
|
27
34
|
# TODO: doorkeeper users (or rather users who have doorkeeper
|
28
35
|
# applications) need to agree to API terms of use (need to have agreed
|
29
36
|
# to it at one time, can't require them to agree when terms change since
|
30
37
|
# their apps are doing the talking) -- this needs more thought
|
31
38
|
|
39
|
+
# TODO: maybe freak out if current_user is anonymous (require we know
|
40
|
+
# who person/app is so we can do things like throttling, API terms
|
41
|
+
# agreement, etc)
|
42
|
+
|
43
|
+
# Always return an ApiUser
|
32
44
|
def current_user
|
33
|
-
@
|
34
|
-
|
35
|
-
super
|
36
|
-
# TODO: maybe freak out if current user is anonymous (require we know
|
37
|
-
# who person/app is so we can do things like throttling, API terms
|
38
|
-
# agreement, etc)
|
45
|
+
@current_api_user ||= ApiUser.new(doorkeeper_token,
|
46
|
+
lambda { current_application_user })
|
39
47
|
end
|
40
48
|
|
41
49
|
protected
|
42
50
|
|
51
|
+
def application_user_without_token?
|
52
|
+
current_application_user && doorkeeper_token.blank?
|
53
|
+
end
|
54
|
+
|
43
55
|
def rescue_from_exception(exception)
|
44
56
|
# See https://github.com/rack/rack/blob/master/lib/rack/utils.rb#L453 for error names/symbols
|
45
57
|
error = :internal_server_error
|
@@ -27,7 +27,7 @@ module OpenStax
|
|
27
27
|
# procs that can get it for us. This could save us some queries.
|
28
28
|
|
29
29
|
if doorkeeper_token
|
30
|
-
user_class = OpenStax::Api.configuration.user_class_name.
|
30
|
+
user_class = OpenStax::Api.configuration.user_class_name.constantize
|
31
31
|
@application_proc = lambda { doorkeeper_token.application }
|
32
32
|
@user_proc = lambda {
|
33
33
|
doorkeeper_token.resource_owner_id ?
|
@@ -3,9 +3,10 @@ require 'openstax/api/constraints'
|
|
3
3
|
module OpenStax
|
4
4
|
module Api
|
5
5
|
module RouteExtensions
|
6
|
-
def api(version
|
7
|
-
constraints = Constraints.new(version: version,
|
8
|
-
|
6
|
+
def api(version, options = {})
|
7
|
+
constraints = Constraints.new(version: version,
|
8
|
+
default: options.delete(:default))
|
9
|
+
namespace :api, defaults: {format: 'json'}.merge(options) do
|
9
10
|
scope(module: version,
|
10
11
|
constraints: constraints) { yield }
|
11
12
|
end
|
data/lib/openstax/api/version.rb
CHANGED
data/lib/openstax_api.rb
CHANGED
@@ -13,11 +13,30 @@ module OpenStax
|
|
13
13
|
@configuration ||= Configuration.new
|
14
14
|
end
|
15
15
|
|
16
|
+
###########################################################################
|
17
|
+
#
|
18
|
+
# Configuration machinery.
|
19
|
+
#
|
20
|
+
# To configure OpenStax Api, put the following code in your applications
|
21
|
+
# initialization logic (eg. in the config/initializers in a Rails app)
|
22
|
+
#
|
23
|
+
# OpenStax::Api.configure do |config|
|
24
|
+
# config.<parameter name> = <parameter value>
|
25
|
+
# ...
|
26
|
+
# end
|
27
|
+
#
|
28
|
+
# user_class_name is a String containing the name of your User model class.
|
29
|
+
#
|
30
|
+
# current_user_method is a String containing the name of your controller
|
31
|
+
# method that returns the current user.
|
32
|
+
#
|
16
33
|
class Configuration
|
17
34
|
attr_accessor :user_class_name
|
35
|
+
attr_accessor :current_user_method
|
18
36
|
|
19
37
|
def initialize
|
20
38
|
@user_class_name = 'User'
|
39
|
+
@current_user_method = 'current_user'
|
21
40
|
end
|
22
41
|
end
|
23
42
|
|
File without changes
|
data/spec/dummy/db/test.sqlite3
CHANGED
Binary file
|
@@ -199,3 +199,140 @@ Connecting to database specified by database.yml
|
|
199
199
|
[1m[35m (1.0ms)[0m CREATE TABLE "oauth_applications" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "name" varchar(255) NOT NULL, "uid" varchar(255) NOT NULL, "secret" varchar(255) NOT NULL, "redirect_uri" text NOT NULL, "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL)
|
200
200
|
[1m[36m (0.7ms)[0m [1mCREATE UNIQUE INDEX "index_oauth_applications_on_uid" ON "oauth_applications" ("uid")[0m
|
201
201
|
[1m[35m (0.1ms)[0m SELECT version FROM "schema_migrations"
|
202
|
+
Connecting to database specified by database.yml
|
203
|
+
[1m[36m (1.6ms)[0m [1mSELECT "schema_migrations"."version" FROM "schema_migrations" [0m
|
204
|
+
[1m[35m (0.3ms)[0m select sqlite_version(*)
|
205
|
+
[1m[36m (0.9ms)[0m [1mDROP TABLE "dummy_users"[0m
|
206
|
+
[1m[35m (0.8ms)[0m CREATE TABLE "dummy_users" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "username" varchar(255), "password_hash" varchar(255), "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL)
|
207
|
+
[1m[36m (0.8ms)[0m [1mDROP TABLE "oauth_access_grants"[0m
|
208
|
+
[1m[35m (0.8ms)[0m CREATE TABLE "oauth_access_grants" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "resource_owner_id" integer NOT NULL, "application_id" integer NOT NULL, "token" varchar(255) NOT NULL, "expires_in" integer NOT NULL, "redirect_uri" text NOT NULL, "created_at" datetime NOT NULL, "revoked_at" datetime, "scopes" varchar(255))
|
209
|
+
[1m[36m (0.8ms)[0m [1mCREATE UNIQUE INDEX "index_oauth_access_grants_on_token" ON "oauth_access_grants" ("token")[0m
|
210
|
+
[1m[35m (1.0ms)[0m DROP TABLE "oauth_access_tokens"
|
211
|
+
[1m[36m (0.9ms)[0m [1mCREATE TABLE "oauth_access_tokens" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "resource_owner_id" integer, "application_id" integer, "token" varchar(255) NOT NULL, "refresh_token" varchar(255), "expires_in" integer, "revoked_at" datetime, "created_at" datetime NOT NULL, "scopes" varchar(255)) [0m
|
212
|
+
[1m[35m (0.8ms)[0m CREATE UNIQUE INDEX "index_oauth_access_tokens_on_refresh_token" ON "oauth_access_tokens" ("refresh_token")
|
213
|
+
[1m[36m (0.8ms)[0m [1mCREATE INDEX "index_oauth_access_tokens_on_resource_owner_id" ON "oauth_access_tokens" ("resource_owner_id")[0m
|
214
|
+
[1m[35m (0.8ms)[0m CREATE UNIQUE INDEX "index_oauth_access_tokens_on_token" ON "oauth_access_tokens" ("token")
|
215
|
+
[1m[36m (1.9ms)[0m [1mDROP TABLE "oauth_applications"[0m
|
216
|
+
[1m[35m (0.9ms)[0m CREATE TABLE "oauth_applications" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "name" varchar(255) NOT NULL, "uid" varchar(255) NOT NULL, "secret" varchar(255) NOT NULL, "redirect_uri" text NOT NULL, "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL)
|
217
|
+
[1m[36m (0.8ms)[0m [1mCREATE UNIQUE INDEX "index_oauth_applications_on_uid" ON "oauth_applications" ("uid")[0m
|
218
|
+
[1m[35m (0.1ms)[0m SELECT version FROM "schema_migrations"
|
219
|
+
Connecting to database specified by database.yml
|
220
|
+
[1m[36m (1.5ms)[0m [1mSELECT "schema_migrations"."version" FROM "schema_migrations" [0m
|
221
|
+
[1m[35m (0.2ms)[0m select sqlite_version(*)
|
222
|
+
[1m[36m (1.8ms)[0m [1mDROP TABLE "dummy_users"[0m
|
223
|
+
[1m[35m (1.0ms)[0m CREATE TABLE "dummy_users" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "username" varchar(255), "password_hash" varchar(255), "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL)
|
224
|
+
[1m[36m (0.9ms)[0m [1mDROP TABLE "oauth_access_grants"[0m
|
225
|
+
[1m[35m (0.9ms)[0m CREATE TABLE "oauth_access_grants" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "resource_owner_id" integer NOT NULL, "application_id" integer NOT NULL, "token" varchar(255) NOT NULL, "expires_in" integer NOT NULL, "redirect_uri" text NOT NULL, "created_at" datetime NOT NULL, "revoked_at" datetime, "scopes" varchar(255))
|
226
|
+
[1m[36m (0.8ms)[0m [1mCREATE UNIQUE INDEX "index_oauth_access_grants_on_token" ON "oauth_access_grants" ("token")[0m
|
227
|
+
[1m[35m (0.9ms)[0m DROP TABLE "oauth_access_tokens"
|
228
|
+
[1m[36m (0.8ms)[0m [1mCREATE TABLE "oauth_access_tokens" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "resource_owner_id" integer, "application_id" integer, "token" varchar(255) NOT NULL, "refresh_token" varchar(255), "expires_in" integer, "revoked_at" datetime, "created_at" datetime NOT NULL, "scopes" varchar(255)) [0m
|
229
|
+
[1m[35m (0.8ms)[0m CREATE UNIQUE INDEX "index_oauth_access_tokens_on_refresh_token" ON "oauth_access_tokens" ("refresh_token")
|
230
|
+
[1m[36m (0.8ms)[0m [1mCREATE INDEX "index_oauth_access_tokens_on_resource_owner_id" ON "oauth_access_tokens" ("resource_owner_id")[0m
|
231
|
+
[1m[35m (0.8ms)[0m CREATE UNIQUE INDEX "index_oauth_access_tokens_on_token" ON "oauth_access_tokens" ("token")
|
232
|
+
[1m[36m (0.8ms)[0m [1mDROP TABLE "oauth_applications"[0m
|
233
|
+
[1m[35m (0.8ms)[0m CREATE TABLE "oauth_applications" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "name" varchar(255) NOT NULL, "uid" varchar(255) NOT NULL, "secret" varchar(255) NOT NULL, "redirect_uri" text NOT NULL, "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL)
|
234
|
+
[1m[36m (0.8ms)[0m [1mCREATE UNIQUE INDEX "index_oauth_applications_on_uid" ON "oauth_applications" ("uid")[0m
|
235
|
+
[1m[35m (0.1ms)[0m SELECT version FROM "schema_migrations"
|
236
|
+
Connecting to database specified by database.yml
|
237
|
+
Connecting to database specified by database.yml
|
238
|
+
[1m[36m (1.5ms)[0m [1mSELECT "schema_migrations"."version" FROM "schema_migrations" [0m
|
239
|
+
[1m[35m (0.2ms)[0m select sqlite_version(*)
|
240
|
+
[1m[36m (1.6ms)[0m [1mDROP TABLE "dummy_users"[0m
|
241
|
+
[1m[35m (1.0ms)[0m CREATE TABLE "dummy_users" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "username" varchar(255), "password_hash" varchar(255), "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL)
|
242
|
+
[1m[36m (0.8ms)[0m [1mDROP TABLE "oauth_access_grants"[0m
|
243
|
+
[1m[35m (0.8ms)[0m CREATE TABLE "oauth_access_grants" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "resource_owner_id" integer NOT NULL, "application_id" integer NOT NULL, "token" varchar(255) NOT NULL, "expires_in" integer NOT NULL, "redirect_uri" text NOT NULL, "created_at" datetime NOT NULL, "revoked_at" datetime, "scopes" varchar(255))
|
244
|
+
[1m[36m (0.8ms)[0m [1mCREATE UNIQUE INDEX "index_oauth_access_grants_on_token" ON "oauth_access_grants" ("token")[0m
|
245
|
+
[1m[35m (0.9ms)[0m DROP TABLE "oauth_access_tokens"
|
246
|
+
[1m[36m (0.8ms)[0m [1mCREATE TABLE "oauth_access_tokens" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "resource_owner_id" integer, "application_id" integer, "token" varchar(255) NOT NULL, "refresh_token" varchar(255), "expires_in" integer, "revoked_at" datetime, "created_at" datetime NOT NULL, "scopes" varchar(255)) [0m
|
247
|
+
[1m[35m (0.8ms)[0m CREATE UNIQUE INDEX "index_oauth_access_tokens_on_refresh_token" ON "oauth_access_tokens" ("refresh_token")
|
248
|
+
[1m[36m (0.8ms)[0m [1mCREATE INDEX "index_oauth_access_tokens_on_resource_owner_id" ON "oauth_access_tokens" ("resource_owner_id")[0m
|
249
|
+
[1m[35m (0.8ms)[0m CREATE UNIQUE INDEX "index_oauth_access_tokens_on_token" ON "oauth_access_tokens" ("token")
|
250
|
+
[1m[36m (0.8ms)[0m [1mDROP TABLE "oauth_applications"[0m
|
251
|
+
[1m[35m (0.8ms)[0m CREATE TABLE "oauth_applications" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "name" varchar(255) NOT NULL, "uid" varchar(255) NOT NULL, "secret" varchar(255) NOT NULL, "redirect_uri" text NOT NULL, "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL)
|
252
|
+
[1m[36m (0.8ms)[0m [1mCREATE UNIQUE INDEX "index_oauth_applications_on_uid" ON "oauth_applications" ("uid")[0m
|
253
|
+
[1m[35m (0.1ms)[0m SELECT version FROM "schema_migrations"
|
254
|
+
Connecting to database specified by database.yml
|
255
|
+
[1m[36m (1.5ms)[0m [1mSELECT "schema_migrations"."version" FROM "schema_migrations" [0m
|
256
|
+
[1m[35m (0.2ms)[0m select sqlite_version(*)
|
257
|
+
[1m[36m (1.8ms)[0m [1mDROP TABLE "dummy_users"[0m
|
258
|
+
[1m[35m (1.1ms)[0m CREATE TABLE "dummy_users" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "username" varchar(255), "password_hash" varchar(255), "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL)
|
259
|
+
[1m[36m (0.9ms)[0m [1mDROP TABLE "oauth_access_grants"[0m
|
260
|
+
[1m[35m (0.8ms)[0m CREATE TABLE "oauth_access_grants" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "resource_owner_id" integer NOT NULL, "application_id" integer NOT NULL, "token" varchar(255) NOT NULL, "expires_in" integer NOT NULL, "redirect_uri" text NOT NULL, "created_at" datetime NOT NULL, "revoked_at" datetime, "scopes" varchar(255))
|
261
|
+
[1m[36m (0.8ms)[0m [1mCREATE UNIQUE INDEX "index_oauth_access_grants_on_token" ON "oauth_access_grants" ("token")[0m
|
262
|
+
[1m[35m (0.9ms)[0m DROP TABLE "oauth_access_tokens"
|
263
|
+
[1m[36m (0.8ms)[0m [1mCREATE TABLE "oauth_access_tokens" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "resource_owner_id" integer, "application_id" integer, "token" varchar(255) NOT NULL, "refresh_token" varchar(255), "expires_in" integer, "revoked_at" datetime, "created_at" datetime NOT NULL, "scopes" varchar(255)) [0m
|
264
|
+
[1m[35m (0.8ms)[0m CREATE UNIQUE INDEX "index_oauth_access_tokens_on_refresh_token" ON "oauth_access_tokens" ("refresh_token")
|
265
|
+
[1m[36m (0.8ms)[0m [1mCREATE INDEX "index_oauth_access_tokens_on_resource_owner_id" ON "oauth_access_tokens" ("resource_owner_id")[0m
|
266
|
+
[1m[35m (0.8ms)[0m CREATE UNIQUE INDEX "index_oauth_access_tokens_on_token" ON "oauth_access_tokens" ("token")
|
267
|
+
[1m[36m (0.9ms)[0m [1mDROP TABLE "oauth_applications"[0m
|
268
|
+
[1m[35m (0.9ms)[0m CREATE TABLE "oauth_applications" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "name" varchar(255) NOT NULL, "uid" varchar(255) NOT NULL, "secret" varchar(255) NOT NULL, "redirect_uri" text NOT NULL, "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL)
|
269
|
+
[1m[36m (0.7ms)[0m [1mCREATE UNIQUE INDEX "index_oauth_applications_on_uid" ON "oauth_applications" ("uid")[0m
|
270
|
+
[1m[35m (0.1ms)[0m SELECT version FROM "schema_migrations"
|
271
|
+
Connecting to database specified by database.yml
|
272
|
+
[1m[36m (1.5ms)[0m [1mSELECT "schema_migrations"."version" FROM "schema_migrations" [0m
|
273
|
+
[1m[35m (0.2ms)[0m select sqlite_version(*)
|
274
|
+
[1m[36m (1.5ms)[0m [1mDROP TABLE "dummy_users"[0m
|
275
|
+
[1m[35m (0.8ms)[0m CREATE TABLE "dummy_users" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "username" varchar(255), "password_hash" varchar(255), "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL)
|
276
|
+
[1m[36m (0.6ms)[0m [1mDROP TABLE "oauth_access_grants"[0m
|
277
|
+
[1m[35m (0.7ms)[0m CREATE TABLE "oauth_access_grants" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "resource_owner_id" integer NOT NULL, "application_id" integer NOT NULL, "token" varchar(255) NOT NULL, "expires_in" integer NOT NULL, "redirect_uri" text NOT NULL, "created_at" datetime NOT NULL, "revoked_at" datetime, "scopes" varchar(255))
|
278
|
+
[1m[36m (0.7ms)[0m [1mCREATE UNIQUE INDEX "index_oauth_access_grants_on_token" ON "oauth_access_grants" ("token")[0m
|
279
|
+
[1m[35m (1.0ms)[0m DROP TABLE "oauth_access_tokens"
|
280
|
+
[1m[36m (0.8ms)[0m [1mCREATE TABLE "oauth_access_tokens" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "resource_owner_id" integer, "application_id" integer, "token" varchar(255) NOT NULL, "refresh_token" varchar(255), "expires_in" integer, "revoked_at" datetime, "created_at" datetime NOT NULL, "scopes" varchar(255)) [0m
|
281
|
+
[1m[35m (0.8ms)[0m CREATE UNIQUE INDEX "index_oauth_access_tokens_on_refresh_token" ON "oauth_access_tokens" ("refresh_token")
|
282
|
+
[1m[36m (0.8ms)[0m [1mCREATE INDEX "index_oauth_access_tokens_on_resource_owner_id" ON "oauth_access_tokens" ("resource_owner_id")[0m
|
283
|
+
[1m[35m (0.8ms)[0m CREATE UNIQUE INDEX "index_oauth_access_tokens_on_token" ON "oauth_access_tokens" ("token")
|
284
|
+
[1m[36m (0.8ms)[0m [1mDROP TABLE "oauth_applications"[0m
|
285
|
+
[1m[35m (0.9ms)[0m CREATE TABLE "oauth_applications" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "name" varchar(255) NOT NULL, "uid" varchar(255) NOT NULL, "secret" varchar(255) NOT NULL, "redirect_uri" text NOT NULL, "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL)
|
286
|
+
[1m[36m (0.8ms)[0m [1mCREATE UNIQUE INDEX "index_oauth_applications_on_uid" ON "oauth_applications" ("uid")[0m
|
287
|
+
[1m[35m (0.1ms)[0m SELECT version FROM "schema_migrations"
|
288
|
+
Connecting to database specified by database.yml
|
289
|
+
[1m[36m (1.5ms)[0m [1mSELECT "schema_migrations"."version" FROM "schema_migrations" [0m
|
290
|
+
[1m[35m (0.2ms)[0m select sqlite_version(*)
|
291
|
+
[1m[36m (1.8ms)[0m [1mDROP TABLE "dummy_users"[0m
|
292
|
+
[1m[35m (1.1ms)[0m CREATE TABLE "dummy_users" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "username" varchar(255), "password_hash" varchar(255), "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL)
|
293
|
+
[1m[36m (0.9ms)[0m [1mDROP TABLE "oauth_access_grants"[0m
|
294
|
+
[1m[35m (1.0ms)[0m CREATE TABLE "oauth_access_grants" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "resource_owner_id" integer NOT NULL, "application_id" integer NOT NULL, "token" varchar(255) NOT NULL, "expires_in" integer NOT NULL, "redirect_uri" text NOT NULL, "created_at" datetime NOT NULL, "revoked_at" datetime, "scopes" varchar(255))
|
295
|
+
[1m[36m (0.8ms)[0m [1mCREATE UNIQUE INDEX "index_oauth_access_grants_on_token" ON "oauth_access_grants" ("token")[0m
|
296
|
+
[1m[35m (1.0ms)[0m DROP TABLE "oauth_access_tokens"
|
297
|
+
[1m[36m (0.9ms)[0m [1mCREATE TABLE "oauth_access_tokens" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "resource_owner_id" integer, "application_id" integer, "token" varchar(255) NOT NULL, "refresh_token" varchar(255), "expires_in" integer, "revoked_at" datetime, "created_at" datetime NOT NULL, "scopes" varchar(255)) [0m
|
298
|
+
[1m[35m (0.8ms)[0m CREATE UNIQUE INDEX "index_oauth_access_tokens_on_refresh_token" ON "oauth_access_tokens" ("refresh_token")
|
299
|
+
[1m[36m (0.8ms)[0m [1mCREATE INDEX "index_oauth_access_tokens_on_resource_owner_id" ON "oauth_access_tokens" ("resource_owner_id")[0m
|
300
|
+
[1m[35m (1.0ms)[0m CREATE UNIQUE INDEX "index_oauth_access_tokens_on_token" ON "oauth_access_tokens" ("token")
|
301
|
+
[1m[36m (0.8ms)[0m [1mDROP TABLE "oauth_applications"[0m
|
302
|
+
[1m[35m (0.8ms)[0m CREATE TABLE "oauth_applications" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "name" varchar(255) NOT NULL, "uid" varchar(255) NOT NULL, "secret" varchar(255) NOT NULL, "redirect_uri" text NOT NULL, "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL)
|
303
|
+
[1m[36m (0.8ms)[0m [1mCREATE UNIQUE INDEX "index_oauth_applications_on_uid" ON "oauth_applications" ("uid")[0m
|
304
|
+
[1m[35m (0.1ms)[0m SELECT version FROM "schema_migrations"
|
305
|
+
Connecting to database specified by database.yml
|
306
|
+
[1m[36m (1.5ms)[0m [1mSELECT "schema_migrations"."version" FROM "schema_migrations" [0m
|
307
|
+
[1m[35m (0.2ms)[0m select sqlite_version(*)
|
308
|
+
[1m[36m (1.8ms)[0m [1mDROP TABLE "dummy_users"[0m
|
309
|
+
[1m[35m (1.0ms)[0m CREATE TABLE "dummy_users" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "username" varchar(255), "password_hash" varchar(255), "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL)
|
310
|
+
[1m[36m (0.9ms)[0m [1mDROP TABLE "oauth_access_grants"[0m
|
311
|
+
[1m[35m (0.8ms)[0m CREATE TABLE "oauth_access_grants" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "resource_owner_id" integer NOT NULL, "application_id" integer NOT NULL, "token" varchar(255) NOT NULL, "expires_in" integer NOT NULL, "redirect_uri" text NOT NULL, "created_at" datetime NOT NULL, "revoked_at" datetime, "scopes" varchar(255))
|
312
|
+
[1m[36m (0.7ms)[0m [1mCREATE UNIQUE INDEX "index_oauth_access_grants_on_token" ON "oauth_access_grants" ("token")[0m
|
313
|
+
[1m[35m (0.9ms)[0m DROP TABLE "oauth_access_tokens"
|
314
|
+
[1m[36m (0.8ms)[0m [1mCREATE TABLE "oauth_access_tokens" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "resource_owner_id" integer, "application_id" integer, "token" varchar(255) NOT NULL, "refresh_token" varchar(255), "expires_in" integer, "revoked_at" datetime, "created_at" datetime NOT NULL, "scopes" varchar(255)) [0m
|
315
|
+
[1m[35m (0.8ms)[0m CREATE UNIQUE INDEX "index_oauth_access_tokens_on_refresh_token" ON "oauth_access_tokens" ("refresh_token")
|
316
|
+
[1m[36m (0.8ms)[0m [1mCREATE INDEX "index_oauth_access_tokens_on_resource_owner_id" ON "oauth_access_tokens" ("resource_owner_id")[0m
|
317
|
+
[1m[35m (0.8ms)[0m CREATE UNIQUE INDEX "index_oauth_access_tokens_on_token" ON "oauth_access_tokens" ("token")
|
318
|
+
[1m[36m (0.8ms)[0m [1mDROP TABLE "oauth_applications"[0m
|
319
|
+
[1m[35m (0.9ms)[0m CREATE TABLE "oauth_applications" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "name" varchar(255) NOT NULL, "uid" varchar(255) NOT NULL, "secret" varchar(255) NOT NULL, "redirect_uri" text NOT NULL, "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL)
|
320
|
+
[1m[36m (0.8ms)[0m [1mCREATE UNIQUE INDEX "index_oauth_applications_on_uid" ON "oauth_applications" ("uid")[0m
|
321
|
+
[1m[35m (0.1ms)[0m SELECT version FROM "schema_migrations"
|
322
|
+
Connecting to database specified by database.yml
|
323
|
+
[1m[36m (1.5ms)[0m [1mSELECT "schema_migrations"."version" FROM "schema_migrations" [0m
|
324
|
+
[1m[35m (0.2ms)[0m select sqlite_version(*)
|
325
|
+
[1m[36m (1.9ms)[0m [1mDROP TABLE "dummy_users"[0m
|
326
|
+
[1m[35m (1.1ms)[0m CREATE TABLE "dummy_users" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "username" varchar(255), "password_hash" varchar(255), "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL)
|
327
|
+
[1m[36m (0.9ms)[0m [1mDROP TABLE "oauth_access_grants"[0m
|
328
|
+
[1m[35m (0.9ms)[0m CREATE TABLE "oauth_access_grants" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "resource_owner_id" integer NOT NULL, "application_id" integer NOT NULL, "token" varchar(255) NOT NULL, "expires_in" integer NOT NULL, "redirect_uri" text NOT NULL, "created_at" datetime NOT NULL, "revoked_at" datetime, "scopes" varchar(255))
|
329
|
+
[1m[36m (0.8ms)[0m [1mCREATE UNIQUE INDEX "index_oauth_access_grants_on_token" ON "oauth_access_grants" ("token")[0m
|
330
|
+
[1m[35m (1.0ms)[0m DROP TABLE "oauth_access_tokens"
|
331
|
+
[1m[36m (0.8ms)[0m [1mCREATE TABLE "oauth_access_tokens" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "resource_owner_id" integer, "application_id" integer, "token" varchar(255) NOT NULL, "refresh_token" varchar(255), "expires_in" integer, "revoked_at" datetime, "created_at" datetime NOT NULL, "scopes" varchar(255)) [0m
|
332
|
+
[1m[35m (0.8ms)[0m CREATE UNIQUE INDEX "index_oauth_access_tokens_on_refresh_token" ON "oauth_access_tokens" ("refresh_token")
|
333
|
+
[1m[36m (0.8ms)[0m [1mCREATE INDEX "index_oauth_access_tokens_on_resource_owner_id" ON "oauth_access_tokens" ("resource_owner_id")[0m
|
334
|
+
[1m[35m (0.8ms)[0m CREATE UNIQUE INDEX "index_oauth_access_tokens_on_token" ON "oauth_access_tokens" ("token")
|
335
|
+
[1m[36m (0.8ms)[0m [1mDROP TABLE "oauth_applications"[0m
|
336
|
+
[1m[35m (0.8ms)[0m CREATE TABLE "oauth_applications" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "name" varchar(255) NOT NULL, "uid" varchar(255) NOT NULL, "secret" varchar(255) NOT NULL, "redirect_uri" text NOT NULL, "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL)
|
337
|
+
[1m[36m (0.8ms)[0m [1mCREATE UNIQUE INDEX "index_oauth_applications_on_uid" ON "oauth_applications" ("uid")[0m
|
338
|
+
[1m[35m (0.1ms)[0m SELECT version FROM "schema_migrations"
|
data/spec/dummy/log/test.log
CHANGED
@@ -315,3 +315,81 @@ Connecting to database specified by database.yml
|
|
315
315
|
[1m[36m (4.9ms)[0m [1mrollback transaction[0m
|
316
316
|
[1m[35m (0.1ms)[0m begin transaction
|
317
317
|
[1m[36m (0.1ms)[0m [1mrollback transaction[0m
|
318
|
+
Connecting to database specified by database.yml
|
319
|
+
Connecting to database specified by database.yml
|
320
|
+
Connecting to database specified by database.yml
|
321
|
+
Connecting to database specified by database.yml
|
322
|
+
Connecting to database specified by database.yml
|
323
|
+
Connecting to database specified by database.yml
|
324
|
+
Connecting to database specified by database.yml
|
325
|
+
[1m[36m (0.5ms)[0m [1mbegin transaction[0m
|
326
|
+
[1m[35m (0.1ms)[0m rollback transaction
|
327
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
328
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
329
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
330
|
+
[1m[35m (0.1ms)[0m rollback transaction
|
331
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
332
|
+
[1m[35m (0.1ms)[0m SAVEPOINT active_record_1
|
333
|
+
[1m[36mSQL (38.6ms)[0m [1mINSERT INTO "dummy_users" ("created_at", "password_hash", "updated_at", "username") VALUES (?, ?, ?, ?)[0m [["created_at", Tue, 15 Apr 2014 00:10:12 UTC +00:00], ["password_hash", nil], ["updated_at", Tue, 15 Apr 2014 00:10:12 UTC +00:00], ["username", nil]]
|
334
|
+
[1m[35m (0.1ms)[0m RELEASE SAVEPOINT active_record_1
|
335
|
+
[1m[36m (0.5ms)[0m [1mrollback transaction[0m
|
336
|
+
[1m[35m (0.1ms)[0m begin transaction
|
337
|
+
[1m[36m (0.1ms)[0m [1mSAVEPOINT active_record_1[0m
|
338
|
+
[1m[35mSQL (0.5ms)[0m INSERT INTO "dummy_users" ("created_at", "password_hash", "updated_at", "username") VALUES (?, ?, ?, ?) [["created_at", Tue, 15 Apr 2014 00:10:12 UTC +00:00], ["password_hash", nil], ["updated_at", Tue, 15 Apr 2014 00:10:12 UTC +00:00], ["username", nil]]
|
339
|
+
[1m[36m (0.1ms)[0m [1mRELEASE SAVEPOINT active_record_1[0m
|
340
|
+
[1m[35mDummyUser Load (0.2ms)[0m SELECT "dummy_users".* FROM "dummy_users" WHERE "dummy_users"."id" = ? LIMIT 1 [["id", 1]]
|
341
|
+
[1m[36m (0.3ms)[0m [1mrollback transaction[0m
|
342
|
+
[1m[35m (0.1ms)[0m begin transaction
|
343
|
+
[1m[36m (0.1ms)[0m [1mrollback transaction[0m
|
344
|
+
[1m[35m (0.1ms)[0m begin transaction
|
345
|
+
[1m[36m (0.1ms)[0m [1mrollback transaction[0m
|
346
|
+
[1m[35m (0.0ms)[0m begin transaction
|
347
|
+
[1m[36m (0.0ms)[0m [1mrollback transaction[0m
|
348
|
+
[1m[35m (0.0ms)[0m begin transaction
|
349
|
+
[1m[36m (0.0ms)[0m [1mrollback transaction[0m
|
350
|
+
[1m[35m (0.0ms)[0m begin transaction
|
351
|
+
[1m[36m (0.0ms)[0m [1mrollback transaction[0m
|
352
|
+
[1m[35m (0.0ms)[0m begin transaction
|
353
|
+
[1m[36m (0.0ms)[0m [1mrollback transaction[0m
|
354
|
+
[1m[35m (0.0ms)[0m begin transaction
|
355
|
+
[1m[36m (0.0ms)[0m [1mrollback transaction[0m
|
356
|
+
[1m[35m (0.0ms)[0m begin transaction
|
357
|
+
[1m[36m (0.0ms)[0m [1mrollback transaction[0m
|
358
|
+
[1m[35m (0.0ms)[0m begin transaction
|
359
|
+
[1m[36m (0.0ms)[0m [1mrollback transaction[0m
|
360
|
+
Connecting to database specified by database.yml
|
361
|
+
[1m[36m (0.5ms)[0m [1mbegin transaction[0m
|
362
|
+
[1m[35m (0.1ms)[0m rollback transaction
|
363
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
364
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
365
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
366
|
+
[1m[35m (0.1ms)[0m rollback transaction
|
367
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
368
|
+
[1m[35m (0.1ms)[0m rollback transaction
|
369
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
370
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
371
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
372
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
373
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
374
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
375
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
376
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
377
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
378
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
379
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
380
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
381
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
382
|
+
[1m[35m (0.0ms)[0m SAVEPOINT active_record_1
|
383
|
+
[1m[36mSQL (33.5ms)[0m [1mINSERT INTO "dummy_users" ("created_at", "password_hash", "updated_at", "username") VALUES (?, ?, ?, ?)[0m [["created_at", Tue, 15 Apr 2014 00:20:53 UTC +00:00], ["password_hash", nil], ["updated_at", Tue, 15 Apr 2014 00:20:53 UTC +00:00], ["username", nil]]
|
384
|
+
[1m[35m (0.1ms)[0m RELEASE SAVEPOINT active_record_1
|
385
|
+
[1m[36mDummyUser Load (0.1ms)[0m [1mSELECT "dummy_users".* FROM "dummy_users" WHERE "dummy_users"."id" = ? LIMIT 1[0m [["id", 1]]
|
386
|
+
[1m[35m (1.1ms)[0m rollback transaction
|
387
|
+
[1m[36m (0.7ms)[0m [1mbegin transaction[0m
|
388
|
+
[1m[35m (0.1ms)[0m SAVEPOINT active_record_1
|
389
|
+
[1m[36mSQL (0.5ms)[0m [1mINSERT INTO "dummy_users" ("created_at", "password_hash", "updated_at", "username") VALUES (?, ?, ?, ?)[0m [["created_at", Tue, 15 Apr 2014 00:20:53 UTC +00:00], ["password_hash", nil], ["updated_at", Tue, 15 Apr 2014 00:20:53 UTC +00:00], ["username", nil]]
|
390
|
+
[1m[35m (0.1ms)[0m RELEASE SAVEPOINT active_record_1
|
391
|
+
[1m[36m (0.3ms)[0m [1mrollback transaction[0m
|
392
|
+
[1m[35m (0.1ms)[0m begin transaction
|
393
|
+
[1m[36m (0.1ms)[0m [1mrollback transaction[0m
|
394
|
+
[1m[35m (0.1ms)[0m begin transaction
|
395
|
+
[1m[36m (0.0ms)[0m [1mrollback transaction[0m
|
File without changes
|
data/spec/{app/representers → representers}/openstax/api/v1/representable_schema_printer_spec.rb
RENAMED
File without changes
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: openstax_api
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 1.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dante Soares
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2014-04-
|
12
|
+
date: 2014-04-15 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rails
|
@@ -136,7 +136,6 @@ files:
|
|
136
136
|
- README.md
|
137
137
|
- Rakefile
|
138
138
|
- app/controllers/openstax/api/v1/api_controller.rb
|
139
|
-
- app/controllers/openstax/api/v1/oauth_based_api_controller.rb
|
140
139
|
- app/models/openstax/api/api_user.rb
|
141
140
|
- lib/openstax/api/apipie.rb
|
142
141
|
- lib/openstax/api/constraints.rb
|
@@ -147,10 +146,7 @@ files:
|
|
147
146
|
- lib/openstax/api/route_extensions.rb
|
148
147
|
- lib/openstax/api/version.rb
|
149
148
|
- lib/openstax_api.rb
|
150
|
-
- spec/
|
151
|
-
- spec/app/controllers/openstax/api/v1/oauth_based_api_controller_spec.rb
|
152
|
-
- spec/app/models/openstax/api/api_user_spec.rb
|
153
|
-
- spec/app/representers/openstax/api/v1/representable_schema_printer_spec.rb
|
149
|
+
- spec/controllers/openstax/api/v1/api_controller_spec.rb
|
154
150
|
- spec/dummy/README.md
|
155
151
|
- spec/dummy/Rakefile
|
156
152
|
- spec/dummy/app/assets/javascripts/application.js
|
@@ -194,6 +190,8 @@ files:
|
|
194
190
|
- spec/lib/openstax/api/doorkeeper_extensions_spec.rb
|
195
191
|
- spec/lib/openstax/api/roar.rb
|
196
192
|
- spec/lib/openstax/api/route_extensions_spec.rb
|
193
|
+
- spec/models/openstax/api/api_user_spec.rb
|
194
|
+
- spec/representers/openstax/api/v1/representable_schema_printer_spec.rb
|
197
195
|
- spec/spec_helper.rb
|
198
196
|
homepage: https://github.com/openstax/openstax_api
|
199
197
|
licenses:
|
@@ -220,10 +218,7 @@ signing_key:
|
|
220
218
|
specification_version: 4
|
221
219
|
summary: API utilities for OpenStax products and tools.
|
222
220
|
test_files:
|
223
|
-
- spec/
|
224
|
-
- spec/app/controllers/openstax/api/v1/oauth_based_api_controller_spec.rb
|
225
|
-
- spec/app/models/openstax/api/api_user_spec.rb
|
226
|
-
- spec/app/representers/openstax/api/v1/representable_schema_printer_spec.rb
|
221
|
+
- spec/controllers/openstax/api/v1/api_controller_spec.rb
|
227
222
|
- spec/dummy/app/assets/javascripts/application.js
|
228
223
|
- spec/dummy/app/assets/stylesheets/application.css
|
229
224
|
- spec/dummy/app/controllers/application_controller.rb
|
@@ -267,4 +262,6 @@ test_files:
|
|
267
262
|
- spec/lib/openstax/api/doorkeeper_extensions_spec.rb
|
268
263
|
- spec/lib/openstax/api/roar.rb
|
269
264
|
- spec/lib/openstax/api/route_extensions_spec.rb
|
265
|
+
- spec/models/openstax/api/api_user_spec.rb
|
266
|
+
- spec/representers/openstax/api/v1/representable_schema_printer_spec.rb
|
270
267
|
- spec/spec_helper.rb
|