ibm_tools-people 1.1.0 → 1.1.3

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 4c524e17db9198566e6ae5884cd64653a62b05325b560c05e4e8f57b9ac3526a
4
- data.tar.gz: 8156b94d0aab35e6cd98078e40160bed249a945453dc4149e014093fd970d465
3
+ metadata.gz: fb0fccc2f987f527c97a496971b88c5a92b7fd20f0960f28ba36155b5e77a978
4
+ data.tar.gz: cedca628d2f05bbe5756cc87e9eb6f5fbffa86826b97f8394750a68e87dbbfc9
5
5
  SHA512:
6
- metadata.gz: db572c5d69b6b71c783aa7c878f0f1bc4fa00f0290505883c080815302682a58fa9ad7ab509870ac95774e3d7cc2427415c423656d37116d677749cd688d8af8
7
- data.tar.gz: 3dff16c40a3da2133a0233db918afd09ea3569c5b7c375f53db08f2a5e390eb8b33dd374cbc7745dd870b74e9991ccf74e1ce2c0951f15c8c6c314e903b0a138
6
+ metadata.gz: ac471169819e8c26f9de5e8e410d61566b3a25a334828202c4a64d56a7a9ae823007b1949c899f747a1b6081a8d970ca158e465497f574859604526bb4ec60e3
7
+ data.tar.gz: 9b2c995b1167fdec65d6f46fa6f7b71d137ae7e54db8685bd3b1e4128dff69bd83b27560a78fd8bec8c1d1e45bc1f3cf4060ddaf34a96ff4cb89d78e047dd4fc
data/README.md CHANGED
@@ -115,7 +115,7 @@ Since there are different kind of ways to search the user and to ensure readabil
115
115
  | query | String | `IbmTools::People.info(query: 'John Doe')`
116
116
  | token | String | `token: nbvcsw23456yhbvfrt6789olkmnhyu8i9olkmnhgtrdf`*
117
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`
118
+ > Token can be used as a argument of the module, but it will also look for the environment variable `IBM_PEOPLE_API_KEY`
119
119
 
120
120
  #### Options (`optional`)
121
121
 
@@ -217,7 +217,7 @@ Since there are different kind of ways to search the user and to ensure readabil
217
217
  | email | String | `IbmTools::People.info(email: 'johndoe@ibm.com')`
218
218
  | token | String | `token: nbvcsw23456yhbvfrt6789olkmnhyu8i9olkmnhgtrdf`*
219
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`
220
+ > Token can be used as a argument of the module, but it will also look for the environment variable `IBM_PEOPLE_API_KEY`
221
221
 
222
222
  #### Schemas
223
223
 
@@ -245,7 +245,7 @@ Since there are different kind of ways to search the user and to ensure readabil
245
245
  | email | String | `IbmTools::People.info(email: 'johndoe@ibm.com')`
246
246
  | token | String | `token: nbvcsw23456yhbvfrt6789olkmnhyu8i9olkmnhgtrdf`*
247
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`
248
+ > Token can be used as a argument of the module, but it will also look for the environment variable `IBM_PEOPLE_API_KEY`
249
249
 
250
250
 
251
251
  #### Schemas
@@ -274,7 +274,7 @@ Since there are different kind of ways to search the user and to ensure readabil
274
274
  | email | String | `IbmTools::People.info(email: 'johndoe@ibm.com')`
275
275
  | token | String | `token: nbvcsw23456yhbvfrt6789olkmnhyu8i9olkmnhgtrdf`*
276
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`
277
+ > Token can be used as a argument of the module, but it will also look for the environment variable `IBM_PEOPLE_API_KEY`
278
278
 
279
279
  #### Schemas
280
280
 
@@ -32,7 +32,9 @@ module IbmTools
32
32
  end
33
33
 
34
34
  def result_for(query_term, remap)
35
- parsed_users(remap).select { |parsed_user| parsed_user&.values&.include? query_term }.first
35
+ parsed_users(remap).select do |parsed_user|
36
+ parsed_user&.values.map{ |el| el.to_s.downcase }&.include? query_term.to_s.downcase
37
+ end.first
36
38
  rescue Exception => e
37
39
  raise IbmTools::People::Profile::SearchError, e.message
38
40
  end
@@ -5,7 +5,8 @@ module IbmTools
5
5
  module People
6
6
  module Profile
7
7
  class Skills < Search
8
- def initialize(query)
8
+ def initialize(query, token = nil)
9
+ @token = token
9
10
  @response = HTTParty.get(uri(query: query), header: headers)
10
11
  end
11
12
 
@@ -21,6 +22,7 @@ module IbmTools
21
22
 
22
23
  def headers
23
24
  {
25
+ 'X-UP-API-KEY': @token,
24
26
  'Content-Type': 'application/json',
25
27
  accept: 'application/json'
26
28
  }
@@ -5,7 +5,8 @@ module IbmTools
5
5
  module People
6
6
  module Profile
7
7
  class Teams < Search
8
- def initialize(query)
8
+ def initialize(query, token = nil)
9
+ @token = token
9
10
  @response = HTTParty.get(uri(query: query), header: headers)
10
11
  end
11
12
 
@@ -21,6 +22,7 @@ module IbmTools
21
22
 
22
23
  def headers
23
24
  {
25
+ 'X-UP-API-KEY': @token,
24
26
  'Content-Type': 'application/json',
25
27
  accept: 'application/json'
26
28
  }
@@ -6,8 +6,9 @@ module IbmTools
6
6
  module People
7
7
  module Profile
8
8
  class Typeahead < Search
9
- def initialize(query, serial: '000000', limit: 10, start: 0)
9
+ def initialize(query, token = nil, serial: '000000', limit: 10, start: 0)
10
10
  uri = "#{IbmTools::People::BLUEPAGES_V1_URI}?userId=#{serial}&rows=#{limit}&start=#{start}&query=#{query}&searchConfig=typeahead_search"
11
+ @token = token
11
12
  @response = HTTParty.get(uri, header: headers, format: :plain)
12
13
  end
13
14
 
@@ -19,6 +20,7 @@ module IbmTools
19
20
 
20
21
  def headers
21
22
  {
23
+ 'X-UP-API-KEY': @token,
22
24
  'Content-Type': 'application/json',
23
25
  accept: 'application/json'
24
26
  }
@@ -2,7 +2,7 @@
2
2
 
3
3
  module IbmTools
4
4
  module People
5
- VERSION = "1.1.0"
5
+ VERSION = "1.1.3"
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
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.1.0
4
+ version: 1.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Thiago Silva
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2024-01-24 00:00:00.000000000 Z
11
+ date: 2024-05-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: httparty