Class: SalesforceHttpClient::Configuration
- Inherits:
-
Object
- Object
- SalesforceHttpClient::Configuration
- Includes:
- Singleton
- Defined in:
- lib/salesforce_http_client/configuration.rb
Instance Attribute Summary collapse
-
#http_timeout ⇒ Object
Returns the value of attribute http_timeout.
-
#log_level ⇒ Object
Returns the value of attribute log_level.
-
#logger ⇒ Object
Returns the value of attribute logger.
-
#salesforce_instance_domain ⇒ Object
Returns the value of attribute salesforce_instance_domain.
-
#salesforce_login_id ⇒ Object
Returns the value of attribute salesforce_login_id.
-
#salesforce_login_url ⇒ Object
Returns the value of attribute salesforce_login_url.
-
#salesforce_logout_url ⇒ Object
Returns the value of attribute salesforce_logout_url.
-
#salesforce_password ⇒ Object
Returns the value of attribute salesforce_password.
-
#salesforce_report_id_param ⇒ Object
Returns the value of attribute salesforce_report_id_param.
-
#salesforce_report_url_format ⇒ Object
Returns the value of attribute salesforce_report_url_format.
-
#tmp_dir ⇒ Object
Returns the value of attribute tmp_dir.
Class Method Summary collapse
Instance Method Summary collapse
- #cookie_store_file_path ⇒ Object
-
#initialize ⇒ Configuration
constructor
A new instance of Configuration.
- #logout_url ⇒ Object
- #report_url(report_id) ⇒ Object
Constructor Details
#initialize ⇒ Configuration
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_timeout ⇒ Object
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_level ⇒ Object
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 |
#logger ⇒ Object
Returns the value of attribute logger.
25 26 27 |
# File 'lib/salesforce_http_client/configuration.rb', line 25 def logger @logger end |
#salesforce_instance_domain ⇒ Object
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_id ⇒ Object
Returns the value of attribute salesforce_login_id.
15 16 17 |
# File 'lib/salesforce_http_client/configuration.rb', line 15 def salesforce_login_id @salesforce_login_id end |
#salesforce_login_url ⇒ Object
Returns the value of attribute salesforce_login_url.
12 13 14 |
# File 'lib/salesforce_http_client/configuration.rb', line 12 def salesforce_login_url @salesforce_login_url end |
#salesforce_logout_url ⇒ Object
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_password ⇒ Object
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_param ⇒ Object
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_format ⇒ Object
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_dir ⇒ Object
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
28 29 30 |
# File 'lib/salesforce_http_client/configuration.rb', line 28 def self.configure yield instance end |
Instance Method Details
#cookie_store_file_path ⇒ Object
65 66 67 68 69 |
# File 'lib/salesforce_http_client/configuration.rb', line 65 def file_path = File.join(@tmp_dir, 'cookie_store.dat') FileUtils.mkdir_p(File.dirname(file_path)) file_path end |
#logout_url ⇒ Object
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 |