module RailsIbm::Uprofile

Constants

BLUEPAGES_V1_URI
BLUEPAGES_V3_URI
EMAIL_REGEX
VERSION

Public Class Methods

all(options = {}) click to toggle source
# File lib/rails_ibm/uprofile.rb, line 39
def self.all(options = {})
  args = verify(options, single: true)
  RailsIbm::Uprofile::Bluepages::All.new(options[:uid] || options[:email]).results
end
info(options = {}) click to toggle source
# File lib/rails_ibm/uprofile.rb, line 17
def self.info(options = {})
  args = verify(options)

  if options.include?(:emails) || options.include?(:email)
    RailsIbm::Uprofile::Bluepages::Email.new([options[:emails] || options[:email]].flatten).results(**args.filter(%i[parsed remap]))
  elsif options.include?(:uids) || options.include?(:uid)
    RailsIbm::Uprofile::Bluepages::Uid.new([options[:uids] || options[:uid]].flatten).results(**args.filter(%i[parsed remap]))
  elsif options.include?(:query)
    RailsIbm::Uprofile::Bluepages::Typeahead.new(options[:query], **default_params(options)).results(**args.filter(%i[parsed remap detailed array]))
  end
end
skills(options = {}) click to toggle source
# File lib/rails_ibm/uprofile.rb, line 29
def self.skills(options = {})
  args = verify(options, single: true)
  RailsIbm::Uprofile::Bluepages::Skills.new(options[:uid] || options[:email]).results
end
teams(options = {}) click to toggle source
# File lib/rails_ibm/uprofile.rb, line 34
def self.teams(options = {})
  args = verify(options, single: true)
  RailsIbm::Uprofile::Bluepages::Teams.new(options[:uid] || options[:email]).results
end

Private Class Methods

default_params(options) click to toggle source
# File lib/rails_ibm/uprofile.rb, line 53
def self.default_params(options)
  { serial: options[:serial] || '000000', limit: options[:limit] || 10, start: options[:start] || 0 }
end
params(options, single) click to toggle source
# File lib/rails_ibm/uprofile.rb, line 57
def self.params(options, single)
  return options unless single
  options.tap { |hs| %i[uids emails].each { |k| hs.delete(k) } }
end
verify(options, single: false) click to toggle source
# File lib/rails_ibm/uprofile.rb, line 46
def self.verify(options, single: false)
  args = RailsIbm::Uprofile::Arguments.new(params(options, single))
  args.validate

  args
end