cortex-client 0.6.1 → 0.7.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +2 -1
- data/README.md +2 -3
- data/lib/cortex/client.rb +3 -1
- data/lib/cortex/version.rb +1 -1
- data/spec/client_spec.rb +2 -1
- 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: 38be80ebef1e571db6327a546c14c98db32523f2
|
4
|
+
data.tar.gz: 1672a98cf47b31c826a02ce2aa55d694ec6d6a28
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 629d32aa72211f1813e9c915e5a480132e22f83d8ff2548a535ee5cf46cf21a72aada8cd35b92dd802018c61d5314b074c2d8e8d1ab3e84fd62165d41afe9015
|
7
|
+
data.tar.gz: 0eada4f0b44d624d2d77096e3cbc244132188bebdfba7435b2f36184d6b4228c0cc34a11cfc2c4a974e0f77388ab84d57286f58625a2c053920bd8dd88e51a0f
|
data/CHANGELOG.md
CHANGED
@@ -3,6 +3,7 @@ Version History
|
|
3
3
|
* All Version bumps are required to update this file as well!!
|
4
4
|
----
|
5
5
|
|
6
|
+
* 0.7.0 - Implement ability to specify OAuth scopes
|
6
7
|
* 0.6.1 - Update various dependencies
|
7
|
-
* 0.6.0 -
|
8
|
+
* 0.6.0 - Implement ETag-based caching flow for all endpoints
|
8
9
|
* 0.5.0 - Update OAuth2 gem to 1.0.0
|
data/README.md
CHANGED
@@ -22,7 +22,7 @@ Alternatively, cortex-client will handle OAuth2 authentication for you:
|
|
22
22
|
```ruby
|
23
23
|
require 'cortex-client'
|
24
24
|
|
25
|
-
client = Cortex::Client.new(key: 'my-app-id', secret: 'secrey-key-ssh', base_url: 'base_url')
|
25
|
+
client = Cortex::Client.new(key: 'my-app-id', secret: 'secrey-key-ssh', base_url: 'base_url', scopes: 'view:posts view:media')
|
26
26
|
|
27
27
|
client.posts.query().each do |post|
|
28
28
|
puts post
|
@@ -51,5 +51,4 @@ Cortex::Client will return a Cortex::Result object. The following methods are av
|
|
51
51
|
- *Webpages* - feed
|
52
52
|
|
53
53
|
### TODO
|
54
|
-
-
|
55
|
-
- /media
|
54
|
+
- Support *Media* endpoint
|
data/lib/cortex/client.rb
CHANGED
@@ -14,6 +14,7 @@ module Cortex
|
|
14
14
|
attr_accessor :access_token, :base_url, :auth_method
|
15
15
|
@key = ''
|
16
16
|
@secret = ''
|
17
|
+
@scopes = ''
|
17
18
|
|
18
19
|
include Cortex::Connection
|
19
20
|
include Cortex::Request
|
@@ -25,6 +26,7 @@ module Cortex
|
|
25
26
|
else
|
26
27
|
@key = hasharg[:key]
|
27
28
|
@secret = hasharg[:secret]
|
29
|
+
@scopes ||= hasharg[:scopes]
|
28
30
|
@access_token = get_cc_token
|
29
31
|
end
|
30
32
|
@posts = Cortex::Posts.new(self)
|
@@ -35,7 +37,7 @@ module Cortex
|
|
35
37
|
def get_cc_token
|
36
38
|
begin
|
37
39
|
client = OAuth2::Client.new(@key, @secret, site: @base_url)
|
38
|
-
client.client_credentials.get_token
|
40
|
+
client.client_credentials.get_token({scope: @scopes})
|
39
41
|
rescue Faraday::ConnectionFailed
|
40
42
|
raise Cortex::Exceptions::ConnectionFailed.new(base_url: @base_url)
|
41
43
|
end
|
data/lib/cortex/version.rb
CHANGED
data/spec/client_spec.rb
CHANGED
@@ -4,8 +4,9 @@ RSpec.describe Cortex::Client do
|
|
4
4
|
|
5
5
|
let(:access_token) { '123' }
|
6
6
|
let(:base_url) { 'http://localhost:3000' }
|
7
|
+
let(:scopes) { 'view:posts view:media' }
|
7
8
|
let(:client) do
|
8
|
-
Cortex::Client.new(access_token: access_token, base_url: base_url)
|
9
|
+
Cortex::Client.new(access_token: access_token, base_url: base_url, scopes: scopes)
|
9
10
|
end
|
10
11
|
|
11
12
|
it 'should preserve settings' do
|