Class: Pindo::HttpClient
- Inherits:
-
Object
- Object
- Pindo::HttpClient
- Defined in:
- lib/pindo/client/httpclient.rb
Instance Attribute Summary collapse
-
#baseurl ⇒ Object
Returns the value of attribute baseurl.
-
#request_config ⇒ Object
Returns the value of attribute request_config.
-
#token ⇒ Object
Returns the value of attribute token.
-
#use_local_wechat_url ⇒ Object
Returns the value of attribute use_local_wechat_url.
Class Method Summary collapse
Instance Attribute Details
#baseurl ⇒ Object
Returns the value of attribute baseurl.
16 17 18 |
# File 'lib/pindo/client/httpclient.rb', line 16 def baseurl @baseurl end |
#request_config ⇒ Object
Returns the value of attribute request_config.
17 18 19 |
# File 'lib/pindo/client/httpclient.rb', line 17 def request_config @request_config end |
#token ⇒ Object
Returns the value of attribute token.
15 16 17 |
# File 'lib/pindo/client/httpclient.rb', line 15 def token @token end |
#use_local_wechat_url ⇒ Object
Returns the value of attribute use_local_wechat_url.
14 15 16 |
# File 'lib/pindo/client/httpclient.rb', line 14 def use_local_wechat_url @use_local_wechat_url end |
Class Method Details
.create_instance ⇒ Object
43 44 45 46 47 |
# File 'lib/pindo/client/httpclient.rb', line 43 def self.create_instance() con = Faraday.new con end |
.create_instance_with_proxy ⇒ Object
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/pindo/client/httpclient.rb', line 19 def self.create_instance_with_proxy() # puts body_params.to_json = { uri: ENV['http_proxy'] || ENV['https_proxy'], user: ENV['HTTP_PROXY_USER'], password: ENV['HTTP_PROXY_PASSWORD'] } = { max: 3, # Retry a failed request up to 5 times interval: 0.5, # First retry after 0.5s backoff_factor: 2, # Double the delay for each subsequent retry interval_randomness: 0.5, # Specify "jitter" of up to 50% of interval } con = Faraday.new do |config| config.request :retry, config.proxy = .compact if [:uri] end con end |