lightcast-ruby 0.1.0 → 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +14 -0
- data/Gemfile +1 -1
- data/Gemfile.lock +11 -28
- data/README.md +32 -12
- data/lib/lightcast-ruby/authentication.rb +2 -1
- data/lib/lightcast-ruby/client.rb +4 -4
- data/lib/lightcast-ruby/connection.rb +2 -1
- data/lib/lightcast-ruby/services/skills.rb +11 -6
- data/lib/lightcast-ruby/version.rb +1 -1
- metadata +4 -10
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5cd267666687cc842b14716d54d109c96180cbbb6c4ddd980324beb15f59de38
|
4
|
+
data.tar.gz: 5057ff614595e005a8460972a23fa934d98fe3ea5950d1c212ec118ac3e76fa5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: de74703364201614aa14d343ddbe1c96841987ac26a2e235f5aab5624830282063c107aa559dc2c5737bb8c4e80c4f7b5c077e59349e2c32d4533a80fe47a515
|
7
|
+
data.tar.gz: 7410aaa39b0dec37ac8116c9a410be16358b5e0927b90febc4674f87665b87c674fae5fb536930831a7a2b26ff71f7bb136511884a84243551f7b380ebdc47a7
|
data/CHANGELOG.md
CHANGED
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
lightcast-ruby (0.1
|
5
|
-
faraday (
|
4
|
+
lightcast-ruby (0.2.1)
|
5
|
+
faraday (>= 2.0.1)
|
6
6
|
|
7
7
|
GEM
|
8
8
|
remote: https://rubygems.org/
|
@@ -13,32 +13,14 @@ GEM
|
|
13
13
|
crack (0.4.5)
|
14
14
|
rexml
|
15
15
|
diff-lcs (1.5.0)
|
16
|
-
faraday (
|
17
|
-
faraday-
|
18
|
-
|
19
|
-
|
20
|
-
faraday-httpclient (~> 1.0)
|
21
|
-
faraday-multipart (~> 1.0)
|
22
|
-
faraday-net_http (~> 1.0)
|
23
|
-
faraday-net_http_persistent (~> 1.0)
|
24
|
-
faraday-patron (~> 1.0)
|
25
|
-
faraday-rack (~> 1.0)
|
26
|
-
faraday-retry (~> 1.0)
|
27
|
-
ruby2_keywords (>= 0.0.4)
|
28
|
-
faraday-em_http (1.0.0)
|
29
|
-
faraday-em_synchrony (1.0.0)
|
30
|
-
faraday-excon (1.1.0)
|
31
|
-
faraday-httpclient (1.0.1)
|
32
|
-
faraday-multipart (1.0.4)
|
33
|
-
multipart-post (~> 2)
|
34
|
-
faraday-net_http (1.0.1)
|
35
|
-
faraday-net_http_persistent (1.2.0)
|
36
|
-
faraday-patron (1.0.0)
|
37
|
-
faraday-rack (1.0.0)
|
38
|
-
faraday-retry (1.0.3)
|
16
|
+
faraday (2.9.0)
|
17
|
+
faraday-net_http (>= 2.0, < 3.2)
|
18
|
+
faraday-net_http (3.1.0)
|
19
|
+
net-http
|
39
20
|
hashdiff (1.0.1)
|
40
21
|
json (2.6.3)
|
41
|
-
|
22
|
+
net-http (0.4.1)
|
23
|
+
uri
|
42
24
|
parallel (1.23.0)
|
43
25
|
parser (3.2.2.3)
|
44
26
|
ast (~> 2.4.1)
|
@@ -85,19 +67,20 @@ GEM
|
|
85
67
|
rubocop-capybara (~> 2.17)
|
86
68
|
rubocop-factory_bot (~> 2.22)
|
87
69
|
ruby-progressbar (1.13.0)
|
88
|
-
ruby2_keywords (0.0.5)
|
89
70
|
unicode-display_width (2.4.2)
|
71
|
+
uri (0.13.0)
|
90
72
|
webmock (3.18.1)
|
91
73
|
addressable (>= 2.8.0)
|
92
74
|
crack (>= 0.3.2)
|
93
75
|
hashdiff (>= 0.4.0, < 2.0.0)
|
94
76
|
|
95
77
|
PLATFORMS
|
78
|
+
x86_64-darwin-20
|
96
79
|
x86_64-darwin-22
|
97
80
|
x86_64-linux
|
98
81
|
|
99
82
|
DEPENDENCIES
|
100
|
-
faraday (
|
83
|
+
faraday (>= 2.0.1)
|
101
84
|
lightcast-ruby!
|
102
85
|
rake (~> 13.0.6)
|
103
86
|
rspec (~> 3.12.0)
|
data/README.md
CHANGED
@@ -1,12 +1,13 @@
|
|
1
|
+
[![Gem Version](https://badge.fury.io/rb/lightcast-ruby.svg)](https://badge.fury.io/rb/lightcast-ruby)
|
1
2
|
[![CircleCI](https://dl.circleci.com/status-badge/img/gh/riipen/lightcast-ruby/tree/main.svg?style=svg)](https://dl.circleci.com/status-badge/redirect/gh/riipen/lightcast-ruby/tree/main)
|
2
3
|
|
3
4
|
# Lightcast Ruby
|
4
5
|
|
5
6
|
An API client for the Lightcast REST APIs in ruby.
|
6
7
|
|
7
|
-
Lightcast APIs documentation can be found here:
|
8
|
+
Lightcast Classification APIs documentation can be found here:
|
8
9
|
|
9
|
-
https://docs.lightcast.dev/apis
|
10
|
+
https://docs.lightcast.dev/apis/classification
|
10
11
|
|
11
12
|
## Installation
|
12
13
|
|
@@ -28,7 +29,7 @@ Create your client
|
|
28
29
|
client = Lightcast::Client.new(
|
29
30
|
client_id: '123ABC'
|
30
31
|
client_secret: '456DEF'
|
31
|
-
scope: '
|
32
|
+
scope: 'classifications_api',
|
32
33
|
)
|
33
34
|
```
|
34
35
|
|
@@ -45,7 +46,7 @@ Now you can make use of any of your available APIs for your client.
|
|
45
46
|
You can access the skills API via
|
46
47
|
|
47
48
|
```ruby
|
48
|
-
client.skills(version: '
|
49
|
+
client.skills(version: '9.0.0', release: '2024.7')
|
49
50
|
```
|
50
51
|
|
51
52
|
where the optional version is any valid version.
|
@@ -55,10 +56,10 @@ where the optional version is any valid version.
|
|
55
56
|
Extract skills from plain text.
|
56
57
|
|
57
58
|
```ruby
|
58
|
-
|
59
|
+
skills.extract(text:'computer science is a cool thing to study')
|
59
60
|
```
|
60
61
|
|
61
|
-
[API docs](https://docs.lightcast.dev/apis/
|
62
|
+
[API docs](https://docs.lightcast.dev/apis/classification#post-extract-skills)
|
62
63
|
|
63
64
|
#### Skills Get
|
64
65
|
|
@@ -68,27 +69,46 @@ Get a single skill.
|
|
68
69
|
client.skills.get(123)
|
69
70
|
```
|
70
71
|
|
71
|
-
[API docs](https://docs.lightcast.dev/apis/
|
72
|
+
[API docs](https://docs.lightcast.dev/apis/classification#get-get-a-concept-by-id)
|
73
|
+
|
74
|
+
#### Skills List
|
75
|
+
|
76
|
+
List skills.
|
77
|
+
|
78
|
+
```ruby
|
79
|
+
client.skills.post(
|
80
|
+
fields: ['name'],
|
81
|
+
filter: {
|
82
|
+
level: ['2'],
|
83
|
+
id: [
|
84
|
+
"someId",
|
85
|
+
"anotherId"
|
86
|
+
]
|
87
|
+
},
|
88
|
+
limit: 5)
|
89
|
+
```
|
90
|
+
|
91
|
+
[API docs](https://docs.lightcast.dev/apis/classification#post-list-requested-taxonomy-concepts)
|
72
92
|
|
73
93
|
#### Skills Related
|
74
94
|
|
75
95
|
Get related skills from provided skills.
|
76
96
|
|
77
97
|
```ruby
|
78
|
-
client.related.get(ids: ['12345', 'abcde'])
|
98
|
+
client.related.get(ids: ['12345', 'abcde'], relationType: 'sibling')
|
79
99
|
```
|
80
100
|
|
81
|
-
[API docs](https://docs.lightcast.dev/apis/
|
101
|
+
[API docs](https://docs.lightcast.dev/apis/classification#post-list-requested-taxonomy-concepts)
|
82
102
|
|
83
103
|
#### Skills Status
|
84
104
|
|
85
|
-
Get the status of the
|
105
|
+
Get the status of the classifications API.
|
86
106
|
|
87
107
|
```ruby
|
88
108
|
client.skills.status
|
89
109
|
```
|
90
110
|
|
91
|
-
[API docs](https://docs.lightcast.dev/apis/
|
111
|
+
[API docs](https://docs.lightcast.dev/apis/classification#get-get-service-status)
|
92
112
|
|
93
113
|
### Errors
|
94
114
|
|
@@ -108,4 +128,4 @@ Any error code returned by the Lightcast API will result in one of the following
|
|
108
128
|
|
109
129
|
## License
|
110
130
|
|
111
|
-
Copyright (C) 2023 Riipen. See [LICENSE](https://github.com/riipen/lightcast-ruby/blob/master/LICENSE.md) for details.
|
131
|
+
Copyright (C) 2023 Riipen. See [LICENSE](https://github.com/riipen/lightcast-ruby/blob/master/LICENSE.md) for details.
|
@@ -7,7 +7,7 @@ module Lightcast
|
|
7
7
|
include Lightcast::Authentication
|
8
8
|
|
9
9
|
BASE_URL_AUTH = 'https://auth.emsicloud.com'
|
10
|
-
BASE_URL_SERVICES = 'https://
|
10
|
+
BASE_URL_SERVICES = 'https://classification.emsicloud.com'
|
11
11
|
|
12
12
|
def initialize(client_id:, client_secret:, scope:)
|
13
13
|
@client_id = client_id
|
@@ -18,15 +18,15 @@ module Lightcast
|
|
18
18
|
end
|
19
19
|
|
20
20
|
def connection_auth
|
21
|
-
Connection.new(url: BASE_URL_AUTH)
|
21
|
+
Connection.new(url: BASE_URL_AUTH, scope: @scope)
|
22
22
|
end
|
23
23
|
|
24
24
|
def connection_services
|
25
25
|
Connection.new(access_token: @access_token, url: BASE_URL_SERVICES)
|
26
26
|
end
|
27
27
|
|
28
|
-
def skills(version: '
|
29
|
-
@skills ||= Lightcast::Services::Skills.new(client: self, version: version)
|
28
|
+
def skills(version: '9.0.0', release: '2024.7')
|
29
|
+
@skills ||= Lightcast::Services::Skills.new(client: self, version: version, release: release)
|
30
30
|
end
|
31
31
|
end
|
32
32
|
end
|
@@ -6,9 +6,10 @@ module Lightcast
|
|
6
6
|
class Connection
|
7
7
|
attr_accessor :access_token, :url
|
8
8
|
|
9
|
-
def initialize(url:, access_token: nil)
|
9
|
+
def initialize(url:, access_token: nil, scope: 'classification_api')
|
10
10
|
@access_token = access_token
|
11
11
|
@url = url
|
12
|
+
@scope = scope
|
12
13
|
end
|
13
14
|
|
14
15
|
def delete(path, **params)
|
@@ -3,27 +3,32 @@
|
|
3
3
|
module Lightcast
|
4
4
|
module Services
|
5
5
|
class Skills
|
6
|
-
def initialize(client:, version:)
|
6
|
+
def initialize(client:, version:, release:)
|
7
7
|
@client = client
|
8
8
|
@version = version
|
9
|
+
@release = release
|
9
10
|
end
|
10
11
|
|
11
|
-
def extract(
|
12
|
+
def extract(**params)
|
12
13
|
@client.connection_services.post(
|
13
|
-
"/
|
14
|
+
"/classifications/#{@release}/skills/extract", **params
|
14
15
|
)
|
15
16
|
end
|
16
17
|
|
17
18
|
def get(id)
|
18
|
-
@client.connection_services.get("/skills/versions/#{@version}/
|
19
|
+
@client.connection_services.get("/taxonomies/skills/versions/#{@version}/concepts/#{id}")
|
20
|
+
end
|
21
|
+
|
22
|
+
def list(**params)
|
23
|
+
@client.connection_services.post("/taxonomies/skills/versions/#{@version}/concepts", **params)
|
19
24
|
end
|
20
25
|
|
21
26
|
def related(**params)
|
22
|
-
@client.connection_services.post("/skills/versions/#{@version}/
|
27
|
+
@client.connection_services.post("/taxonomies/skills/versions/#{@version}/relations", **params)
|
23
28
|
end
|
24
29
|
|
25
30
|
def status
|
26
|
-
@client.connection_services.get('/
|
31
|
+
@client.connection_services.get('/status')
|
27
32
|
end
|
28
33
|
end
|
29
34
|
end
|
metadata
CHANGED
@@ -1,35 +1,29 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: lightcast-ruby
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1
|
4
|
+
version: 0.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jordan Ell
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
11
|
+
date: 2024-04-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - "~>"
|
18
|
-
- !ruby/object:Gem::Version
|
19
|
-
version: '1.0'
|
20
17
|
- - ">="
|
21
18
|
- !ruby/object:Gem::Version
|
22
|
-
version:
|
19
|
+
version: 2.0.1
|
23
20
|
type: :runtime
|
24
21
|
prerelease: false
|
25
22
|
version_requirements: !ruby/object:Gem::Requirement
|
26
23
|
requirements:
|
27
|
-
- - "~>"
|
28
|
-
- !ruby/object:Gem::Version
|
29
|
-
version: '1.0'
|
30
24
|
- - ">="
|
31
25
|
- !ruby/object:Gem::Version
|
32
|
-
version:
|
26
|
+
version: 2.0.1
|
33
27
|
description: Access the Lightcast REST API.
|
34
28
|
email:
|
35
29
|
executables: []
|