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
112 113 114 115 116 117 118 119 |
# File 'lib/smooth_operator/operator.rb', line 112 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
121 122 123 124 125 126 127 128 129 130 131 |
# File 'lib/smooth_operator/operator.rb', line 121 def (object, ) ||= {} ClassMethods::OPTIONS.each do |option, default| [option] ||= object.send(option) end [:headers] = object.headers.merge([:headers] || {}) end |
#strip_params(object, http_verb, data) ⇒ Object
133 134 135 136 137 138 139 140 141 |
# File 'lib/smooth_operator/operator.rb', line 133 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 |