Module: SmoothOperator::Operator
- Included in:
- Base
- Defined in:
- lib/smooth_operator/operator.rb
Defined Under Namespace
Modules: ClassMethods, HelperMethods
Class Method Summary
collapse
Instance Method Summary
collapse
Class Method Details
.included(base) ⇒ Object
43
44
45
|
# File 'lib/smooth_operator/operator.rb', line 43
def self.included(base)
base.extend(ClassMethods)
end
|
Instance Method Details
#make_the_call(http_verb, relative_path = '', data = {}, options = {}) ⇒ Object
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
|
# File 'lib/smooth_operator/operator.rb', line 11
def make_the_call(http_verb, relative_path = '', data = {}, options = {})
options ||= {}
relative_path = resource_path(relative_path)
parent_object = options[:parent_object] || _options[:parent_object]
if !parent_object.nil? && options[:ignore_parent] != true
id = Helpers.primary_key(parent_object)
options[:resources_name] ||= "#{parent_object.class.resources_name}/#{id}/#{self.class.resources_name}"
end
call_args = before_request(http_verb, relative_path, data, options)
self.class.make_the_call(*call_args) do |remote_call|
yield(remote_call)
end
end
|
#resource_path(relative_path) ⇒ Object