openstax_api 0.0.1 → 0.1.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: e65fff56b84dbf775bc833cac2d8c0d47ac17071
4
- data.tar.gz: 50a0a75083a94728f96ae03850976d69591cfa3c
3
+ metadata.gz: cce40c843b8d217abd9a7474b34217a10f380468
4
+ data.tar.gz: ae159bd0eda6a2191a5dfb3d8ac6b14f504b1df3
5
5
  SHA512:
6
- metadata.gz: 1ee105cdac7c958f73f350386dffad9440b7de73a860f607a5c7df4ef06aec8cfb113a974db0c5e894cc09a2e687f3c66dac4881e25c684b008dc1bd679bee67
7
- data.tar.gz: d4e10fbe22973ad8d80143ccbf7e6013064ca6ec9f6792d2612043994fa1521f028c61e38e54db80269d7df9f730efaa4c019979678a4e904539ecd0b1ddab9b
6
+ metadata.gz: 7416764ded4187e6dde991c812339d9c370a426ef7ca928807edbb9be0d86aa591d12b01660868066527c2dfb2df84322bdb2da1acbecddc6dade5e218cf4860
7
+ data.tar.gz: b714b80dbd734dd882eeb2a28442835f66372d9f5b32e920258e7291b90e536154c9e883de04b72b1a913991d6082763479e4a87dfabc3950527894e03d6b72f
data/README.md CHANGED
@@ -59,7 +59,7 @@ If the boolean is true, that version is the default (latest) and will always mat
59
59
 
60
60
  ## Testing
61
61
 
62
- From the gem's main folder, run `bundle`, and then `rake` to run all the specs.
62
+ From the gem's main folder, run `bundle`, `rake db:migrate` and then `rake` to run all the specs.
63
63
 
64
64
  ## Contributing
65
65
 
@@ -30,9 +30,21 @@ module OpenStax
30
30
  "#{url_base}/#{options[:url_end] || ''}"
31
31
  end
32
32
 
33
- def self.json_schema(representer, options={})
34
- RepresentableSchemaPrinter.json(representer, options)
33
+ # TODO doorkeeper users (or rather users who have doorkeeper
34
+ # applications) need to agree to API terms of use (need to have agreed
35
+ # to it at one time, can't require them to agree when terms change since
36
+ # their apps are doing the talking) -- this needs more thought
37
+
38
+ def current_user
39
+ @current_user ||= doorkeeper_token ?
40
+ User.find(doorkeeper_token.resource_owner_id) :
41
+ super
42
+ # TODO maybe freak out if current user is anonymous (require we know
43
+ # who person/app is so we can do things like throttling, API terms
44
+ # agreement, etc)
35
45
  end
46
+
47
+
36
48
 
37
49
  protected
38
50
 
@@ -54,7 +66,7 @@ module OpenStax
54
66
  end
55
67
 
56
68
  if notify
57
- # Not yet in OSU
69
+ # TODO: Not yet in OSU
58
70
  =begin
59
71
  ExceptionNotifier.notify_exception(
60
72
  exception,
@@ -67,6 +79,134 @@ module OpenStax
67
79
 
68
80
  head error
69
81
  end
82
+
83
+ def self.json_schema(representer, options={})
84
+ RepresentableSchemaPrinter.json(representer, options)
85
+ end
86
+
87
+ # A hack at a conversion from a Representer to a series of Apipie declarations
88
+ # Can call it like any Apipie DSL method,
89
+ #
90
+ # example "blah"
91
+ # representer Api::V1::ExerciseRepresenter
92
+ # def update ...
93
+ #
94
+ def self.representer(representer)
95
+ representer.representable_attrs.each do |attr|
96
+ schema_info = attr.options[:schema_info] || {}
97
+ param attr.name, (attr.options[:type] || Object), required: schema_info[:required]
98
+ end
99
+ end
100
+
101
+ def get_representer(represent_with, model=nil)
102
+ return nil if represent_with.nil?
103
+ if represent_with.is_a? Proc
104
+ represent_with.call(model)
105
+ else
106
+ represent_with
107
+ end
108
+ end
109
+
110
+ def rest_get(model_klass, id, represent_with=nil)
111
+ @model = model_klass.find(id)
112
+ raise SecurityTransgression unless current_user.can_read?(@model)
113
+ respond_with @model, represent_with: get_representer(represent_with, @model)
114
+ end
115
+
116
+ def rest_update(model_klass, id, represent_with=nil)
117
+ @model = model_klass.find(id)
118
+ raise SecurityTransgression unless current_user.can_update?(@model)
119
+ consume!(@model, represent_with: get_representer(represent_with, @model))
120
+
121
+ if @model.save
122
+ head :no_content
123
+ else
124
+ render json: @model.errors, status: :unprocessable_entity
125
+ end
126
+ end
127
+
128
+ def rest_create(model_klass)
129
+ @model = model_klass.new()
130
+
131
+ # Unlike the implications of the representable README, "consume!" can
132
+ # actually make changes to the database. See http://goo.gl/WVLBqA.
133
+ # We do want to consume before checking the permissions so we can know
134
+ # what we're dealing with, but if user doesn't have permission we don't
135
+ # want to have changed the DB. Wrap in a transaction to protect ourselves.
136
+
137
+ model_klass.transaction do
138
+ consume!(@model)
139
+ raise SecurityTransgression unless current_user.can_create?(@model)
140
+ end
141
+
142
+ if @model.save
143
+ respond_with @model
144
+ else
145
+ render json: @model.errors, status: :unprocessable_entity
146
+ end
147
+ end
148
+
149
+ def rest_destroy(model_klass, id)
150
+ @model = model_klass.find(id)
151
+ raise SecurityTransgression unless current_user.can_destroy?(@model)
152
+
153
+ if @model.destroy
154
+ head :no_content
155
+ else
156
+ render json: @model.errors, status: :unprocessable_entity
157
+ end
158
+ end
159
+
160
+ def standard_sort(model_klass)
161
+ # take array of all IDs or hash of id => position,
162
+ # regardless build up an array of all IDs in the right order and pass those to sort
163
+
164
+ new_positions = params['newPositions']
165
+ return head :no_content if new_positions.length == 0
166
+
167
+ # Can't have duplicate positions or IDs
168
+ unique_ids = new_positions.collect{|np| np['id']}.uniq
169
+ unique_positions = new_positions.collect{|np| np['position']}.uniq
170
+
171
+ return head :bad_request if unique_ids.length != new_positions.length
172
+ return head :bad_request if unique_positions.length != new_positions.length
173
+
174
+ first = model_klass.where(:id => new_positions[0]['id']).first
175
+
176
+ return head :not_found if first.blank?
177
+
178
+ originalOrdered = first.me_and_peers.ordered.all
179
+
180
+ originalOrdered.each do |item|
181
+ raise SecurityTransgression unless item.send(:container_column) == originalOrdered[0].send(:container_column) \
182
+ if item.respond_to?(:container_column)
183
+ raise SecurityTransgression unless current_user.can_sort?(item)
184
+ end
185
+
186
+ originalOrderedIds = originalOrdered.collect{|sc| sc.id}
187
+
188
+ newOrderedIds = Array.new(originalOrderedIds.size)
189
+
190
+ new_positions.each do |newPosition|
191
+ id = newPosition['id'].to_i
192
+ newOrderedIds[newPosition['position']] = id
193
+ originalOrderedIds.delete(id)
194
+ end
195
+
196
+ ptr = 0
197
+ for oldId in originalOrderedIds
198
+ while !newOrderedIds[ptr].nil?; ptr += 1; end
199
+ newOrderedIds[ptr] = oldId
200
+ end
201
+
202
+ begin
203
+ model_klass.sort!(newOrderedIds)
204
+ rescue Exception => e
205
+ return head :internal_server_error
206
+ end
207
+
208
+ head :no_content
209
+ end
70
210
 
71
211
  end
72
212
 
@@ -17,6 +17,7 @@ module OpenStax
17
17
  end
18
18
  end
19
19
 
20
+ # This needs to run after the orm is selected in the doorkeeper initializer
20
21
  OpenStax::Api::Engine.config.after_initialize do
21
22
  Doorkeeper::Application.send :include, OpenStax::Api::DoorkeeperExtensions
22
23
  end
@@ -1,5 +1,5 @@
1
1
  module OpenStax
2
2
  module Api
3
- VERSION = "0.0.1"
3
+ VERSION = "0.1.0"
4
4
  end
5
5
  end
Binary file
@@ -539,3 +539,142 @@ Connecting to database specified by database.yml
539
539
   (0.7ms) DROP TABLE "users"
540
540
   (0.8ms) CREATE TABLE "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) 
541
541
   (0.1ms) SELECT version FROM "schema_migrations"
542
+ Connecting to database specified by database.yml
543
+ Connecting to database specified by database.yml
544
+ Connecting to database specified by database.yml
545
+ Connecting to database specified by database.yml
546
+ Connecting to database specified by database.yml
547
+ Connecting to database specified by database.yml
548
+ Connecting to database specified by database.yml
549
+ Connecting to database specified by database.yml
550
+ Connecting to database specified by database.yml
551
+ Connecting to database specified by database.yml
552
+ Connecting to database specified by database.yml
553
+ Connecting to database specified by database.yml
554
+ Connecting to database specified by database.yml
555
+ Connecting to database specified by database.yml
556
+ Connecting to database specified by database.yml
557
+ Connecting to database specified by database.yml
558
+  (0.1ms) SELECT "schema_migrations"."version" FROM "schema_migrations" 
559
+  (0.2ms) select sqlite_version(*)
560
+  (1.0ms) DROP TABLE "oauth_access_grants"
561
+  (1.1ms) 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))
562
+  (1.0ms) CREATE UNIQUE INDEX "index_oauth_access_grants_on_token" ON "oauth_access_grants" ("token")
563
+  (0.9ms) DROP TABLE "oauth_access_tokens"
564
+  (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)) 
565
+  (0.9ms) CREATE UNIQUE INDEX "index_oauth_access_tokens_on_refresh_token" ON "oauth_access_tokens" ("refresh_token")
566
+  (0.8ms) CREATE INDEX "index_oauth_access_tokens_on_resource_owner_id" ON "oauth_access_tokens" ("resource_owner_id")
567
+  (0.8ms) CREATE UNIQUE INDEX "index_oauth_access_tokens_on_token" ON "oauth_access_tokens" ("token")
568
+  (0.7ms) DROP TABLE "oauth_applications"
569
+  (0.8ms) 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)
570
+  (0.8ms) CREATE UNIQUE INDEX "index_oauth_applications_on_uid" ON "oauth_applications" ("uid")
571
+  (0.7ms) DROP TABLE "users"
572
+  (0.8ms) CREATE TABLE "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) 
573
+  (0.1ms) SELECT version FROM "schema_migrations"
574
+ Connecting to database specified by database.yml
575
+ Connecting to database specified by database.yml
576
+ Connecting to database specified by database.yml
577
+ Connecting to database specified by database.yml
578
+  (0.1ms) SELECT "schema_migrations"."version" FROM "schema_migrations" 
579
+  (0.2ms) select sqlite_version(*)
580
+  (1.6ms) DROP TABLE "oauth_access_grants"
581
+  (0.9ms) 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))
582
+  (0.7ms) CREATE UNIQUE INDEX "index_oauth_access_grants_on_token" ON "oauth_access_grants" ("token")
583
+  (1.0ms) DROP TABLE "oauth_access_tokens"
584
+  (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)) 
585
+  (1.1ms) CREATE UNIQUE INDEX "index_oauth_access_tokens_on_refresh_token" ON "oauth_access_tokens" ("refresh_token")
586
+  (0.9ms) CREATE INDEX "index_oauth_access_tokens_on_resource_owner_id" ON "oauth_access_tokens" ("resource_owner_id")
587
+  (0.7ms) CREATE UNIQUE INDEX "index_oauth_access_tokens_on_token" ON "oauth_access_tokens" ("token")
588
+  (0.8ms) DROP TABLE "oauth_applications"
589
+  (0.8ms) 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)
590
+  (0.8ms) CREATE UNIQUE INDEX "index_oauth_applications_on_uid" ON "oauth_applications" ("uid")
591
+  (0.7ms) DROP TABLE "users"
592
+  (0.8ms) CREATE TABLE "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) 
593
+  (0.1ms) SELECT version FROM "schema_migrations"
594
+ Connecting to database specified by database.yml
595
+  (0.1ms) SELECT "schema_migrations"."version" FROM "schema_migrations" 
596
+  (0.2ms) select sqlite_version(*)
597
+  (1.8ms) DROP TABLE "oauth_access_grants"
598
+  (1.1ms) 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))
599
+  (0.9ms) CREATE UNIQUE INDEX "index_oauth_access_grants_on_token" ON "oauth_access_grants" ("token")
600
+  (0.9ms) DROP TABLE "oauth_access_tokens"
601
+  (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)) 
602
+  (0.8ms) CREATE UNIQUE INDEX "index_oauth_access_tokens_on_refresh_token" ON "oauth_access_tokens" ("refresh_token")
603
+  (0.8ms) CREATE INDEX "index_oauth_access_tokens_on_resource_owner_id" ON "oauth_access_tokens" ("resource_owner_id")
604
+  (0.8ms) CREATE UNIQUE INDEX "index_oauth_access_tokens_on_token" ON "oauth_access_tokens" ("token")
605
+  (0.8ms) DROP TABLE "oauth_applications"
606
+  (0.8ms) 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)
607
+  (0.8ms) CREATE UNIQUE INDEX "index_oauth_applications_on_uid" ON "oauth_applications" ("uid")
608
+  (0.8ms) DROP TABLE "users"
609
+  (0.9ms) CREATE TABLE "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) 
610
+  (0.1ms) SELECT version FROM "schema_migrations"
611
+ Connecting to database specified by database.yml
612
+  (0.1ms) SELECT "schema_migrations"."version" FROM "schema_migrations" 
613
+  (0.2ms) select sqlite_version(*)
614
+  (1.7ms) DROP TABLE "oauth_access_grants"
615
+  (0.9ms) 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))
616
+  (0.7ms) CREATE UNIQUE INDEX "index_oauth_access_grants_on_token" ON "oauth_access_grants" ("token")
617
+  (0.8ms) DROP TABLE "oauth_access_tokens"
618
+  (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)) 
619
+  (0.8ms) CREATE UNIQUE INDEX "index_oauth_access_tokens_on_refresh_token" ON "oauth_access_tokens" ("refresh_token")
620
+  (0.8ms) CREATE INDEX "index_oauth_access_tokens_on_resource_owner_id" ON "oauth_access_tokens" ("resource_owner_id")
621
+  (0.8ms) CREATE UNIQUE INDEX "index_oauth_access_tokens_on_token" ON "oauth_access_tokens" ("token")
622
+  (0.7ms) DROP TABLE "oauth_applications"
623
+  (0.8ms) 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)
624
+  (0.8ms) CREATE UNIQUE INDEX "index_oauth_applications_on_uid" ON "oauth_applications" ("uid")
625
+  (0.7ms) DROP TABLE "users"
626
+  (0.8ms) CREATE TABLE "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) 
627
+  (0.0ms) SELECT version FROM "schema_migrations"
628
+ Connecting to database specified by database.yml
629
+  (0.1ms) SELECT "schema_migrations"."version" FROM "schema_migrations" 
630
+  (0.2ms) select sqlite_version(*)
631
+  (1.6ms) DROP TABLE "oauth_access_grants"
632
+  (0.9ms) 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))
633
+  (0.7ms) CREATE UNIQUE INDEX "index_oauth_access_grants_on_token" ON "oauth_access_grants" ("token")
634
+  (0.8ms) DROP TABLE "oauth_access_tokens"
635
+  (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)) 
636
+  (0.8ms) CREATE UNIQUE INDEX "index_oauth_access_tokens_on_refresh_token" ON "oauth_access_tokens" ("refresh_token")
637
+  (0.8ms) CREATE INDEX "index_oauth_access_tokens_on_resource_owner_id" ON "oauth_access_tokens" ("resource_owner_id")
638
+  (0.8ms) CREATE UNIQUE INDEX "index_oauth_access_tokens_on_token" ON "oauth_access_tokens" ("token")
639
+  (0.7ms) DROP TABLE "oauth_applications"
640
+  (0.8ms) 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)
641
+  (0.8ms) CREATE UNIQUE INDEX "index_oauth_applications_on_uid" ON "oauth_applications" ("uid")
642
+  (0.7ms) DROP TABLE "users"
643
+  (0.8ms) CREATE TABLE "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) 
644
+  (0.0ms) SELECT version FROM "schema_migrations"
645
+ Connecting to database specified by database.yml
646
+ Connecting to database specified by database.yml
647
+ Connecting to database specified by database.yml
648
+  (0.1ms) SELECT "schema_migrations"."version" FROM "schema_migrations" 
649
+  (0.2ms) select sqlite_version(*)
650
+  (1.9ms) DROP TABLE "oauth_access_grants"
651
+  (1.1ms) 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))
652
+  (0.8ms) CREATE UNIQUE INDEX "index_oauth_access_grants_on_token" ON "oauth_access_grants" ("token")
653
+  (0.8ms) DROP TABLE "oauth_access_tokens"
654
+  (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)) 
655
+  (0.8ms) CREATE UNIQUE INDEX "index_oauth_access_tokens_on_refresh_token" ON "oauth_access_tokens" ("refresh_token")
656
+  (0.9ms) CREATE INDEX "index_oauth_access_tokens_on_resource_owner_id" ON "oauth_access_tokens" ("resource_owner_id")
657
+  (0.8ms) CREATE UNIQUE INDEX "index_oauth_access_tokens_on_token" ON "oauth_access_tokens" ("token")
658
+  (0.8ms) DROP TABLE "oauth_applications"
659
+  (0.8ms) 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)
660
+  (0.8ms) CREATE UNIQUE INDEX "index_oauth_applications_on_uid" ON "oauth_applications" ("uid")
661
+  (0.7ms) DROP TABLE "users"
662
+  (0.8ms) CREATE TABLE "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) 
663
+  (0.1ms) SELECT version FROM "schema_migrations"
664
+ Connecting to database specified by database.yml
665
+  (0.1ms) SELECT "schema_migrations"."version" FROM "schema_migrations" 
666
+  (0.2ms) select sqlite_version(*)
667
+  (1.8ms) DROP TABLE "oauth_access_grants"
668
+  (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))
669
+  (0.8ms) CREATE UNIQUE INDEX "index_oauth_access_grants_on_token" ON "oauth_access_grants" ("token")
670
+  (0.9ms) DROP TABLE "oauth_access_tokens"
671
+  (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)) 
672
+  (0.8ms) CREATE UNIQUE INDEX "index_oauth_access_tokens_on_refresh_token" ON "oauth_access_tokens" ("refresh_token")
673
+  (0.8ms) CREATE INDEX "index_oauth_access_tokens_on_resource_owner_id" ON "oauth_access_tokens" ("resource_owner_id")
674
+  (0.8ms) CREATE UNIQUE INDEX "index_oauth_access_tokens_on_token" ON "oauth_access_tokens" ("token")
675
+  (0.7ms) DROP TABLE "oauth_applications"
676
+  (0.8ms) 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)
677
+  (0.8ms) CREATE UNIQUE INDEX "index_oauth_applications_on_uid" ON "oauth_applications" ("uid")
678
+  (0.7ms) DROP TABLE "users"
679
+  (0.8ms) CREATE TABLE "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) 
680
+  (0.0ms) SELECT version FROM "schema_migrations"
@@ -3181,3 +3181,255 @@ Connecting to database specified by database.yml
3181
3181
   (0.0ms) rollback transaction
3182
3182
   (0.0ms) begin transaction
3183
3183
   (0.0ms) rollback transaction
3184
+ Connecting to database specified by database.yml
3185
+  (0.4ms) begin transaction
3186
+  (0.0ms) rollback transaction
3187
+  (0.0ms) begin transaction
3188
+  (0.0ms) rollback transaction
3189
+  (0.0ms) begin transaction
3190
+  (0.1ms) rollback transaction
3191
+  (0.1ms) begin transaction
3192
+  (0.0ms) rollback transaction
3193
+  (0.0ms) begin transaction
3194
+  (0.0ms) rollback transaction
3195
+  (0.0ms) begin transaction
3196
+  (0.0ms) rollback transaction
3197
+  (0.0ms) begin transaction
3198
+  (0.0ms) rollback transaction
3199
+  (0.0ms) begin transaction
3200
+  (0.0ms) rollback transaction
3201
+  (0.1ms) begin transaction
3202
+  (0.0ms) rollback transaction
3203
+  (0.0ms) begin transaction
3204
+  (0.0ms) rollback transaction
3205
+  (0.0ms) begin transaction
3206
+  (0.0ms) rollback transaction
3207
+  (0.0ms) begin transaction
3208
+  (0.0ms) SAVEPOINT active_record_1
3209
+ SQL (5.2ms) INSERT INTO "users" ("created_at", "password_hash", "updated_at", "username") VALUES (?, ?, ?, ?) [["created_at", Wed, 26 Mar 2014 20:21:13 UTC +00:00], ["password_hash", nil], ["updated_at", Wed, 26 Mar 2014 20:21:13 UTC +00:00], ["username", nil]]
3210
+  (0.0ms) RELEASE SAVEPOINT active_record_1
3211
+ User Load (0.1ms) SELECT "users".* FROM "users" WHERE "users"."id" = ? LIMIT 1 [["id", 1]]
3212
+  (0.3ms) rollback transaction
3213
+  (0.0ms) begin transaction
3214
+  (0.0ms) SAVEPOINT active_record_1
3215
+ SQL (0.2ms) INSERT INTO "users" ("created_at", "password_hash", "updated_at", "username") VALUES (?, ?, ?, ?) [["created_at", Wed, 26 Mar 2014 20:21:13 UTC +00:00], ["password_hash", nil], ["updated_at", Wed, 26 Mar 2014 20:21:13 UTC +00:00], ["username", nil]]
3216
+  (0.0ms) RELEASE SAVEPOINT active_record_1
3217
+  (0.2ms) rollback transaction
3218
+  (0.0ms) begin transaction
3219
+  (0.0ms) rollback transaction
3220
+ Connecting to database specified by database.yml
3221
+  (0.4ms) begin transaction
3222
+  (0.0ms) rollback transaction
3223
+  (0.0ms) begin transaction
3224
+  (0.0ms) rollback transaction
3225
+  (0.0ms) begin transaction
3226
+  (0.0ms) rollback transaction
3227
+  (0.0ms) begin transaction
3228
+  (0.0ms) rollback transaction
3229
+  (0.0ms) begin transaction
3230
+  (0.0ms) rollback transaction
3231
+  (0.0ms) begin transaction
3232
+  (0.0ms) rollback transaction
3233
+  (0.0ms) begin transaction
3234
+  (0.0ms) rollback transaction
3235
+  (0.0ms) begin transaction
3236
+  (0.0ms) rollback transaction
3237
+  (0.0ms) begin transaction
3238
+  (0.0ms) rollback transaction
3239
+  (0.0ms) begin transaction
3240
+  (0.0ms) rollback transaction
3241
+  (0.0ms) begin transaction
3242
+  (0.0ms) rollback transaction
3243
+  (0.0ms) begin transaction
3244
+  (0.0ms) SAVEPOINT active_record_1
3245
+ SQL (2.4ms) INSERT INTO "users" ("created_at", "password_hash", "updated_at", "username") VALUES (?, ?, ?, ?) [["created_at", Wed, 26 Mar 2014 20:40:46 UTC +00:00], ["password_hash", nil], ["updated_at", Wed, 26 Mar 2014 20:40:46 UTC +00:00], ["username", nil]]
3246
+  (0.0ms) RELEASE SAVEPOINT active_record_1
3247
+  (1.1ms) rollback transaction
3248
+  (0.1ms) begin transaction
3249
+  (0.0ms) SAVEPOINT active_record_1
3250
+ SQL (0.4ms) INSERT INTO "users" ("created_at", "password_hash", "updated_at", "username") VALUES (?, ?, ?, ?) [["created_at", Wed, 26 Mar 2014 20:40:46 UTC +00:00], ["password_hash", nil], ["updated_at", Wed, 26 Mar 2014 20:40:46 UTC +00:00], ["username", nil]]
3251
+  (0.1ms) RELEASE SAVEPOINT active_record_1
3252
+ User Load (0.1ms) SELECT "users".* FROM "users" WHERE "users"."id" = ? LIMIT 1 [["id", 1]]
3253
+  (0.3ms) rollback transaction
3254
+  (0.0ms) begin transaction
3255
+  (0.1ms) rollback transaction
3256
+ Connecting to database specified by database.yml
3257
+  (0.4ms) begin transaction
3258
+  (0.0ms) rollback transaction
3259
+  (0.0ms) begin transaction
3260
+  (0.0ms) rollback transaction
3261
+  (0.0ms) begin transaction
3262
+  (0.0ms) SAVEPOINT active_record_1
3263
+ SQL (2.3ms) INSERT INTO "users" ("created_at", "password_hash", "updated_at", "username") VALUES (?, ?, ?, ?) [["created_at", Wed, 26 Mar 2014 20:40:56 UTC +00:00], ["password_hash", nil], ["updated_at", Wed, 26 Mar 2014 20:40:56 UTC +00:00], ["username", nil]]
3264
+  (0.0ms) RELEASE SAVEPOINT active_record_1
3265
+  (1.0ms) rollback transaction
3266
+  (0.1ms) begin transaction
3267
+  (0.0ms) SAVEPOINT active_record_1
3268
+ SQL (0.4ms) INSERT INTO "users" ("created_at", "password_hash", "updated_at", "username") VALUES (?, ?, ?, ?) [["created_at", Wed, 26 Mar 2014 20:40:56 UTC +00:00], ["password_hash", nil], ["updated_at", Wed, 26 Mar 2014 20:40:56 UTC +00:00], ["username", nil]]
3269
+  (0.0ms) RELEASE SAVEPOINT active_record_1
3270
+ User Load (0.1ms) SELECT "users".* FROM "users" WHERE "users"."id" = ? LIMIT 1 [["id", 1]]
3271
+  (0.3ms) rollback transaction
3272
+  (0.0ms) begin transaction
3273
+  (0.0ms) rollback transaction
3274
+  (0.0ms) begin transaction
3275
+  (0.0ms) rollback transaction
3276
+  (0.0ms) begin transaction
3277
+  (0.0ms) rollback transaction
3278
+  (0.0ms) begin transaction
3279
+  (0.0ms) rollback transaction
3280
+  (0.0ms) begin transaction
3281
+  (0.0ms) rollback transaction
3282
+  (0.0ms) begin transaction
3283
+  (0.0ms) rollback transaction
3284
+  (0.0ms) begin transaction
3285
+  (0.0ms) rollback transaction
3286
+  (0.0ms) begin transaction
3287
+  (0.0ms) rollback transaction
3288
+  (0.0ms) begin transaction
3289
+  (0.0ms) rollback transaction
3290
+  (0.0ms) begin transaction
3291
+  (0.0ms) rollback transaction
3292
+ Connecting to database specified by database.yml
3293
+  (0.4ms) begin transaction
3294
+  (0.0ms) rollback transaction
3295
+  (0.0ms) begin transaction
3296
+  (0.0ms) SAVEPOINT active_record_1
3297
+ SQL (2.3ms) INSERT INTO "users" ("created_at", "password_hash", "updated_at", "username") VALUES (?, ?, ?, ?) [["created_at", Wed, 26 Mar 2014 20:41:44 UTC +00:00], ["password_hash", nil], ["updated_at", Wed, 26 Mar 2014 20:41:44 UTC +00:00], ["username", nil]]
3298
+  (0.0ms) RELEASE SAVEPOINT active_record_1
3299
+  (1.1ms) rollback transaction
3300
+  (0.1ms) begin transaction
3301
+  (0.0ms) rollback transaction
3302
+  (0.1ms) begin transaction
3303
+  (0.0ms) SAVEPOINT active_record_1
3304
+ SQL (0.3ms) INSERT INTO "users" ("created_at", "password_hash", "updated_at", "username") VALUES (?, ?, ?, ?) [["created_at", Wed, 26 Mar 2014 20:41:44 UTC +00:00], ["password_hash", nil], ["updated_at", Wed, 26 Mar 2014 20:41:44 UTC +00:00], ["username", nil]]
3305
+  (0.0ms) RELEASE SAVEPOINT active_record_1
3306
+ User Load (0.1ms) SELECT "users".* FROM "users" WHERE "users"."id" = ? LIMIT 1 [["id", 1]]
3307
+  (0.3ms) rollback transaction
3308
+  (0.0ms) begin transaction
3309
+  (0.0ms) rollback transaction
3310
+  (0.0ms) begin transaction
3311
+  (0.0ms) rollback transaction
3312
+  (0.0ms) begin transaction
3313
+  (0.0ms) rollback transaction
3314
+  (0.0ms) begin transaction
3315
+  (0.0ms) rollback transaction
3316
+  (0.0ms) begin transaction
3317
+  (0.0ms) rollback transaction
3318
+  (0.0ms) begin transaction
3319
+  (0.0ms) rollback transaction
3320
+  (0.0ms) begin transaction
3321
+  (0.0ms) rollback transaction
3322
+  (0.0ms) begin transaction
3323
+  (0.0ms) rollback transaction
3324
+  (0.0ms) begin transaction
3325
+  (0.0ms) rollback transaction
3326
+  (0.0ms) begin transaction
3327
+  (0.0ms) rollback transaction
3328
+ Connecting to database specified by database.yml
3329
+  (0.4ms) begin transaction
3330
+  (0.0ms) rollback transaction
3331
+  (0.0ms) begin transaction
3332
+  (0.0ms) SAVEPOINT active_record_1
3333
+ SQL (2.3ms) INSERT INTO "users" ("created_at", "password_hash", "updated_at", "username") VALUES (?, ?, ?, ?) [["created_at", Wed, 26 Mar 2014 20:42:07 UTC +00:00], ["password_hash", nil], ["updated_at", Wed, 26 Mar 2014 20:42:07 UTC +00:00], ["username", nil]]
3334
+  (0.0ms) RELEASE SAVEPOINT active_record_1
3335
+  (1.1ms) rollback transaction
3336
+  (0.1ms) begin transaction
3337
+  (0.0ms) SAVEPOINT active_record_1
3338
+ SQL (0.4ms) INSERT INTO "users" ("created_at", "password_hash", "updated_at", "username") VALUES (?, ?, ?, ?) [["created_at", Wed, 26 Mar 2014 20:42:07 UTC +00:00], ["password_hash", nil], ["updated_at", Wed, 26 Mar 2014 20:42:07 UTC +00:00], ["username", nil]]
3339
+  (0.0ms) RELEASE SAVEPOINT active_record_1
3340
+ User Load (0.1ms) SELECT "users".* FROM "users" WHERE "users"."id" = ? LIMIT 1 [["id", 1]]
3341
+  (0.3ms) rollback transaction
3342
+  (0.0ms) begin transaction
3343
+  (0.0ms) rollback transaction
3344
+  (0.0ms) begin transaction
3345
+  (0.0ms) rollback transaction
3346
+  (0.0ms) begin transaction
3347
+  (0.0ms) rollback transaction
3348
+  (0.0ms) begin transaction
3349
+  (0.0ms) rollback transaction
3350
+  (0.0ms) begin transaction
3351
+  (0.0ms) rollback transaction
3352
+  (0.0ms) begin transaction
3353
+  (0.0ms) rollback transaction
3354
+  (0.0ms) begin transaction
3355
+  (0.0ms) rollback transaction
3356
+  (0.0ms) begin transaction
3357
+  (0.0ms) rollback transaction
3358
+  (0.0ms) begin transaction
3359
+  (0.0ms) rollback transaction
3360
+  (0.0ms) begin transaction
3361
+  (0.0ms) rollback transaction
3362
+  (0.0ms) begin transaction
3363
+  (0.0ms) rollback transaction
3364
+ Connecting to database specified by database.yml
3365
+  (0.4ms) begin transaction
3366
+  (0.0ms) rollback transaction
3367
+  (0.0ms) begin transaction
3368
+  (0.0ms) SAVEPOINT active_record_1
3369
+ SQL (2.4ms) INSERT INTO "users" ("created_at", "password_hash", "updated_at", "username") VALUES (?, ?, ?, ?) [["created_at", Wed, 26 Mar 2014 20:59:20 UTC +00:00], ["password_hash", nil], ["updated_at", Wed, 26 Mar 2014 20:59:20 UTC +00:00], ["username", nil]]
3370
+  (0.0ms) RELEASE SAVEPOINT active_record_1
3371
+  (0.4ms) rollback transaction
3372
+  (0.1ms) begin transaction
3373
+  (0.0ms) rollback transaction
3374
+  (0.1ms) begin transaction
3375
+  (0.1ms) SAVEPOINT active_record_1
3376
+ SQL (0.3ms) INSERT INTO "users" ("created_at", "password_hash", "updated_at", "username") VALUES (?, ?, ?, ?) [["created_at", Wed, 26 Mar 2014 20:59:20 UTC +00:00], ["password_hash", nil], ["updated_at", Wed, 26 Mar 2014 20:59:20 UTC +00:00], ["username", nil]]
3377
+  (0.0ms) RELEASE SAVEPOINT active_record_1
3378
+ User Load (0.1ms) SELECT "users".* FROM "users" WHERE "users"."id" = ? LIMIT 1 [["id", 1]]
3379
+  (0.3ms) rollback transaction
3380
+  (0.0ms) begin transaction
3381
+  (0.0ms) rollback transaction
3382
+  (0.0ms) begin transaction
3383
+  (0.0ms) rollback transaction
3384
+  (0.0ms) begin transaction
3385
+  (0.0ms) rollback transaction
3386
+  (0.0ms) begin transaction
3387
+  (0.0ms) rollback transaction
3388
+  (0.0ms) begin transaction
3389
+  (0.0ms) rollback transaction
3390
+  (0.0ms) begin transaction
3391
+  (0.0ms) rollback transaction
3392
+  (0.0ms) begin transaction
3393
+  (0.0ms) rollback transaction
3394
+  (0.0ms) begin transaction
3395
+  (0.0ms) rollback transaction
3396
+  (0.0ms) begin transaction
3397
+  (0.0ms) rollback transaction
3398
+  (0.0ms) begin transaction
3399
+  (0.0ms) rollback transaction
3400
+ Connecting to database specified by database.yml
3401
+  (0.4ms) begin transaction
3402
+  (0.0ms) rollback transaction
3403
+  (0.0ms) begin transaction
3404
+  (0.0ms) rollback transaction
3405
+  (0.0ms) begin transaction
3406
+  (0.0ms) rollback transaction
3407
+  (0.0ms) begin transaction
3408
+  (0.0ms) rollback transaction
3409
+  (0.0ms) begin transaction
3410
+  (0.0ms) SAVEPOINT active_record_1
3411
+ SQL (2.3ms) INSERT INTO "users" ("created_at", "password_hash", "updated_at", "username") VALUES (?, ?, ?, ?) [["created_at", Wed, 26 Mar 2014 21:03:04 UTC +00:00], ["password_hash", nil], ["updated_at", Wed, 26 Mar 2014 21:03:04 UTC +00:00], ["username", nil]]
3412
+  (0.0ms) RELEASE SAVEPOINT active_record_1
3413
+  (1.0ms) rollback transaction
3414
+  (0.1ms) begin transaction
3415
+  (0.0ms) SAVEPOINT active_record_1
3416
+ SQL (0.2ms) INSERT INTO "users" ("created_at", "password_hash", "updated_at", "username") VALUES (?, ?, ?, ?) [["created_at", Wed, 26 Mar 2014 21:03:04 UTC +00:00], ["password_hash", nil], ["updated_at", Wed, 26 Mar 2014 21:03:04 UTC +00:00], ["username", nil]]
3417
+  (0.0ms) RELEASE SAVEPOINT active_record_1
3418
+ User Load (0.1ms) SELECT "users".* FROM "users" WHERE "users"."id" = ? LIMIT 1 [["id", 1]]
3419
+  (0.3ms) rollback transaction
3420
+  (0.0ms) begin transaction
3421
+  (0.0ms) rollback transaction
3422
+  (0.0ms) begin transaction
3423
+  (0.0ms) rollback transaction
3424
+  (0.0ms) begin transaction
3425
+  (0.0ms) rollback transaction
3426
+  (0.0ms) begin transaction
3427
+  (0.0ms) rollback transaction
3428
+  (0.0ms) begin transaction
3429
+  (0.0ms) rollback transaction
3430
+  (0.0ms) begin transaction
3431
+  (0.0ms) rollback transaction
3432
+  (0.0ms) begin transaction
3433
+  (0.0ms) rollback transaction
3434
+  (0.0ms) begin transaction
3435
+  (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: 0.0.1
4
+ version: 0.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dante Soares