ibm_tools-people 1.0.4 → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +26 -2
- data/ibm_tools-people.gemspec +3 -0
- data/lib/ibm_tools/people/arguments.rb +6 -0
- data/lib/ibm_tools/people/profile/fetch.rb +3 -1
- data/lib/ibm_tools/people/profile/search.rb +2 -2
- data/lib/ibm_tools/people/version.rb +1 -1
- data/lib/ibm_tools/people.rb +7 -6
- metadata +3 -3
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 4c524e17db9198566e6ae5884cd64653a62b05325b560c05e4e8f57b9ac3526a
|
|
4
|
+
data.tar.gz: 8156b94d0aab35e6cd98078e40160bed249a945453dc4149e014093fd970d465
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: db572c5d69b6b71c783aa7c878f0f1bc4fa00f0290505883c080815302682a58fa9ad7ab509870ac95774e3d7cc2427415c423656d37116d677749cd688d8af8
|
|
7
|
+
data.tar.gz: 3dff16c40a3da2133a0233db918afd09ea3569c5b7c375f53db08f2a5e390eb8b33dd374cbc7745dd870b74e9991ccf74e1ce2c0951f15c8c6c314e903b0a138
|
data/README.md
CHANGED
|
@@ -1,9 +1,17 @@
|
|
|
1
1
|
# IMPORTANT
|
|
2
|
+
|
|
3
|
+
## Comunicate 1
|
|
4
|
+
|
|
5
|
+
Due to the new mandatory change regarding the new Tokenization of the API we launch the version 1.1, now aside from the default parameters, we will have to request your token via boarding process and then use it with the API, details regarding the api usage, were updated, but if you want to know more about the tokenization, check the [FAQ](https://w3.ibm.com/w3publisher/w3/people/unified-profile-apis/api-key-faq).
|
|
6
|
+
|
|
7
|
+
## Comunicate 2
|
|
8
|
+
|
|
2
9
|
Due to the `case-2022-05-05-1450` opened by the __CSIRT team__ we had to migrate from the Public Github to the Github Enterprise, this change forced us to change the name of the gem.
|
|
3
10
|
|
|
4
11
|
Since the ruby does require the name of the gem to be used as the name of the class. Check below what changed:
|
|
5
12
|
|
|
6
|
-
|
|
13
|
+
### Action 1 - Gemfile
|
|
14
|
+
|
|
7
15
|
Change the name of the gem to the new one in your Gemfile file and hit `bundle install` on your terminal.
|
|
8
16
|
```ruby
|
|
9
17
|
# From
|
|
@@ -13,7 +21,8 @@ gem 'rails_ibm-uprofile', '~> 0.3.2', require: 'rails_ibm/uprofile'
|
|
|
13
21
|
gem 'ibm_tools-people', '~> 1.0.0', require: 'ibm_tools/people'
|
|
14
22
|
```
|
|
15
23
|
|
|
16
|
-
|
|
24
|
+
### Action 2 - Usage
|
|
25
|
+
|
|
17
26
|
Change everywhere you have within your application from the old class name to the new one.
|
|
18
27
|
```ruby
|
|
19
28
|
# From
|
|
@@ -27,6 +36,8 @@ From now on it should be transparent and require no other action.
|
|
|
27
36
|
_________
|
|
28
37
|
<br><br>
|
|
29
38
|
|
|
39
|
+
|
|
40
|
+
|
|
30
41
|
# IBM Tools
|
|
31
42
|
|
|
32
43
|
Welcome to your Rais IBM Tools module! This gem intend to provide you some fetures used on IBM Web applications __*__.
|
|
@@ -102,6 +113,9 @@ Since there are different kind of ways to search the user and to ensure readabil
|
|
|
102
113
|
| email | String | `IbmTools::People.info(email: 'johndoe@ibm.com')`
|
|
103
114
|
| emails | Array | `IbmTools::People.info(emails: ['johndoe@ibm.com', 'janedoe@ibm.com'])`
|
|
104
115
|
| query | String | `IbmTools::People.info(query: 'John Doe')`
|
|
116
|
+
| token | String | `token: nbvcsw23456yhbvfrt6789olkmnhyu8i9olkmnhgtrdf`*
|
|
117
|
+
|
|
118
|
+
> Token can be used as a argument of the module, but it will also look for the envrionment variable `IBM_PEOPLE_API_KEY`
|
|
105
119
|
|
|
106
120
|
#### Options (`optional`)
|
|
107
121
|
|
|
@@ -201,6 +215,9 @@ Since there are different kind of ways to search the user and to ensure readabil
|
|
|
201
215
|
| --- | --- | ---
|
|
202
216
|
| uid | String | `IbmTools::People.info(uid: '000000000')`
|
|
203
217
|
| email | String | `IbmTools::People.info(email: 'johndoe@ibm.com')`
|
|
218
|
+
| token | String | `token: nbvcsw23456yhbvfrt6789olkmnhyu8i9olkmnhgtrdf`*
|
|
219
|
+
|
|
220
|
+
> Token can be used as a argument of the module, but it will also look for the envrionment variable `IBM_PEOPLE_API_KEY`
|
|
204
221
|
|
|
205
222
|
#### Schemas
|
|
206
223
|
|
|
@@ -226,6 +243,10 @@ Since there are different kind of ways to search the user and to ensure readabil
|
|
|
226
243
|
| --- | --- | ---
|
|
227
244
|
| uid | String | `IbmTools::People.info(uid: '000000000')`
|
|
228
245
|
| email | String | `IbmTools::People.info(email: 'johndoe@ibm.com')`
|
|
246
|
+
| token | String | `token: nbvcsw23456yhbvfrt6789olkmnhyu8i9olkmnhgtrdf`*
|
|
247
|
+
|
|
248
|
+
> Token can be used as a argument of the module, but it will also look for the envrionment variable `IBM_PEOPLE_API_KEY`
|
|
249
|
+
|
|
229
250
|
|
|
230
251
|
#### Schemas
|
|
231
252
|
|
|
@@ -251,6 +272,9 @@ Since there are different kind of ways to search the user and to ensure readabil
|
|
|
251
272
|
| --- | --- | ---
|
|
252
273
|
| uid | String | `IbmTools::People.info(uid: '000000000')`
|
|
253
274
|
| email | String | `IbmTools::People.info(email: 'johndoe@ibm.com')`
|
|
275
|
+
| token | String | `token: nbvcsw23456yhbvfrt6789olkmnhyu8i9olkmnhgtrdf`*
|
|
276
|
+
|
|
277
|
+
> Token can be used as a argument of the module, but it will also look for the envrionment variable `IBM_PEOPLE_API_KEY`
|
|
254
278
|
|
|
255
279
|
#### Schemas
|
|
256
280
|
|
data/ibm_tools-people.gemspec
CHANGED
|
@@ -36,4 +36,7 @@ Gem::Specification.new do |spec|
|
|
|
36
36
|
|
|
37
37
|
# For more information and examples about making a new gem, checkout our
|
|
38
38
|
# guide at: https://bundler.io/guides/creating_gem.html
|
|
39
|
+
|
|
40
|
+
# For troubleshooting:
|
|
41
|
+
# rm -rf gem_name-version.gem && gem build gem_name.gemspec && gem install ./gem_name-version.gem
|
|
39
42
|
end
|
|
@@ -15,6 +15,7 @@ module IbmTools
|
|
|
15
15
|
raise SyntaxError.new description: "Invalid Argument. #{DOC_LINK}" if invalid_options
|
|
16
16
|
raise SyntaxError.new description: "More than one required Argument. #{DOC_LINK}" if multiple
|
|
17
17
|
raise SyntaxError.new description: "Missing required Argument. #{DOC_LINK}" if missing
|
|
18
|
+
raise SyntaxError.new description: "Missing TOKEN argument. #{DOC_LINK}" if missing_token
|
|
18
19
|
raise TypeError.new description: "Invalid Argument type. #{DOC_LINK}" if invalid_type || unmatch_type
|
|
19
20
|
|
|
20
21
|
true
|
|
@@ -30,6 +31,11 @@ module IbmTools
|
|
|
30
31
|
value == nil
|
|
31
32
|
end
|
|
32
33
|
|
|
34
|
+
def missing_token
|
|
35
|
+
return false if @options.keys.include?(:query)
|
|
36
|
+
@options[:token] == nil
|
|
37
|
+
end
|
|
38
|
+
|
|
33
39
|
def multiple
|
|
34
40
|
allowed = %i[uid uids email emails query]
|
|
35
41
|
@options.keys.select { |k| allowed.include?(k) }.size > 1
|
|
@@ -6,8 +6,9 @@ module IbmTools
|
|
|
6
6
|
module People
|
|
7
7
|
module Profile
|
|
8
8
|
class Fetch
|
|
9
|
-
def initialize(uri:)
|
|
9
|
+
def initialize(uri:, token:)
|
|
10
10
|
@uri = uri
|
|
11
|
+
@token = token
|
|
11
12
|
end
|
|
12
13
|
|
|
13
14
|
def execute(query:)
|
|
@@ -44,6 +45,7 @@ module IbmTools
|
|
|
44
45
|
|
|
45
46
|
def headers
|
|
46
47
|
{
|
|
48
|
+
'X-UP-API-KEY': @token,
|
|
47
49
|
'Content-Type': 'application/json',
|
|
48
50
|
accept: 'application/json'
|
|
49
51
|
}
|
|
@@ -10,10 +10,10 @@ module IbmTools
|
|
|
10
10
|
class Search < Mapper
|
|
11
11
|
class IbmTools::People::Profile::SearchError < StandardError; end
|
|
12
12
|
|
|
13
|
-
def initialize(query)
|
|
13
|
+
def initialize(query, token = nil)
|
|
14
14
|
@query = [query].flatten
|
|
15
15
|
|
|
16
|
-
fetch = IbmTools::People::Profile::Fetch.new(uri: IbmTools::People::BLUEPAGES_V3_URI)
|
|
16
|
+
fetch = IbmTools::People::Profile::Fetch.new(uri: IbmTools::People::BLUEPAGES_V3_URI, token: token)
|
|
17
17
|
@response = fetch.execute(query: @query)
|
|
18
18
|
end
|
|
19
19
|
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
module IbmTools
|
|
4
4
|
module People
|
|
5
|
-
VERSION = "1.0
|
|
5
|
+
VERSION = "1.1.0"
|
|
6
6
|
BLUEPAGES_V3_URI = "https://w3-unifiedprofile-api.dal1a.cirrus.ibm.com/v3/profiles"
|
|
7
7
|
BLUEPAGES_V1_URI = "https://w3-unifiedprofile-search.dal1a.cirrus.ibm.com/search"
|
|
8
8
|
EMAIL_REGEX = %r{\A([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})\Z}i
|
data/lib/ibm_tools/people.rb
CHANGED
|
@@ -15,30 +15,31 @@ module IbmTools
|
|
|
15
15
|
DOC_LINK = "Please refer to 'https://github.com/niightly/rails_ibm-uprofile/blob/master/README.md#usage' for more details.'".freeze
|
|
16
16
|
|
|
17
17
|
def self.info(options = {})
|
|
18
|
+
options[:token] = options[:token] || ENV['IBM_PEOPLE_API_KEY']
|
|
18
19
|
args = verify(options)
|
|
19
20
|
|
|
20
21
|
if options.include?(:emails) || options.include?(:email)
|
|
21
|
-
IbmTools::People::Profile::Email.new([options[:emails] || options[:email]].flatten).results(**args.filter(%i[parsed remap]))
|
|
22
|
+
IbmTools::People::Profile::Email.new([options[:emails] || options[:email]].flatten, options[:token]).results(**args.filter(%i[parsed remap]))
|
|
22
23
|
elsif options.include?(:uids) || options.include?(:uid)
|
|
23
|
-
IbmTools::People::Profile::Uid.new([options[:uids] || options[:uid]].flatten).results(**args.filter(%i[parsed remap]))
|
|
24
|
+
IbmTools::People::Profile::Uid.new([options[:uids] || options[:uid]].flatten, options[:token]).results(**args.filter(%i[parsed remap]))
|
|
24
25
|
elsif options.include?(:query)
|
|
25
|
-
IbmTools::People::Profile::Typeahead.new(options[:query], **default_params(options)).results(**args.filter(%i[parsed remap detailed array]))
|
|
26
|
+
IbmTools::People::Profile::Typeahead.new(options[:query], options[:token], **default_params(options)).results(**args.filter(%i[parsed remap detailed array]))
|
|
26
27
|
end
|
|
27
28
|
end
|
|
28
29
|
|
|
29
30
|
def self.skills(options = {})
|
|
30
31
|
args = verify(options, single: true)
|
|
31
|
-
IbmTools::People::Profile::Skills.new(options[:uid] || options[:email]).results
|
|
32
|
+
IbmTools::People::Profile::Skills.new(options[:uid] || options[:email], options[:token]).results
|
|
32
33
|
end
|
|
33
34
|
|
|
34
35
|
def self.teams(options = {})
|
|
35
36
|
args = verify(options, single: true)
|
|
36
|
-
IbmTools::People::Profile::Teams.new(options[:uid] || options[:email]).results
|
|
37
|
+
IbmTools::People::Profile::Teams.new(options[:uid] || options[:email], options[:token]).results
|
|
37
38
|
end
|
|
38
39
|
|
|
39
40
|
def self.all(options = {})
|
|
40
41
|
args = verify(options, single: true)
|
|
41
|
-
IbmTools::People::Profile::All.new(options[:uid] || options[:email]).results
|
|
42
|
+
IbmTools::People::Profile::All.new(options[:uid] || options[:email], options[:token]).results
|
|
42
43
|
end
|
|
43
44
|
|
|
44
45
|
private
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: ibm_tools-people
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.0
|
|
4
|
+
version: 1.1.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Thiago Silva
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date:
|
|
11
|
+
date: 2024-01-24 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: httparty
|
|
@@ -95,7 +95,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
95
95
|
- !ruby/object:Gem::Version
|
|
96
96
|
version: '0'
|
|
97
97
|
requirements: []
|
|
98
|
-
rubygems_version: 3.
|
|
98
|
+
rubygems_version: 3.4.15
|
|
99
99
|
signing_key:
|
|
100
100
|
specification_version: 4
|
|
101
101
|
summary: IBM Module - Profile
|