Module: SmoothOperator::Operator
- Included in:
- Base
- Defined in:
- lib/smooth_operator/operator.rb
Constant Summary collapse
- HTTP_VERBS =
[:get, :post, :put, :patch, :delete]
- OPTIONS =
[:endpoint, :endpoint_user, :endpoint_pass, :timeout]
Instance Method Summary collapse
Instance Method Details
#generate_connection(adapter = nil, options = nil) ⇒ Object
26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/smooth_operator/operator.rb', line 26 def generate_connection(adapter = nil, = nil) adapter ||= :net_http ||= {} url, timeout = ([:endpoint] || self.endpoint), ([:timeout] || self.timeout) Faraday.new(url: url) do |builder| builder..params_encoder = Faraday::NestedParamsEncoder # to properly encode arrays builder..timeout = timeout unless Helpers.blank?(timeout) builder.request :url_encoded builder.adapter adapter end end |
#generate_parallel_connection ⇒ Object
22 23 24 |
# File 'lib/smooth_operator/operator.rb', line 22 def generate_parallel_connection generate_connection(:typhoeus) end |