Class: SalesforceHttpClient::Configuration

Inherits:
Object
  • Object
show all
Includes:
Singleton
Defined in:
lib/salesforce_http_client/configuration.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfiguration

Returns a new instance of Configuration.



32
33
34
35
36
37
38
39
40
41
42
43
44
45
# File 'lib/salesforce_http_client/configuration.rb', line 32

def initialize
  @salesforce_instance_domain = "https://ap.salesforce.com"

  @salesforce_login_url = "https://login.salesforce.com/"
  @salesforce_logout_url = ->() { @salesforce_instance_domain + "/secur/logout.jsp" }

  @salesforce_report_url_format = ->() { @salesforce_instance_domain + '/#{report_id}?export=1&enc=UTF-8&xf=csv' }
  @salesforce_report_id_param = '#{report_id}'

  @http_timeout = 5 * 60 * 1000
  @tmp_dir = './tmp'

  init_logger
end

Instance Attribute Details

#http_timeoutObject

Returns the value of attribute http_timeout.



22
23
24
# File 'lib/salesforce_http_client/configuration.rb', line 22

def http_timeout
  @http_timeout
end

#log_levelObject

Returns the value of attribute log_level.



26
27
28
# File 'lib/salesforce_http_client/configuration.rb', line 26

def log_level
  @log_level
end

#loggerObject

Returns the value of attribute logger.



25
26
27
# File 'lib/salesforce_http_client/configuration.rb', line 25

def logger
  @logger
end

#salesforce_instance_domainObject

Returns the value of attribute salesforce_instance_domain.



18
19
20
# File 'lib/salesforce_http_client/configuration.rb', line 18

def salesforce_instance_domain
  @salesforce_instance_domain
end

#salesforce_login_idObject

Returns the value of attribute salesforce_login_id.



15
16
17
# File 'lib/salesforce_http_client/configuration.rb', line 15

def 
  @salesforce_login_id
end

#salesforce_login_urlObject

Returns the value of attribute salesforce_login_url.



12
13
14
# File 'lib/salesforce_http_client/configuration.rb', line 12

def 
  @salesforce_login_url
end

#salesforce_logout_urlObject

Returns the value of attribute salesforce_logout_url.



13
14
15
# File 'lib/salesforce_http_client/configuration.rb', line 13

def salesforce_logout_url
  @salesforce_logout_url
end

#salesforce_passwordObject

Returns the value of attribute salesforce_password.



16
17
18
# File 'lib/salesforce_http_client/configuration.rb', line 16

def salesforce_password
  @salesforce_password
end

#salesforce_report_id_paramObject

Returns the value of attribute salesforce_report_id_param.



20
21
22
# File 'lib/salesforce_http_client/configuration.rb', line 20

def salesforce_report_id_param
  @salesforce_report_id_param
end

#salesforce_report_url_formatObject

Returns the value of attribute salesforce_report_url_format.



19
20
21
# File 'lib/salesforce_http_client/configuration.rb', line 19

def salesforce_report_url_format
  @salesforce_report_url_format
end

#tmp_dirObject

Returns the value of attribute tmp_dir.



23
24
25
# File 'lib/salesforce_http_client/configuration.rb', line 23

def tmp_dir
  @tmp_dir
end

Class Method Details

.configure {|instance| ... } ⇒ Object

Yields:

  • (instance)


28
29
30
# File 'lib/salesforce_http_client/configuration.rb', line 28

def self.configure
  yield instance
end

Instance Method Details



65
66
67
68
69
# File 'lib/salesforce_http_client/configuration.rb', line 65

def cookie_store_file_path
  file_path = File.join(@tmp_dir, 'cookie_store.dat')
  FileUtils.mkdir_p(File.dirname(file_path))
  file_path
end

#logout_urlObject



57
58
59
60
61
62
63
# File 'lib/salesforce_http_client/configuration.rb', line 57

def logout_url
  if @salesforce_logout_url.is_a? Proc
    @salesforce_logout_url.call
  else
    @salesforce_logout_url
  end
end

#report_url(report_id) ⇒ Object



47
48
49
50
51
52
53
54
55
# File 'lib/salesforce_http_client/configuration.rb', line 47

def report_url(report_id)
  if @salesforce_report_url_format.is_a? Proc
    url_format = @salesforce_report_url_format.call
  else
    url_format = salesforce_report_url_format
  end

  url_format.gsub(@salesforce_report_id_param, report_id)
end