Module: SmoothOperator::Operator::ClassMethods
- Defined in:
- lib/smooth_operator/operator.rb
Constant Summary collapse
- OPTIONS =
{ endpoint: '', endpoint_user: '', endpoint_pass: '', timeout: '', server_name: '', connection_options: {} }
Instance Method Summary collapse
- #generate_parallel_connection ⇒ Object
- #headers ⇒ Object
- #make_the_call(http_verb, relative_path = '', data = {}, options = {}) ⇒ Object
- #query_string(params) ⇒ Object
- #resource_path(relative_path, options) ⇒ Object
Instance Method Details
#generate_parallel_connection ⇒ Object
95 96 97 |
# File 'lib/smooth_operator/operator.rb', line 95 def generate_parallel_connection Operators::Typhoeus.generate_parallel_connection end |
#headers ⇒ Object
61 62 63 |
# File 'lib/smooth_operator/operator.rb', line 61 def headers get_option :headers, {} end |
#make_the_call(http_verb, relative_path = '', data = {}, options = {}) ⇒ Object
65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 |
# File 'lib/smooth_operator/operator.rb', line 65 def make_the_call(http_verb, relative_path = '', data = {}, = {}) = HelperMethods.(self, ) resource_path = resource_path(relative_path, ) http_verb, resource_path, data, = before_request(http_verb, resource_path, data, ) params, data = *HelperMethods.strip_params(self, http_verb, data) operator = HelperMethods.get_me_an_operator() operator.make_the_call(http_verb, resource_path, params, data, ) do |remote_call| block_given? ? yield(remote_call) : remote_call end end |
#query_string(params) ⇒ Object
81 82 83 |
# File 'lib/smooth_operator/operator.rb', line 81 def query_string(params) params end |
#resource_path(relative_path, options) ⇒ Object
85 86 87 88 89 90 91 92 93 |
# File 'lib/smooth_operator/operator.rb', line 85 def resource_path(relative_path, ) resources_name = [:resources_name] || self.resources_name if Helpers.present?(resources_name) Helpers.present?(relative_path) ? "#{resources_name}/#{relative_path}" : resources_name else relative_path.to_s end end |