yatish27 / salesforce_bulk_api

A Ruby client for Salesforce's bulk API
MIT License
77 stars 99 forks source link

Custom Domain Patch #66

Open adasgupta opened 7 years ago

adasgupta commented 7 years ago
  1. Modified the parse_instance() method inside SalesforecBulkApi Module to accommodate domain names that start with 2 alphabets and are followed by digits.

If the domain name is something like 'ab12cdef' and the salesforce instance url is 'ab12cdef.my.salesforce.com'. The original code would evaluate the instance to ab12.salesforce.com That would result in "Failed to open TCP connection to ab12.salesforce.com:443 (getaddrinfo: Name or service not known)" error as the host could not be resolved.

I have changed the evaluation of the @instance as follows:

@instance = @server_url.match(/https:\/\/[a-z]{2}[0-9]{1,2}./).to_s.gsub("https://","").split(".")[0] @instance = @server_url.split(".salesforce.com")[0].split("://")[1] if @instance.nil? || @instance.empty?

  1. Added instructions to the README to show OAuth2 mode of authentication and the mandatory options to pass to restforce client while using client.authenticate!