openstax_api 2.3.1 → 2.4.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a5629468c30de716b91b391649758a2b175ea729
4
- data.tar.gz: e54286b3183689bae4f7369b8bce896f3d6cf869
3
+ metadata.gz: 9b54c98562d6256845ee88aace52efde4b5c6e43
4
+ data.tar.gz: df03792d31e741ee88caaed9f7e2165a2debe7c4
5
5
  SHA512:
6
- metadata.gz: 7e2cf10423d2d147b72eea5ebbdae967fcb46273da34656e98f18fbcb6641729ceca952b85aa421c8b95edfb5cf32e7d52ca392b382bd0fda600338c1e308e1e
7
- data.tar.gz: 42f3deafb56ee2a911c3c0a011f782a5ea1f47707bc890a153b424d0f98594b824e08efc997004f1a5a9e2baba041088e009dc0f5d320bba3aec019c67c3c248
6
+ metadata.gz: 85871dbc9dd7de450049c4639e6dc31fc2e8c6bcfff3dc7af1ec4bb0d43031fde25b0ec00cdcae3e9303e9bb14aaaab8730000f799d17f03f96c96cad16d4a91
7
+ data.tar.gz: 2b8cc6ecd5a772b5e9650a61bf646384ef35b749c48678edbc58205076388b08a1bcf7381f61c7a344386217ccc8a1bc57cbe60c19583f240aa25aadcf65d880
data/README.md CHANGED
@@ -24,19 +24,22 @@ $ bundle
24
24
 
25
25
  This gem includes the following classes, all under the OpenStax::Api namespace:
26
26
 
27
- ### Controllers
27
+ ### Controller
28
28
 
29
- `ApiController`
29
+ `OpenStax::Api::V1::ApiController`
30
30
 
31
- `OauthBasedApiController`
31
+ Your API controllers should inherit from ApiController.
32
32
 
33
- Your API controllers should inherit from those classes.
33
+ Your `current_user` method will not be available in ApiController.
34
+ Instead, use the current_api_user, current_human_user and current_application methods.
34
35
 
35
- ### Models
36
+ ### Model
36
37
 
37
- `ApiUser`
38
+ `OpenStax::Api::V1::ApiUser`
38
39
 
39
- This is the class of someone using the API, which can either be a (signed in) user, a doorkeeper application, or a combination of both.
40
+ Your users should NOT inherit from ApiUser. It is used only by ApiController.
41
+
42
+ ApiUser represents either a signed in user, a doorkeeper application, or a combination of both.
40
43
 
41
44
  ## Doorkeeper Extensions
42
45
 
@@ -8,15 +8,9 @@ module OpenStax
8
8
  include OpenStax::Api::Roar
9
9
  include OpenStax::Api::Apipie
10
10
 
11
- skip_protect_beta if respond_to? :skip_protect_beta
12
-
13
- skip_before_filter :authenticate_user!
14
11
  doorkeeper_for :all, :unless => :session_user?
15
12
  skip_before_filter :verify_authenticity_token, :unless => :session_user?
16
13
 
17
- # This filter can wait until the user signs in again
18
- skip_interception :expired_password if respond_to? :skip_interception
19
-
20
14
  respond_to :json
21
15
 
22
16
  # Keep old current_user method so we can use it
@@ -40,12 +34,6 @@ module OpenStax
40
34
  current_api_user.human_user
41
35
  end
42
36
 
43
- # JSON can't really redirect
44
- # Redirect from a filter effectively means "deny access"
45
- def redirect_to(options = {}, response_status = {})
46
- head :forbidden
47
- end
48
-
49
37
  protected
50
38
 
51
39
  def session_user?
@@ -1,5 +1,5 @@
1
1
  module OpenStax
2
2
  module Api
3
- VERSION = "2.3.1"
3
+ VERSION = "2.4.0"
4
4
  end
5
5
  end
@@ -4075,3 +4075,228 @@ Connecting to database specified by database.yml
4075
4075
   (0.0ms) rollback transaction
4076
4076
   (0.0ms) begin transaction
4077
4077
   (0.0ms) rollback transaction
4078
+  (1.8ms) 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) 
4079
+  (1.0ms) 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))
4080
+  (0.1ms) select sqlite_version(*)
4081
+  (1.0ms) CREATE UNIQUE INDEX "index_oauth_access_grants_on_token" ON "oauth_access_grants" ("token")
4082
+  (0.8ms) CREATE 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)) 
4083
+  (0.8ms) CREATE UNIQUE INDEX "index_oauth_access_tokens_on_refresh_token" ON "oauth_access_tokens" ("refresh_token")
4084
+  (0.1ms)  SELECT sql
4085
+ FROM sqlite_master
4086
+ WHERE name='index_oauth_access_tokens_on_refresh_token' AND type='index'
4087
+ UNION ALL
4088
+ SELECT sql
4089
+ FROM sqlite_temp_master
4090
+ WHERE name='index_oauth_access_tokens_on_refresh_token' AND type='index'
4091
+ 
4092
+  (0.8ms) CREATE INDEX "index_oauth_access_tokens_on_resource_owner_id" ON "oauth_access_tokens" ("resource_owner_id")
4093
+  (0.1ms)  SELECT sql
4094
+ FROM sqlite_master
4095
+ WHERE name='index_oauth_access_tokens_on_resource_owner_id' AND type='index'
4096
+ UNION ALL
4097
+ SELECT sql
4098
+ FROM sqlite_temp_master
4099
+ WHERE name='index_oauth_access_tokens_on_resource_owner_id' AND type='index'
4100
+ 
4101
+  (0.1ms) SELECT sql
4102
+ FROM sqlite_master
4103
+ WHERE name='index_oauth_access_tokens_on_refresh_token' AND type='index'
4104
+ UNION ALL
4105
+ SELECT sql
4106
+ FROM sqlite_temp_master
4107
+ WHERE name='index_oauth_access_tokens_on_refresh_token' AND type='index'
4108
+
4109
+  (0.8ms) CREATE UNIQUE INDEX "index_oauth_access_tokens_on_token" ON "oauth_access_tokens" ("token")
4110
+  (0.9ms) 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)
4111
+  (0.8ms) CREATE UNIQUE INDEX "index_oauth_applications_on_uid" ON "oauth_applications" ("uid")
4112
+  (0.8ms) CREATE TABLE "schema_migrations" ("version" varchar(255) NOT NULL)
4113
+  (0.8ms) CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
4114
+  (0.1ms) SELECT version FROM "schema_migrations"
4115
+  (0.8ms) INSERT INTO "schema_migrations" (version) VALUES ('1')
4116
+  (0.7ms) INSERT INTO "schema_migrations" (version) VALUES ('0')
4117
+  (0.4ms) begin transaction
4118
+  (0.1ms) rollback transaction
4119
+  (0.0ms) begin transaction
4120
+  (0.0ms) rollback transaction
4121
+  (0.0ms) begin transaction
4122
+  (0.0ms) rollback transaction
4123
+  (0.0ms) begin transaction
4124
+  (0.0ms) rollback transaction
4125
+  (0.0ms) begin transaction
4126
+  (0.0ms) rollback transaction
4127
+  (0.0ms) begin transaction
4128
+  (0.0ms) rollback transaction
4129
+  (0.0ms) begin transaction
4130
+  (0.0ms) rollback transaction
4131
+  (0.0ms) begin transaction
4132
+  (0.0ms) rollback transaction
4133
+  (0.0ms) begin transaction
4134
+  (0.0ms) rollback transaction
4135
+  (0.0ms) begin transaction
4136
+  (0.0ms) SAVEPOINT active_record_1
4137
+ SQL (0.3ms) INSERT INTO "dummy_users" ("created_at", "updated_at") VALUES (?, ?) [["created_at", "2014-09-26 19:51:34.303942"], ["updated_at", "2014-09-26 19:51:34.303942"]]
4138
+  (0.0ms) RELEASE SAVEPOINT active_record_1
4139
+  (0.9ms) rollback transaction
4140
+  (0.1ms) begin transaction
4141
+ DummyUser Load (0.1ms) SELECT "dummy_users".* FROM "dummy_users" WHERE "dummy_users"."id" IS NULL ORDER BY "dummy_users"."id" ASC LIMIT 1
4142
+  (0.0ms) rollback transaction
4143
+  (0.0ms) begin transaction
4144
+  (0.0ms) SAVEPOINT active_record_1
4145
+ SQL (0.2ms) INSERT INTO "dummy_users" ("created_at", "updated_at") VALUES (?, ?) [["created_at", "2014-09-26 19:51:34.312967"], ["updated_at", "2014-09-26 19:51:34.312967"]]
4146
+  (0.0ms) RELEASE SAVEPOINT active_record_1
4147
+ DummyUser Load (0.1ms) SELECT "dummy_users".* FROM "dummy_users" WHERE "dummy_users"."id" = 1 ORDER BY "dummy_users"."id" ASC LIMIT 1
4148
+  (0.3ms) rollback transaction
4149
+  (0.0ms) begin transaction
4150
+  (0.1ms) rollback transaction
4151
+  (0.0ms) begin transaction
4152
+  (0.0ms) rollback transaction
4153
+  (1.8ms) 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) 
4154
+  (0.8ms) 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))
4155
+  (0.1ms) select sqlite_version(*)
4156
+  (1.6ms) CREATE UNIQUE INDEX "index_oauth_access_grants_on_token" ON "oauth_access_grants" ("token")
4157
+  (0.7ms) CREATE 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)) 
4158
+  (0.7ms) CREATE UNIQUE INDEX "index_oauth_access_tokens_on_refresh_token" ON "oauth_access_tokens" ("refresh_token")
4159
+  (0.1ms)  SELECT sql
4160
+ FROM sqlite_master
4161
+ WHERE name='index_oauth_access_tokens_on_refresh_token' AND type='index'
4162
+ UNION ALL
4163
+ SELECT sql
4164
+ FROM sqlite_temp_master
4165
+ WHERE name='index_oauth_access_tokens_on_refresh_token' AND type='index'
4166
+ 
4167
+  (0.7ms) CREATE INDEX "index_oauth_access_tokens_on_resource_owner_id" ON "oauth_access_tokens" ("resource_owner_id")
4168
+  (0.1ms)  SELECT sql
4169
+ FROM sqlite_master
4170
+ WHERE name='index_oauth_access_tokens_on_resource_owner_id' AND type='index'
4171
+ UNION ALL
4172
+ SELECT sql
4173
+ FROM sqlite_temp_master
4174
+ WHERE name='index_oauth_access_tokens_on_resource_owner_id' AND type='index'
4175
+ 
4176
+  (0.1ms) SELECT sql
4177
+ FROM sqlite_master
4178
+ WHERE name='index_oauth_access_tokens_on_refresh_token' AND type='index'
4179
+ UNION ALL
4180
+ SELECT sql
4181
+ FROM sqlite_temp_master
4182
+ WHERE name='index_oauth_access_tokens_on_refresh_token' AND type='index'
4183
+
4184
+  (0.8ms) CREATE UNIQUE INDEX "index_oauth_access_tokens_on_token" ON "oauth_access_tokens" ("token")
4185
+  (0.9ms) 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)
4186
+  (0.8ms) CREATE UNIQUE INDEX "index_oauth_applications_on_uid" ON "oauth_applications" ("uid")
4187
+  (0.8ms) CREATE TABLE "schema_migrations" ("version" varchar(255) NOT NULL)
4188
+  (0.8ms) CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
4189
+  (0.1ms) SELECT version FROM "schema_migrations"
4190
+  (0.7ms) INSERT INTO "schema_migrations" (version) VALUES ('1')
4191
+  (1.3ms) INSERT INTO "schema_migrations" (version) VALUES ('0')
4192
+  (0.4ms) begin transaction
4193
+  (0.1ms) rollback transaction
4194
+  (0.0ms) begin transaction
4195
+  (0.0ms) rollback transaction
4196
+  (0.0ms) begin transaction
4197
+  (0.0ms) rollback transaction
4198
+  (0.0ms) begin transaction
4199
+  (0.0ms) rollback transaction
4200
+  (0.0ms) begin transaction
4201
+  (0.0ms) rollback transaction
4202
+  (0.0ms) begin transaction
4203
+  (0.0ms) rollback transaction
4204
+  (0.0ms) begin transaction
4205
+  (0.0ms) rollback transaction
4206
+  (0.0ms) begin transaction
4207
+  (0.0ms) rollback transaction
4208
+  (0.0ms) begin transaction
4209
+  (0.0ms) rollback transaction
4210
+  (0.0ms) begin transaction
4211
+  (0.0ms) rollback transaction
4212
+  (0.0ms) begin transaction
4213
+  (0.0ms) rollback transaction
4214
+  (0.0ms) begin transaction
4215
+ DummyUser Load (0.1ms) SELECT "dummy_users".* FROM "dummy_users" WHERE "dummy_users"."id" IS NULL ORDER BY "dummy_users"."id" ASC LIMIT 1
4216
+  (0.0ms) rollback transaction
4217
+  (0.0ms) begin transaction
4218
+  (0.0ms) SAVEPOINT active_record_1
4219
+ SQL (0.3ms) INSERT INTO "dummy_users" ("created_at", "updated_at") VALUES (?, ?) [["created_at", "2014-09-26 23:18:58.756166"], ["updated_at", "2014-09-26 23:18:58.756166"]]
4220
+  (0.0ms) RELEASE SAVEPOINT active_record_1
4221
+ DummyUser Load (0.1ms) SELECT "dummy_users".* FROM "dummy_users" WHERE "dummy_users"."id" = 1 ORDER BY "dummy_users"."id" ASC LIMIT 1
4222
+  (0.9ms) rollback transaction
4223
+  (0.1ms) begin transaction
4224
+  (0.0ms) SAVEPOINT active_record_1
4225
+ SQL (0.2ms) INSERT INTO "dummy_users" ("created_at", "updated_at") VALUES (?, ?) [["created_at", "2014-09-26 23:18:58.762926"], ["updated_at", "2014-09-26 23:18:58.762926"]]
4226
+  (0.0ms) RELEASE SAVEPOINT active_record_1
4227
+  (0.4ms) rollback transaction
4228
+  (1.6ms) 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) 
4229
+  (0.8ms) 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))
4230
+  (0.1ms) select sqlite_version(*)
4231
+  (0.8ms) CREATE UNIQUE INDEX "index_oauth_access_grants_on_token" ON "oauth_access_grants" ("token")
4232
+  (0.9ms) CREATE 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)) 
4233
+  (0.8ms) CREATE UNIQUE INDEX "index_oauth_access_tokens_on_refresh_token" ON "oauth_access_tokens" ("refresh_token")
4234
+  (0.1ms)  SELECT sql
4235
+ FROM sqlite_master
4236
+ WHERE name='index_oauth_access_tokens_on_refresh_token' AND type='index'
4237
+ UNION ALL
4238
+ SELECT sql
4239
+ FROM sqlite_temp_master
4240
+ WHERE name='index_oauth_access_tokens_on_refresh_token' AND type='index'
4241
+ 
4242
+  (0.8ms) CREATE INDEX "index_oauth_access_tokens_on_resource_owner_id" ON "oauth_access_tokens" ("resource_owner_id")
4243
+  (0.1ms)  SELECT sql
4244
+ FROM sqlite_master
4245
+ WHERE name='index_oauth_access_tokens_on_resource_owner_id' AND type='index'
4246
+ UNION ALL
4247
+ SELECT sql
4248
+ FROM sqlite_temp_master
4249
+ WHERE name='index_oauth_access_tokens_on_resource_owner_id' AND type='index'
4250
+ 
4251
+  (0.1ms) SELECT sql
4252
+ FROM sqlite_master
4253
+ WHERE name='index_oauth_access_tokens_on_refresh_token' AND type='index'
4254
+ UNION ALL
4255
+ SELECT sql
4256
+ FROM sqlite_temp_master
4257
+ WHERE name='index_oauth_access_tokens_on_refresh_token' AND type='index'
4258
+
4259
+  (0.8ms) CREATE UNIQUE INDEX "index_oauth_access_tokens_on_token" ON "oauth_access_tokens" ("token")
4260
+  (1.0ms) 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)
4261
+  (0.8ms) CREATE UNIQUE INDEX "index_oauth_applications_on_uid" ON "oauth_applications" ("uid")
4262
+  (0.8ms) CREATE TABLE "schema_migrations" ("version" varchar(255) NOT NULL)
4263
+  (0.7ms) CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
4264
+  (0.1ms) SELECT version FROM "schema_migrations"
4265
+  (0.7ms) INSERT INTO "schema_migrations" (version) VALUES ('1')
4266
+  (0.7ms) INSERT INTO "schema_migrations" (version) VALUES ('0')
4267
+  (0.4ms) begin transaction
4268
+ DummyUser Load (0.1ms) SELECT "dummy_users".* FROM "dummy_users" WHERE "dummy_users"."id" IS NULL ORDER BY "dummy_users"."id" ASC LIMIT 1
4269
+  (0.0ms) rollback transaction
4270
+  (0.0ms) begin transaction
4271
+  (0.0ms) SAVEPOINT active_record_1
4272
+ SQL (0.3ms) INSERT INTO "dummy_users" ("created_at", "updated_at") VALUES (?, ?) [["created_at", "2014-09-26 23:38:10.372836"], ["updated_at", "2014-09-26 23:38:10.372836"]]
4273
+  (0.0ms) RELEASE SAVEPOINT active_record_1
4274
+ DummyUser Load (0.1ms) SELECT "dummy_users".* FROM "dummy_users" WHERE "dummy_users"."id" = 1 ORDER BY "dummy_users"."id" ASC LIMIT 1
4275
+  (1.0ms) rollback transaction
4276
+  (0.1ms) begin transaction
4277
+  (0.0ms) SAVEPOINT active_record_1
4278
+ SQL (0.2ms) INSERT INTO "dummy_users" ("created_at", "updated_at") VALUES (?, ?) [["created_at", "2014-09-26 23:38:10.383475"], ["updated_at", "2014-09-26 23:38:10.383475"]]
4279
+  (0.0ms) RELEASE SAVEPOINT active_record_1
4280
+  (0.3ms) rollback transaction
4281
+  (0.0ms) begin transaction
4282
+  (0.0ms) rollback transaction
4283
+  (0.0ms) begin transaction
4284
+  (0.0ms) rollback transaction
4285
+  (0.0ms) begin transaction
4286
+  (0.0ms) rollback transaction
4287
+  (0.0ms) begin transaction
4288
+  (0.0ms) rollback transaction
4289
+  (0.0ms) begin transaction
4290
+  (0.0ms) rollback transaction
4291
+  (0.0ms) begin transaction
4292
+  (0.0ms) rollback transaction
4293
+  (0.0ms) begin transaction
4294
+  (0.0ms) rollback transaction
4295
+  (0.0ms) begin transaction
4296
+  (0.0ms) rollback transaction
4297
+  (0.0ms) begin transaction
4298
+  (0.0ms) rollback transaction
4299
+  (0.0ms) begin transaction
4300
+  (0.0ms) rollback transaction
4301
+  (0.0ms) begin transaction
4302
+  (0.0ms) rollback transaction
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: 2.3.1
4
+ version: 2.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dante Soares