Module: SmoothOperator::Operator::HelperMethods
Instance Method Summary collapse
- #get_me_an_operator(options) ⇒ Object
- #populate_options(object, options) ⇒ Object
- #strip_params(object, http_verb, data) ⇒ Object
Instance Method Details
#get_me_an_operator(options) ⇒ Object
111 112 113 114 115 116 117 118 |
# File 'lib/smooth_operator/operator.rb', line 111 def get_me_an_operator() if [:parallel_connection].nil? Operators::Faraday else [:connection] = .delete(:parallel_connection) Operators::Typhoeus end end |
#populate_options(object, options) ⇒ Object
120 121 122 123 124 125 126 127 128 129 130 |
# File 'lib/smooth_operator/operator.rb', line 120 def (object, ) ||= {} ClassMethods::OPTIONS.each do |option| [option] ||= object.send(option) end [:headers] = object.headers.merge([:headers] || {}) end |
#strip_params(object, http_verb, data) ⇒ Object
132 133 134 135 136 137 138 139 140 |
# File 'lib/smooth_operator/operator.rb', line 132 def strip_params(object, http_verb, data) data ||= {} if [:get, :head, :delete].include?(http_verb) [object.query_string(data), nil] else [object.query_string({}), data] end end |