Module: IbmTools::People

Defined in:
lib/ibm_tools/people.rb,
lib/ibm_tools/people/async.rb,
lib/ibm_tools/people/version.rb,
lib/ibm_tools/people/arguments.rb,
lib/ibm_tools/people/profile/all.rb,
lib/ibm_tools/people/profile/uid.rb,
lib/ibm_tools/people/profile/email.rb,
lib/ibm_tools/people/profile/fetch.rb,
lib/ibm_tools/people/profile/teams.rb,
lib/ibm_tools/people/profile/mapper.rb,
lib/ibm_tools/people/profile/search.rb,
lib/ibm_tools/people/profile/skills.rb,
lib/ibm_tools/people/profile/typeahead.rb

Defined Under Namespace

Modules: Async, Profile Classes: Arguments, Error

Constant Summary collapse

"Please refer to 'https://github.com/niightly/rails_ibm-uprofile/blob/master/README.md#usage' for more details.'".freeze
VERSION =
"1.1.1"
BLUEPAGES_V3_URI =
"https://w3-unifiedprofile-api.dal1a.cirrus.ibm.com/v3/profiles"
BLUEPAGES_V1_URI =
"https://w3-unifiedprofile-search.dal1a.cirrus.ibm.com/search"
EMAIL_REGEX =
%r{\A([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})\Z}i

Class Method Summary collapse

Class Method Details

.all(options = {}) ⇒ Object



40
41
42
43
# File 'lib/ibm_tools/people.rb', line 40

def self.all(options = {})
  args = verify(options, single: true)
  IbmTools::People::Profile::All.new(options[:uid] || options[:email], options[:token]).results
end

.info(options = {}) ⇒ Object



17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/ibm_tools/people.rb', line 17

def self.info(options = {})
  options[:token] = options[:token] || ENV['IBM_PEOPLE_API_KEY']
  args = verify(options)

  if options.include?(:emails) || options.include?(:email)
    IbmTools::People::Profile::Email.new([options[:emails] || options[:email]].flatten, options[:token]).results(**args.filter(%i[parsed remap]))
  elsif options.include?(:uids) || options.include?(:uid)
    IbmTools::People::Profile::Uid.new([options[:uids] || options[:uid]].flatten, options[:token]).results(**args.filter(%i[parsed remap]))
  elsif options.include?(:query)
    IbmTools::People::Profile::Typeahead.new(options[:query], options[:token], **default_params(options)).results(**args.filter(%i[parsed remap detailed array]))
  end
end

.skills(options = {}) ⇒ Object



30
31
32
33
# File 'lib/ibm_tools/people.rb', line 30

def self.skills(options = {})
  args = verify(options, single: true)
  IbmTools::People::Profile::Skills.new(options[:uid] || options[:email], options[:token]).results
end

.teams(options = {}) ⇒ Object



35
36
37
38
# File 'lib/ibm_tools/people.rb', line 35

def self.teams(options = {})
  args = verify(options, single: true)
  IbmTools::People::Profile::Teams.new(options[:uid] || options[:email], options[:token]).results
end