lib/oneaccess/api/v3_0/providers.rb in oneaccess-1.2.0 vs lib/oneaccess/api/v3_0/providers.rb in oneaccess-1.3.0
- old
+ new
@@ -1,31 +1,30 @@
# frozen_string_literal: true
-require_relative "../../response/inducement_response"
-require_relative "../../response/providers_users_details_response"
+require_relative '../../response/inducement_response'
+require_relative '../../response/providers_users_details_response'
module ONEAccess
module API
module V3_0
class Providers < Base
- api_path "/providers"
+ api_path '/providers'
class << self
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
+ receivedate: receive_date,
}.reject { |_, v| v.nil? }
- response = send_post("inducements", inducement: params)
+ response = send_post('inducements', inducement: params)
Response::InducementResponse.from_json(response.body)
end
- # rubocop:disable Metrics/MethodLength
def users_details(
buy_side_org_id:,
provider_id:,
contract_status_id: nil,
user_id: nil,
@@ -40,31 +39,30 @@
contractstatusid: contract_status_id,
userid: user_id,
useremail: user_email,
userreverseentitlementstatus: user_reverse_entitlement_status,
vendorid: vendor_id,
- reverseentitlementstatus: reverse_entitlement_status
+ reverseentitlementstatus: reverse_entitlement_status,
}.compact!
resp = send_get("GetProviderUserDetails?providerid=#{comma_separated_values(provider_id)}", params)
Response::ProvidersUsersDetailsResponse.from_json(resp.body)
end
- # rubocop:enable Metrics/MethodLength
private
# 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'
def comma_separated_values(values)
- values = values.split(",") if values.is_a?(String)
+ 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.join(',')
end
values
end
end
end