cognitive_faculty 1.1.1 → 3.0.1

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
- SHA1:
3
- metadata.gz: db22ea0ff87524ade5a234577d2af3ec975d7288
4
- data.tar.gz: 82927f74143fb5b9dd768058fd14af54f9976bcb
2
+ SHA256:
3
+ metadata.gz: a1c78a5552d4d4af308e816866272d3f7be296b5a7bee2add05db61436a599e0
4
+ data.tar.gz: cb98e2311b120b2205b9360b39338bce0d581017aa79ff10ecc21cbc71a08d40
5
5
  SHA512:
6
- metadata.gz: b620ce2f951c151898541edf0c21853e180e1a8228717308dc7a23a8a76a9cc708ea05b246774ee119b12b88962d027d2b79b1052f0f27a89ec6c71fc520e04a
7
- data.tar.gz: 1ededc5585851c9a5be94d541c6d1ce9af9cf4feae2e08dfe7c5c60eb58f919806f3edd99ffa73e456cade9d1ea40c18cbfc36c29012daf7f600c63664044fdc
6
+ metadata.gz: 3c0ea41abb42a32e132e0eb36b66039af027962a52731ebc75f1cb8893fcb3c561a87cc3f8c32293ad1df04e2aae25d13432db3770ecd1f79a3615567a17a626
7
+ data.tar.gz: 9bb19d71734bffd5f564123025fcb9b5ad7e7e32db563cab1a8014a09def2eb794eb65abf0eac3b974d0fb585d1ba3c66f4c6a25ef6c11bb9ba2dbaf5d0f04cf
@@ -1,71 +1,69 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- cognitive_faculty (1.1.1)
5
- activemodel (~> 4.2.10)
6
- activesupport (~> 4.2.10)
4
+ cognitive_faculty (3.0.0)
5
+ activemodel (~> 6.0.2.1)
6
+ activesupport (~> 6.0.2.1)
7
7
  faraday_middleware (~> 0.12.2)
8
- her (~> 0.8.1)
8
+ her (~> 1.1.0)
9
9
  oauth2 (~> 1.4.0)
10
10
 
11
11
  GEM
12
12
  remote: https://rubygems.org/
13
13
  specs:
14
- activemodel (4.2.11.1)
15
- activesupport (= 4.2.11.1)
16
- builder (~> 3.1)
17
- activesupport (4.2.11.1)
18
- i18n (~> 0.7)
14
+ activemodel (6.0.2.2)
15
+ activesupport (= 6.0.2.2)
16
+ activesupport (6.0.2.2)
17
+ concurrent-ruby (~> 1.0, >= 1.0.2)
18
+ i18n (>= 0.7, < 2)
19
19
  minitest (~> 5.1)
20
- thread_safe (~> 0.3, >= 0.3.4)
21
20
  tzinfo (~> 1.1)
21
+ zeitwerk (~> 2.2)
22
22
  ast (2.4.0)
23
- builder (3.2.3)
24
- concurrent-ruby (1.1.5)
23
+ concurrent-ruby (1.1.6)
25
24
  diff-lcs (1.3)
26
- faraday (0.15.4)
25
+ faraday (0.17.3)
27
26
  multipart-post (>= 1.2, < 3)
28
27
  faraday_middleware (0.12.2)
29
28
  faraday (>= 0.7.4, < 1.0)
30
- her (0.8.6)
31
- activemodel (>= 3.0.0, <= 6.0.0)
32
- activesupport (>= 3.0.0, <= 6.0.0)
29
+ her (1.1.0)
30
+ activemodel (>= 4.2.1)
33
31
  faraday (>= 0.8, < 1.0)
34
32
  multi_json (~> 1.7)
35
- i18n (0.9.5)
33
+ i18n (1.8.3)
36
34
  concurrent-ruby (~> 1.0)
37
- jaro_winkler (1.5.1)
38
- jwt (2.1.0)
39
- minitest (5.11.3)
40
- multi_json (1.13.1)
35
+ jaro_winkler (1.5.4)
36
+ jwt (2.2.1)
37
+ minitest (5.14.1)
38
+ multi_json (1.14.1)
41
39
  multi_xml (0.6.0)
42
- multipart-post (2.1.0)
43
- oauth2 (1.4.1)
44
- faraday (>= 0.8, < 0.16.0)
40
+ multipart-post (2.1.1)
41
+ oauth2 (1.4.4)
42
+ faraday (>= 0.8, < 2.0)
45
43
  jwt (>= 1.0, < 3.0)
46
44
  multi_json (~> 1.3)
47
45
  multi_xml (~> 0.5)
48
46
  rack (>= 1.2, < 3)
49
- parallel (1.12.1)
50
- parser (2.5.1.2)
47
+ parallel (1.19.1)
48
+ parser (2.7.0.4)
51
49
  ast (~> 2.4.0)
52
50
  powerpack (0.1.2)
53
- rack (2.0.7)
51
+ rack (2.2.3)
54
52
  rainbow (3.0.0)
55
53
  rake (10.5.0)
56
- rspec (3.8.0)
57
- rspec-core (~> 3.8.0)
58
- rspec-expectations (~> 3.8.0)
59
- rspec-mocks (~> 3.8.0)
60
- rspec-core (3.8.0)
61
- rspec-support (~> 3.8.0)
62
- rspec-expectations (3.8.1)
54
+ rspec (3.9.0)
55
+ rspec-core (~> 3.9.0)
56
+ rspec-expectations (~> 3.9.0)
57
+ rspec-mocks (~> 3.9.0)
58
+ rspec-core (3.9.1)
59
+ rspec-support (~> 3.9.1)
60
+ rspec-expectations (3.9.1)
63
61
  diff-lcs (>= 1.2.0, < 2.0)
64
- rspec-support (~> 3.8.0)
65
- rspec-mocks (3.8.0)
62
+ rspec-support (~> 3.9.0)
63
+ rspec-mocks (3.9.1)
66
64
  diff-lcs (>= 1.2.0, < 2.0)
67
- rspec-support (~> 3.8.0)
68
- rspec-support (3.8.0)
65
+ rspec-support (~> 3.9.0)
66
+ rspec-support (3.9.2)
69
67
  rubocop (0.58.2)
70
68
  jaro_winkler (~> 1.5.1)
71
69
  parallel (~> 1.10)
@@ -74,21 +72,22 @@ GEM
74
72
  rainbow (>= 2.2.2, < 4.0)
75
73
  ruby-progressbar (~> 1.7)
76
74
  unicode-display_width (~> 1.0, >= 1.0.1)
77
- ruby-progressbar (1.10.0)
75
+ ruby-progressbar (1.10.1)
78
76
  thread_safe (0.3.6)
79
- tzinfo (1.2.5)
77
+ tzinfo (1.2.7)
80
78
  thread_safe (~> 0.1)
81
- unicode-display_width (1.4.0)
79
+ unicode-display_width (1.7.0)
80
+ zeitwerk (2.3.0)
82
81
 
83
82
  PLATFORMS
84
83
  ruby
85
84
 
86
85
  DEPENDENCIES
87
- bundler (~> 1.16)
86
+ bundler (~> 2.1.4)
88
87
  cognitive_faculty!
89
88
  rake (~> 10.0)
90
89
  rspec (~> 3.0)
91
90
  rubocop (~> 0.58.2)
92
91
 
93
92
  BUNDLED WITH
94
- 1.16.4
93
+ 2.1.4
data/README.md CHANGED
@@ -20,16 +20,19 @@ Or install it yourself as:
20
20
 
21
21
  ## Usage
22
22
 
23
+ Your application must be configured in AppID (NOTE: Single-Page App's do not work because they don't provide you a secret).
24
+
25
+ To use this service, you will need to supply a client ID, secret, and oauth server URL. See below for implementation, or __[click here for more information on how to obtain AppID config info](https://cloud.ibm.com/docs/appid?topic=appid-obtain-tokens#credentials-gui)__.
26
+
23
27
  ```ruby
28
+ # example implementation
24
29
  require 'cognitive_faculty'
25
30
 
26
31
  CognitiveFaculty.configure do |c|
27
- c.url = "https://platform.cognitivefaculty.com/api"
28
- c.auth.url = "https://accounts.cognitivefaculty.com"
29
- c.auth.client_id = "client id"
30
- c.auth.client_secret = "secret"
31
- c.auth.username = "username"
32
- c.auth.password = "password"
32
+ c.url = "https://platform.skills.network/api"
33
+ c.auth.client_id = "<AppID Client ID>"
34
+ c.auth.client_secret = "<AppID Secret>"
35
+ c.auth.oauth_server_url = "<AppID oauth Server URL>"
33
36
  end
34
37
 
35
38
  CognitiveFaculty::Offer.all.each do |o|
@@ -42,3 +45,7 @@ end
42
45
  After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
43
46
 
44
47
  To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
48
+
49
+ ### Testing
50
+
51
+ Fill out the values in `testy/main.rb` and then run `ruby testy/main.rb` for an easy way to test the Platform API.
@@ -19,14 +19,14 @@ Gem::Specification.new do |spec| # rubocop:disable Metrics/BlockLength
19
19
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
20
20
  spec.require_paths = ["lib"]
21
21
 
22
- spec.add_development_dependency "bundler", "~> 1.16"
22
+ spec.add_development_dependency "bundler", "~> 2.1.4"
23
23
  spec.add_development_dependency "rake", "~> 10.0"
24
24
  spec.add_development_dependency "rspec", "~> 3.0"
25
25
  spec.add_development_dependency "rubocop", "~> 0.58.2"
26
26
 
27
- spec.add_dependency "activemodel", "~> 4.2.10"
28
- spec.add_dependency "activesupport", "~> 4.2.10"
29
- spec.add_dependency "faraday_middleware", "~> 0.12.2"
30
- spec.add_dependency "her", "~> 0.8.1"
31
- spec.add_dependency "oauth2", "~> 1.4.0"
27
+ spec.add_dependency "activemodel", ">= 6.0"
28
+ spec.add_dependency "activesupport", ">= 6.0.2.1"
29
+ spec.add_dependency "faraday_middleware", ">= 0.12.2"
30
+ spec.add_dependency "her", ">= 1.1.0"
31
+ spec.add_dependency "oauth2", ">= 1.4.0"
32
32
  end
@@ -10,12 +10,10 @@ require "cognitive_faculty/configuration/configuration"
10
10
  #
11
11
  # Usage:
12
12
  # CognitiveFaculty.configure do |c|
13
- # c.url = "https://platform.cognitivefaculty.com/api"
14
- # c.auth.url = "https://accounts.cognitivefaculty.com"
15
- # c.auth.client_id = "client id"
16
- # c.auth.client_secret = "secret"
17
- # c.auth.username = "username"
18
- # c.auth.password = "password"
13
+ # c.url = "https://platform.skills.network/api"
14
+ # c.auth.client_id = "<AppID Client ID>"
15
+ # c.auth.client_secret = "<AppID Secret>"
16
+ # c.auth.oauth_server_url = "<AppID oauth Server URL>"
19
17
  # end
20
18
  #
21
19
  # CognitiveFaculty::Offer.all.each do |o|
@@ -7,16 +7,13 @@ module CognitiveFaculty
7
7
  # Authorization configuration for Cognitive Faculty Platform API.
8
8
  #
9
9
  # Attributes:
10
- # +url+: URL for authorization server.
11
10
  # +client_id+: Client ID used to request an acces token.
12
11
  # +client_secret+: Client secret used to request an access token.
13
- # +username+: Username for requesting a token using the +password+ strategy.
14
- # +password+: Password for requesting a token using the +password+ strategy.
15
- # +realm+: Keycloak realm to use. Deafults to +master+.
12
+ # +tenant_id+: AppID tenant id
13
+ # +oauth_server_url+: AppID oauth server URL
16
14
  # +token+: (read-only) OIDC access token.
17
15
  class Auth
18
- attr_accessor :url, :client_id, :client_secret, :username, :password,
19
- :realm
16
+ attr_accessor :client_id, :client_secret, :tenant_id, :oauth_server_url
20
17
  attr_reader :token
21
18
 
22
19
  def initialize
@@ -29,12 +26,9 @@ module CognitiveFaculty
29
26
  end
30
27
 
31
28
  def update_token
32
- opts = {
33
- site: url,
34
- token_url: "/auth/realms/#{realm}/protocol/openid-connect/token"
35
- }
29
+ opts = { token_url: "#{oauth_server_url}/token" }
36
30
  oauth2 = OAuth2::Client.new(client_id, client_secret, opts)
37
- @token = oauth2.password.get_token(username, password)
31
+ @token = oauth2.client_credentials.get_token(:username => client_id, :password => client_secret)
38
32
  end
39
33
  end
40
34
  end
@@ -1,3 +1,3 @@
1
1
  module CognitiveFaculty
2
- VERSION = "1.1.1".freeze
2
+ VERSION = "3.0.1".freeze
3
3
  end
@@ -0,0 +1,12 @@
1
+ require 'cognitive_faculty'
2
+
3
+ CognitiveFaculty.configure do |c|
4
+ c.url = "http://localhost:8080/api"
5
+ c.auth.client_id = "<client_id>"
6
+ c.auth.client_secret = "<client_secret>"
7
+ c.auth.oauth_server_url = "<oauth server url>"
8
+ end
9
+
10
+ CognitiveFaculty::Offer.all.each do |o|
11
+ puts o.name
12
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cognitive_faculty
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.1
4
+ version: 3.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Luiz Aoqui
8
- autorequire:
8
+ autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-06-11 00:00:00.000000000 Z
11
+ date: 2020-09-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '1.16'
19
+ version: 2.1.4
20
20
  type: :development
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: '1.16'
26
+ version: 2.1.4
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: rake
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -70,70 +70,70 @@ dependencies:
70
70
  name: activemodel
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
- - - "~>"
73
+ - - ">="
74
74
  - !ruby/object:Gem::Version
75
- version: 4.2.10
75
+ version: '6.0'
76
76
  type: :runtime
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
- - - "~>"
80
+ - - ">="
81
81
  - !ruby/object:Gem::Version
82
- version: 4.2.10
82
+ version: '6.0'
83
83
  - !ruby/object:Gem::Dependency
84
84
  name: activesupport
85
85
  requirement: !ruby/object:Gem::Requirement
86
86
  requirements:
87
- - - "~>"
87
+ - - ">="
88
88
  - !ruby/object:Gem::Version
89
- version: 4.2.10
89
+ version: 6.0.2.1
90
90
  type: :runtime
91
91
  prerelease: false
92
92
  version_requirements: !ruby/object:Gem::Requirement
93
93
  requirements:
94
- - - "~>"
94
+ - - ">="
95
95
  - !ruby/object:Gem::Version
96
- version: 4.2.10
96
+ version: 6.0.2.1
97
97
  - !ruby/object:Gem::Dependency
98
98
  name: faraday_middleware
99
99
  requirement: !ruby/object:Gem::Requirement
100
100
  requirements:
101
- - - "~>"
101
+ - - ">="
102
102
  - !ruby/object:Gem::Version
103
103
  version: 0.12.2
104
104
  type: :runtime
105
105
  prerelease: false
106
106
  version_requirements: !ruby/object:Gem::Requirement
107
107
  requirements:
108
- - - "~>"
108
+ - - ">="
109
109
  - !ruby/object:Gem::Version
110
110
  version: 0.12.2
111
111
  - !ruby/object:Gem::Dependency
112
112
  name: her
113
113
  requirement: !ruby/object:Gem::Requirement
114
114
  requirements:
115
- - - "~>"
115
+ - - ">="
116
116
  - !ruby/object:Gem::Version
117
- version: 0.8.1
117
+ version: 1.1.0
118
118
  type: :runtime
119
119
  prerelease: false
120
120
  version_requirements: !ruby/object:Gem::Requirement
121
121
  requirements:
122
- - - "~>"
122
+ - - ">="
123
123
  - !ruby/object:Gem::Version
124
- version: 0.8.1
124
+ version: 1.1.0
125
125
  - !ruby/object:Gem::Dependency
126
126
  name: oauth2
127
127
  requirement: !ruby/object:Gem::Requirement
128
128
  requirements:
129
- - - "~>"
129
+ - - ">="
130
130
  - !ruby/object:Gem::Version
131
131
  version: 1.4.0
132
132
  type: :runtime
133
133
  prerelease: false
134
134
  version_requirements: !ruby/object:Gem::Requirement
135
135
  requirements:
136
- - - "~>"
136
+ - - ">="
137
137
  - !ruby/object:Gem::Version
138
138
  version: 1.4.0
139
139
  description: Ruby gem for the Cognitive Faculty API.
@@ -162,10 +162,11 @@ files:
162
162
  - lib/cognitive_faculty/models/code.rb
163
163
  - lib/cognitive_faculty/models/offer.rb
164
164
  - lib/cognitive_faculty/version.rb
165
+ - testy/main.rb
165
166
  homepage: https://cognitivefaculty.com
166
167
  licenses: []
167
168
  metadata: {}
168
- post_install_message:
169
+ post_install_message:
169
170
  rdoc_options: []
170
171
  require_paths:
171
172
  - lib
@@ -180,9 +181,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
180
181
  - !ruby/object:Gem::Version
181
182
  version: '0'
182
183
  requirements: []
183
- rubyforge_project:
184
- rubygems_version: 2.6.14
185
- signing_key:
184
+ rubygems_version: 3.0.3
185
+ signing_key:
186
186
  specification_version: 4
187
187
  summary: Cognitive Faculty Ruby SDK
188
188
  test_files: []