openstax_api 2.2.1 → 2.2.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/openstax/api/representable_schema_printer.rb +19 -16
- data/lib/openstax/api/version.rb +1 -1
- data/spec/dummy/db/test.sqlite3 +0 -0
- data/spec/dummy/log/development.log +17 -0
- data/spec/dummy/log/test.log +37 -0
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0d1548c720a9fd4fdf2e54f8b005019e81504d99
|
4
|
+
data.tar.gz: 9bf3a7b1602fd86666e7db95df285cf55048b3c5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0b1d6867b462d6a264ea79a4c92db1e5a1bc250122fc2ab4c5b11497f52b96246caadb04ccc114022dafe05f93bddc3e7c0758014290ae44855bb07dc023b84a
|
7
|
+
data.tar.gz: 4acd371f45b872aa4a04cfd8ca44a0454052c8688f1db3fc4cbddab3a13ca475087dc9a29a7d0fbc14431cdc4ae48300812c9475a2e3678eb23b6bdb6ae79938
|
@@ -23,7 +23,9 @@ module OpenStax
|
|
23
23
|
protected
|
24
24
|
|
25
25
|
def self.representer_name(representer)
|
26
|
-
representer.name
|
26
|
+
name = representer.name
|
27
|
+
return nil if name.nil?
|
28
|
+
name.chomp('Representer').demodulize.camelize(:lower)
|
27
29
|
end
|
28
30
|
|
29
31
|
def self.definition_name(name)
|
@@ -65,26 +67,27 @@ module OpenStax
|
|
65
67
|
# Overwrite type for collections
|
66
68
|
attr_info[:type] = 'array' if attr[:collection]
|
67
69
|
|
68
|
-
if attr[:
|
69
|
-
#
|
70
|
-
decorator = attr[:extend].evaluate(self)
|
71
|
-
attr_info.merge!(json_object(decorator, definitions, options))
|
72
|
-
elsif attr[:extend]
|
73
|
-
# Explicit representer - use reference
|
70
|
+
if attr[:extend]
|
71
|
+
# Nested representer
|
74
72
|
decorator = attr[:extend].evaluate(self)
|
75
73
|
rname = representer_name(decorator)
|
76
|
-
dname = definition_name(rname)
|
77
74
|
|
78
|
-
if
|
79
|
-
|
75
|
+
if rname
|
76
|
+
dname = definition_name(rname)
|
77
|
+
|
78
|
+
if attr[:collection]
|
79
|
+
attr_info[:items] = { :$ref => dname }
|
80
|
+
else
|
81
|
+
# Type is included in ref
|
82
|
+
attr_info.delete(:type)
|
83
|
+
attr_info[:$ref] = dname
|
84
|
+
end
|
85
|
+
|
86
|
+
definitions[rname] ||= json_object(decorator,
|
87
|
+
definitions, options)
|
80
88
|
else
|
81
|
-
|
82
|
-
attr_info.delete(:type)
|
83
|
-
attr_info[:$ref] = dname
|
89
|
+
attr_info.merge!(json_object(decorator, definitions, options))
|
84
90
|
end
|
85
|
-
|
86
|
-
definitions[rname] ||= json_object(decorator,
|
87
|
-
definitions, options)
|
88
91
|
end
|
89
92
|
|
90
93
|
schema[:properties][name.to_sym] = attr_info
|
data/lib/openstax/api/version.rb
CHANGED
data/spec/dummy/db/test.sqlite3
CHANGED
Binary file
|
@@ -1420,3 +1420,20 @@ Connecting to database specified by database.yml
|
|
1420
1420
|
[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)
|
1421
1421
|
[1m[36m (0.8ms)[0m [1mCREATE UNIQUE INDEX "index_oauth_applications_on_uid" ON "oauth_applications" ("uid")[0m
|
1422
1422
|
[1m[35m (0.1ms)[0m SELECT version FROM "schema_migrations"
|
1423
|
+
Connecting to database specified by database.yml
|
1424
|
+
[1m[36m (0.1ms)[0m [1mSELECT "schema_migrations"."version" FROM "schema_migrations" [0m
|
1425
|
+
[1m[35m (0.3ms)[0m select sqlite_version(*)
|
1426
|
+
[1m[36m (1.2ms)[0m [1mDROP TABLE "dummy_users"[0m
|
1427
|
+
[1m[35m (0.7ms)[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)
|
1428
|
+
[1m[36m (0.6ms)[0m [1mDROP TABLE "oauth_access_grants"[0m
|
1429
|
+
[1m[35m (0.6ms)[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))
|
1430
|
+
[1m[36m (0.7ms)[0m [1mCREATE UNIQUE INDEX "index_oauth_access_grants_on_token" ON "oauth_access_grants" ("token")[0m
|
1431
|
+
[1m[35m (0.7ms)[0m DROP TABLE "oauth_access_tokens"
|
1432
|
+
[1m[36m (0.7ms)[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
|
1433
|
+
[1m[35m (0.6ms)[0m CREATE UNIQUE INDEX "index_oauth_access_tokens_on_refresh_token" ON "oauth_access_tokens" ("refresh_token")
|
1434
|
+
[1m[36m (0.6ms)[0m [1mCREATE INDEX "index_oauth_access_tokens_on_resource_owner_id" ON "oauth_access_tokens" ("resource_owner_id")[0m
|
1435
|
+
[1m[35m (0.7ms)[0m CREATE UNIQUE INDEX "index_oauth_access_tokens_on_token" ON "oauth_access_tokens" ("token")
|
1436
|
+
[1m[36m (0.6ms)[0m [1mDROP TABLE "oauth_applications"[0m
|
1437
|
+
[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)
|
1438
|
+
[1m[36m (0.6ms)[0m [1mCREATE UNIQUE INDEX "index_oauth_applications_on_uid" ON "oauth_applications" ("uid")[0m
|
1439
|
+
[1m[35m (0.1ms)[0m SELECT version FROM "schema_migrations"
|
data/spec/dummy/log/test.log
CHANGED
@@ -2201,3 +2201,40 @@ Connecting to database specified by database.yml
|
|
2201
2201
|
[1m[35m (0.0ms)[0m rollback transaction
|
2202
2202
|
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
2203
2203
|
[1m[35m (0.0ms)[0m rollback transaction
|
2204
|
+
Connecting to database specified by database.yml
|
2205
|
+
[1m[36m (0.4ms)[0m [1mbegin transaction[0m
|
2206
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
2207
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
2208
|
+
[1m[35mDummyUser Load (0.1ms)[0m SELECT "dummy_users".* FROM "dummy_users" WHERE "dummy_users"."id" IS NULL LIMIT 1
|
2209
|
+
[1m[36m (0.0ms)[0m [1mrollback transaction[0m
|
2210
|
+
[1m[35m (0.0ms)[0m begin transaction
|
2211
|
+
[1m[36m (0.0ms)[0m [1mSAVEPOINT active_record_1[0m
|
2212
|
+
[1m[35mSQL (2.3ms)[0m INSERT INTO "dummy_users" ("created_at", "password_hash", "updated_at", "username") VALUES (?, ?, ?, ?) [["created_at", Wed, 02 Jul 2014 22:42:02 UTC +00:00], ["password_hash", nil], ["updated_at", Wed, 02 Jul 2014 22:42:02 UTC +00:00], ["username", nil]]
|
2213
|
+
[1m[36m (0.0ms)[0m [1mRELEASE SAVEPOINT active_record_1[0m
|
2214
|
+
[1m[35mDummyUser Load (0.1ms)[0m SELECT "dummy_users".* FROM "dummy_users" WHERE "dummy_users"."id" = 1 LIMIT 1
|
2215
|
+
[1m[36m (0.8ms)[0m [1mrollback transaction[0m
|
2216
|
+
[1m[35m (0.0ms)[0m begin transaction
|
2217
|
+
[1m[36m (0.0ms)[0m [1mSAVEPOINT active_record_1[0m
|
2218
|
+
[1m[35mSQL (0.2ms)[0m INSERT INTO "dummy_users" ("created_at", "password_hash", "updated_at", "username") VALUES (?, ?, ?, ?) [["created_at", Wed, 02 Jul 2014 22:42:02 UTC +00:00], ["password_hash", nil], ["updated_at", Wed, 02 Jul 2014 22:42:02 UTC +00:00], ["username", nil]]
|
2219
|
+
[1m[36m (0.0ms)[0m [1mRELEASE SAVEPOINT active_record_1[0m
|
2220
|
+
[1m[35m (0.3ms)[0m rollback transaction
|
2221
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
2222
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
2223
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
2224
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
2225
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
2226
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
2227
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
2228
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
2229
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
2230
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
2231
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
2232
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
2233
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
2234
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
2235
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
2236
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
2237
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
2238
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
2239
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
2240
|
+
[1m[35m (0.0ms)[0m rollback transaction
|