class ONEAccess::API::V3_0::Providers

Public Class Methods

inducements(recipient_user_id:, sender_email:, subject:, email_body:, receive_date:) click to toggle source
# File lib/oneaccess/api/v3_0/providers.rb, line 13
def inducements(recipient_user_id:, sender_email:, subject:, email_body:, receive_date:)
  params = {
    recipientuserid: recipient_user_id,
    senderemail:     sender_email,
    subject:         subject,
    emailbody:       email_body,
    receivedate:     receive_date,
  }.reject { |_, v| v.nil? }

  response = send_post('inducements', inducement: params)
  Response::InducementResponse.from_json(response.body)
end
users_details( buy_side_org_id:, provider_id:, contract_status_id: nil, user_id: nil, user_email: nil, user_reverse_entitlement_status: nil, vendor_id: nil, reverse_entitlement_status: nil ) click to toggle source
# File lib/oneaccess/api/v3_0/providers.rb, line 26
def users_details(
  buy_side_org_id:,
  provider_id:,
  contract_status_id: nil,
  user_id: nil,
  user_email: nil,
  user_reverse_entitlement_status: nil,
  vendor_id: nil,
  reverse_entitlement_status: nil
)

  params = {
    buysideorgid:                 buy_side_org_id,
    contractstatusid:             contract_status_id,
    userid:                       user_id,
    useremail:                    user_email,
    userreverseentitlementstatus: user_reverse_entitlement_status,
    vendorid:                     vendor_id,
    reverseentitlementstatus:     reverse_entitlement_status,
  }.compact!

  resp = send_get("GetProviderUserDetails?providerid=#{comma_separated_values(provider_id)}", params)
  Response::ProvidersUsersDetailsResponse.from_json(resp.body)
end

Private Class Methods

comma_separated_values(values) click to toggle source

We need to diffently handle comma separated values since the RestClient, gem URI encode the commas and this is not supported by the API.

Examples:

1,2$,3

> '1,2%24,3'

'1,2$,3' => '1,2%24,3'

# File lib/oneaccess/api/v3_0/providers.rb, line 59
def comma_separated_values(values)
  values = values.split(',') if values.is_a?(String)
  if values.is_a?(Array)
    values = values.map do |value|
      URI.encode_www_form_component(value)
    end.join(',')
  end
  values
end