canvas_oauth_engine 1.1.0 → 1.1.1

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: bd71940eac39f52a99da306965eb23fba309c976
4
- data.tar.gz: 97c14ba4e0722765bdd5882fb21ca6b8a4718166
3
+ metadata.gz: 2678d6d70df8098c96fc980993d1101b531da101
4
+ data.tar.gz: 053b76ff287adf0d75cbd384f0187cf1ae87166f
5
5
  SHA512:
6
- metadata.gz: d3d6fa87ad02ac0a56d1841502f61f2222e8ef322cc4f3d3533858fde597e9cd16e327960f8846f67266c495bd7e34286bd29aae6e45ca1fef63ae790213e7f2
7
- data.tar.gz: 652903cb90ff4453d540079deaf9c43ede5d4491e963c4d3c1fe9f07c438cfd13222fd3ebb3ac0f65481b451b04931454300271bb57067a8aaa8d10d7265f2f9
6
+ metadata.gz: 7e65e0f1baaff06bd0c1c31dcb22cc53bb406904a751f2b4812d8945a370b5cad979fdfd2731749c6e0e9dfc0e8ec66e687a69980685ce80080b46662991db2c
7
+ data.tar.gz: 8aef10c7d01cbabf450da980031797fabc40ecdb009d1bfa6cdea57fa9d38d408c8107c67112a3de20d0687800bf26b9d731a03a53ce9278be7e56dae3129f61
@@ -96,7 +96,7 @@ module CanvasOauth
96
96
  def hash_csv(csv_string)
97
97
  require 'csv'
98
98
 
99
- csv = CSV.parse(csv_string)
99
+ csv = csv_string.is_a?(String) ? CSV.parse(csv_string) : csv_string
100
100
  headers = csv.shift
101
101
  output = []
102
102
 
@@ -1,3 +1,3 @@
1
1
  module CanvasOauth
2
- VERSION = "1.1.0"
2
+ VERSION = "1.1.1"
3
3
  end
@@ -9,5 +9,8 @@ class CreateCanvasOauthAuthorizations < ActiveRecord::Migration
9
9
  t.datetime "created_at", :null => false
10
10
  t.datetime "updated_at", :null => false
11
11
  end
12
+
13
+ add_index :canvas_oauth_authorizations, [:canvas_user_id, :tool_consumer_instance_guid],
14
+ name: 'index_canvas_oauth_auths_on_user_id_and_tciguid'
12
15
  end
13
16
  end
@@ -9,17 +9,19 @@
9
9
  # from scratch. The latter is a flawed and unsustainable approach (the more migrations
10
10
  # you'll amass, the slower it'll run and the greater likelihood for issues).
11
11
  #
12
- # It's strongly recommended to check this file into your version control system.
12
+ # It's strongly recommended that you check this file into your version control system.
13
13
 
14
- ActiveRecord::Schema.define(:version => 20130326194409) do
14
+ ActiveRecord::Schema.define(version: 20121121005358) do
15
15
 
16
- create_table "canvas_oauth_authorizations", :force => true do |t|
17
- t.integer "canvas_user_id", :limit => 8
18
- t.string "tool_consumer_instance_guid", :null => false
16
+ create_table "canvas_oauth_authorizations", force: true do |t|
17
+ t.integer "canvas_user_id", limit: 8
18
+ t.string "tool_consumer_instance_guid", null: false
19
19
  t.string "token"
20
20
  t.datetime "last_used_at"
21
- t.datetime "created_at", :null => false
22
- t.datetime "updated_at", :null => false
21
+ t.datetime "created_at", null: false
22
+ t.datetime "updated_at", null: false
23
23
  end
24
24
 
25
+ add_index "canvas_oauth_authorizations", ["canvas_user_id", "tool_consumer_instance_guid"], name: "index_canvas_oauth_auths_on_user_id_and_tciguid"
26
+
25
27
  end
@@ -18,6 +18,26 @@ describe CanvasOauth::CanvasApi do
18
18
  it { is_expected.to eq "http://test.canvas/login/oauth2/auth?client_id=key&response_type=code&state=zzxxyy&redirect_uri=http://localhost:3001/canvas/oauth" }
19
19
  end
20
20
 
21
+ describe "hash_csv" do
22
+ it "accepts a csv string and hashes it" do
23
+ csv = "canvas_course_id,course_id,short_name\n1,,Test Course"
24
+ expect(canvas.hash_csv(csv)).to eq([{
25
+ "canvas_course_id" => "1",
26
+ "course_id" => "",
27
+ "short_name" => "Test Course"
28
+ }])
29
+ end
30
+
31
+ it "accepts a parsed csv array and hashes it" do
32
+ csv = [["canvas_course_id", "course_id", "short_name"], ["1", nil, "Test Course"]]
33
+ expect(canvas.hash_csv(csv)).to eq([{
34
+ "canvas_course_id" => "1",
35
+ "course_id" => "",
36
+ "short_name" => "Test Course"
37
+ }])
38
+ end
39
+ end
40
+
21
41
  describe "get_access_token" do
22
42
  it "POSTs to /login/oauth2/token" do
23
43
  expect(CanvasOauth::CanvasApi).to receive(:post).with('/login/oauth2/token', anything()).and_return({})
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: canvas_oauth_engine
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 1.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dave Donahue
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2016-05-03 00:00:00.000000000 Z
13
+ date: 2016-07-11 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: rails
@@ -248,7 +248,7 @@ files:
248
248
  - spec/dummy/config/initializers/wrap_parameters.rb
249
249
  - spec/dummy/config/locales/en.yml
250
250
  - spec/dummy/config/routes.rb
251
- - spec/dummy/db/migrate/20130326194409_create_canvas_oauth_authorizations.canvas_oauth.rb
251
+ - spec/dummy/db/migrate/20160711200737_create_canvas_oauth_authorizations.canvas_oauth.rb
252
252
  - spec/dummy/db/schema.rb
253
253
  - spec/dummy/db/test.sqlite3
254
254
  - spec/dummy/log/test.log
@@ -307,7 +307,7 @@ test_files:
307
307
  - spec/dummy/config/locales/en.yml
308
308
  - spec/dummy/config/routes.rb
309
309
  - spec/dummy/config.ru
310
- - spec/dummy/db/migrate/20130326194409_create_canvas_oauth_authorizations.canvas_oauth.rb
310
+ - spec/dummy/db/migrate/20160711200737_create_canvas_oauth_authorizations.canvas_oauth.rb
311
311
  - spec/dummy/db/schema.rb
312
312
  - spec/dummy/db/test.sqlite3
313
313
  - spec/dummy/log/test.log