lightcast-ruby 0.1.0 → 0.2.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 +10 -0
- data/Gemfile.lock +2 -1
- 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 +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c8f0f6be739b285cd3aeb40d4ee2b51dfc46c5086a5412b5e936fe2ac48d1eec
|
4
|
+
data.tar.gz: 50cd701405c0df4c3b66305322c7c29f126816298b3dcee987ebdb65c3534a05
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 723cd5b937a35f2ec89d9b5d407447cf2f2fc39bd43775e438af5a95d3f2d2a7fafb14e3069d7fc56ee6c48495053a4ce7f28269186e84e46b13ab9b550c4139
|
7
|
+
data.tar.gz: 014d028aad150946678e64d08b0eaac5cd9dd4e8045f942761113a7c29374d40eb06ba0a61816dfdbca456a26ba9f6695039acd8d3ef31ac63354fb536bd30a2
|
data/CHANGELOG.md
CHANGED
data/Gemfile.lock
CHANGED
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,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: lightcast-ruby
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
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
|