bearcat 1.1.1 → 1.2.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 +4 -4
- data/lib/bearcat/client/o_auth2.rb +12 -6
- data/lib/bearcat/version.rb +1 -1
- data/spec/bearcat/client/o_auth2_spec.rb +2 -2
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1c58958ef73904e5bf4b010ad4e2795c1d374617
|
4
|
+
data.tar.gz: 61d57f4dbebba2ed51188f2081ba3b56a95a889c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 19335d692cbd5e2237d9294aca981a03d8fbee2704e9a70bf4d5051bf2b358bd7e0f91ccdd3a7e5824cd51d19fd0a486b97a57b7fe13e021cb49137f2bb43875
|
7
|
+
data.tar.gz: 5bc253db48d718804dc83d5f1a8359042250d5911d3853f73be0b1caab152808f785167d483e513d882c8b80334f7f8e37cf237d6870ecfa2e8aebf6099e1b8e
|
@@ -15,18 +15,24 @@ module Bearcat
|
|
15
15
|
uri.to_s
|
16
16
|
end
|
17
17
|
|
18
|
-
def retrieve_token(client_id, redirect_url, client_secret, code)
|
19
|
-
|
18
|
+
def retrieve_token(client_id, redirect_url, client_secret, code, grant_type = 'authorization_code')
|
19
|
+
token_params = {
|
20
20
|
client_id: client_id,
|
21
21
|
redirect_url: redirect_url,
|
22
22
|
client_secret: client_secret,
|
23
|
-
|
24
|
-
}
|
23
|
+
grant_type: grant_type
|
24
|
+
}
|
25
|
+
if grant_type == 'authorization_code'
|
26
|
+
token_params[:code] = code
|
27
|
+
elsif grant_type == 'refresh_token'
|
28
|
+
token_params[:refresh_token] = code
|
29
|
+
end
|
30
|
+
body = post('/login/oauth2/token', token_params)
|
25
31
|
config[:token] = body['access_token']
|
26
32
|
set_connection(config)
|
27
|
-
|
33
|
+
body
|
28
34
|
end
|
29
35
|
|
30
36
|
end
|
31
37
|
end
|
32
|
-
end
|
38
|
+
end
|
data/lib/bearcat/version.rb
CHANGED
@@ -10,11 +10,11 @@ describe Bearcat::Client::Enrollments do
|
|
10
10
|
|
11
11
|
it "sets the auth_token" do
|
12
12
|
stub_post(client, "/login/oauth2/token").
|
13
|
-
with(:body => {"client_id"=>"10000000000002", "client_secret"=>"secret", "code"=>"code", "redirect_url"=>"http://localhost:9393"}).
|
13
|
+
with(:body => {"client_id"=>"10000000000002", "client_secret"=>"secret", "code"=>"code", "redirect_url"=>"http://localhost:9393", 'grant_type' => 'authorization_code'}).
|
14
14
|
to_return(json_response('access_token.json'))
|
15
15
|
client.retrieve_token(10000000000002, 'http://localhost:9393', 'secret', 'code')
|
16
16
|
client.config.token.should == "foo_bar_token"
|
17
17
|
client.instance_variable_get(:@connection).headers[:authorization].should == 'Bearer foo_bar_token'
|
18
18
|
end
|
19
19
|
|
20
|
-
end
|
20
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bearcat
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nathan Mills, Jake Sorce
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-12-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|
@@ -274,7 +274,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
274
274
|
version: '0'
|
275
275
|
requirements: []
|
276
276
|
rubyforge_project:
|
277
|
-
rubygems_version: 2.4.
|
277
|
+
rubygems_version: 2.4.3
|
278
278
|
signing_key:
|
279
279
|
specification_version: 4
|
280
280
|
summary: Canvas API
|
@@ -397,3 +397,4 @@ test_files:
|
|
397
397
|
- spec/fixtures/user_page_views.json
|
398
398
|
- spec/fixtures/user_profile.json
|
399
399
|
- spec/helper.rb
|
400
|
+
has_rdoc:
|