class IntegrationPoint::Client

Attributes

xml_client[R]
xml_response[R]

Public Instance Methods

Private Instance Methods

build_dps_integration_search_query(xml_values) click to toggle source
# File lib/integration_point/client.rb, line 29
def build_dps_integration_search_query(xml_values)
  {
    'company': empty_string_if_nil(xml_values[:company]),
    'username': empty_string_if_nil(xml_values[:username]),
    'password': empty_string_if_nil(xml_values[:password]),
    'loggedInUser':  empty_string_if_nil(xml_values[:logged_in_user]),
    'companyId': empty_string_if_nil(xml_values[:company_id]),
    'searchType': empty_string_if_nil(xml_values[:search_type]),
    'settingsDescription': empty_string_if_nil(xml_values[:settings_description]),
    'name': empty_string_if_nil(xml_values[:name]),
    'address': empty_string_if_nil(xml_values[:address]),
    'city': empty_string_if_nil(xml_values[:city]),
    'countryCode': determine_country_code(xml_values[:country]),
    'countryStateCode': determine_state_code(xml_values[:state]),
    'postalCode': empty_string_if_nil(xml_values[:postal_code]),
    'dtsSearchFlag': empty_string_if_nil(xml_values[:dts_search_flag]),
    'dtsLastValidatedDate': empty_string_if_nil(xml_values[:dts_last_validated_date]),
    'dtsOverride': empty_string_if_nil(xml_values[:dts_override]),
    'dtsOverrideDate': empty_string_if_nil(xml_values[:dts_override_date]),
    'SearchRefNum': empty_string_if_nil(xml_values[:search_ref_num]),
    'CompanySync': empty_string_if_nil(xml_values[:company_sync])
  }
end
determine_country_code(country) click to toggle source
# File lib/integration_point/client.rb, line 53
def determine_country_code(country)
  return "" if country.nil?

  @country = ISO3166::Country.find_country_by_name(country)
  if @country.nil?
    ""
  else
    @country.alpha2
  end
end
determine_state_code(state) click to toggle source
# File lib/integration_point/client.rb, line 70
def determine_state_code(state)
  return "" if @country.nil?

  states = @country.states
  state_struct = states.detect { |s| s.last.name.downcase == "british columbia".downcase }
  if state_struct.nil?
    ""
  else
    state_struct.first
  end
end
empty_string_if_nil(value) click to toggle source
# File lib/integration_point/client.rb, line 64
def empty_string_if_nil(value)
  return "" if value.nil?

  value
end