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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 2f7f08eb37392e98a55d6a6bd0cca0981b56dffa
4
- data.tar.gz: daf30dd080970baaed0f613139f4e642005eed4c
3
+ metadata.gz: 38be80ebef1e571db6327a546c14c98db32523f2
4
+ data.tar.gz: 1672a98cf47b31c826a02ce2aa55d694ec6d6a28
5
5
  SHA512:
6
- metadata.gz: 09609ccc713627cae4bdfba9e1e3cc1d48ed9dd529c2dc9c633ca29de483657b3a3be7ad842fa0e65d5398dc98ae77c384698ddf753453ccf3a5850635df822a
7
- data.tar.gz: 928468ee3f4a14cb05c69c58c1d3e4451a1231943051b4483ba87fcdf07a1ff5ef4d0e827b7647c62280f98712bf918673eec8d8b2c78fe97bb841fcc07135e4
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 - Implemented ETag-based caching flow for all endpoints
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
- - Handle pagination
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
@@ -1,3 +1,3 @@
1
1
  module Cortex
2
- VERSION = '0.6.1'
2
+ VERSION = '0.7.0'
3
3
  end
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
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cortex-client
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.1
4
+ version: 0.7.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - CB Content Enablement