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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 6e84099140e62596cbb9183473bfebee944442e8dbedc4fac70b8c5935c168c1
4
- data.tar.gz: a00a7882cd0025d56927bf3b8b695904d168e7bfc347478f6d770ed8667c9b7b
3
+ metadata.gz: c8f0f6be739b285cd3aeb40d4ee2b51dfc46c5086a5412b5e936fe2ac48d1eec
4
+ data.tar.gz: 50cd701405c0df4c3b66305322c7c29f126816298b3dcee987ebdb65c3534a05
5
5
  SHA512:
6
- metadata.gz: '08905bbcf66ab46fbc0fd337c6ad54aa8bdc8416f1c915d400f871f91e61fa9a80ee2bcf8417bfb8e1df3356f2d862b829666a82846a8e8a3fada84a615ce3b4'
7
- data.tar.gz: dfc54efac8196b4c12f3a439b62dc4ac8f24c607085ca83ada13c9f5a430e9793dbf32bfc490a0cc60ade9755e628f2c9550ad55d9ba9f187e3a8e1590b6c361
6
+ metadata.gz: 723cd5b937a35f2ec89d9b5d407447cf2f2fc39bd43775e438af5a95d3f2d2a7fafb14e3069d7fc56ee6c48495053a4ce7f28269186e84e46b13ab9b550c4139
7
+ data.tar.gz: 014d028aad150946678e64d08b0eaac5cd9dd4e8045f942761113a7c29374d40eb06ba0a61816dfdbca456a26ba9f6695039acd8d3ef31ac63354fb536bd30a2
data/CHANGELOG.md CHANGED
@@ -1 +1,11 @@
1
+ ## v0.2.0
2
+
3
+ Switched from using of Skills API to Classification API
4
+
5
+ ## v0.1.0
6
+
7
+ Initial release of the gem.
8
+
9
+ - Added basic skills API endpoints
10
+
1
11
  ## [Unreleased]
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- lightcast-ruby (0.1.0)
4
+ lightcast-ruby (0.2.0)
5
5
  faraday (~> 1.0, >= 1.0.0)
6
6
 
7
7
  GEM
@@ -93,6 +93,7 @@ GEM
93
93
  hashdiff (>= 0.4.0, < 2.0.0)
94
94
 
95
95
  PLATFORMS
96
+ x86_64-darwin-20
96
97
  x86_64-darwin-22
97
98
  x86_64-linux
98
99
 
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: 'profiles:us',
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: 'latest')
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
- client.skills.extract({ text: 'blah blah blah' }, { language: 'en', confidence_threshold: 0.5 })
59
+ skills.extract(text:'computer science is a cool thing to study')
59
60
  ```
60
61
 
61
- [API docs](https://docs.lightcast.dev/apis/skills#versions-version-extract)
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/skills#versions-version-skills-skill_id)
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/skills#versions-version-related)
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 skills API.
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/skills#status)
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,8 @@ module Lightcast
7
7
  {
8
8
  client_id: @client_id,
9
9
  client_secret: @client_secret,
10
- grant_type: 'client_credentials'
10
+ grant_type: 'client_credentials',
11
+ scope: @scope
11
12
  },
12
13
  {
13
14
  body: :form,
@@ -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://emsiservices.com'
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: 'latest')
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(body = {}, query = { language: 'en', confidence_threshold: 0 })
12
+ def extract(**params)
12
13
  @client.connection_services.post(
13
- "/skills/versions/#{@version}/extract?language=#{query[:language]}&confidenceThreshold=#{query[:confidence_threshold]}", body
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}/skills/#{id}")
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}/related", **params)
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('/skills/status')
31
+ @client.connection_services.get('/status')
27
32
  end
28
33
  end
29
34
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Lightcast
4
- VERSION = '0.1.0'
4
+ VERSION = '0.2.0'
5
5
  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.1.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-01-16 00:00:00.000000000 Z
11
+ date: 2024-04-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday