class RESTinPeace::DefinitionProxy::ResourceMethodDefinitions
Public Class Methods
new(target)
click to toggle source
# File lib/rest_in_peace/definition_proxy/resource_method_definitions.rb, line 4 def initialize(target) @target = target end
Public Instance Methods
delete(method_name, url_template)
click to toggle source
# File lib/rest_in_peace/definition_proxy/resource_method_definitions.rb, line 40 def delete(method_name, url_template) @target.rip_registry[:resource] << { method: :delete, name: method_name, url: url_template } @target.send(:define_method, method_name) do call = RESTinPeace::ApiCall.new(api, url_template, self, id: id) call.delete end end
get(method_name, url_template, default_params = {})
click to toggle source
# File lib/rest_in_peace/definition_proxy/resource_method_definitions.rb, line 8 def get(method_name, url_template, default_params = {}) @target.rip_registry[:resource] << { method: :get, name: method_name, url: url_template } @target.send(:define_method, method_name) do call = RESTinPeace::ApiCall.new(api, url_template, self, payload) call.get end end
patch(method_name, url_template)
click to toggle source
# File lib/rest_in_peace/definition_proxy/resource_method_definitions.rb, line 16 def patch(method_name, url_template) @target.rip_registry[:resource] << { method: :patch, name: method_name, url: url_template } @target.send(:define_method, method_name) do call = RESTinPeace::ApiCall.new(api, url_template, self, payload) call.patch end end
post(method_name, url_template)
click to toggle source
# File lib/rest_in_peace/definition_proxy/resource_method_definitions.rb, line 24 def post(method_name, url_template) @target.rip_registry[:resource] << { method: :post, name: method_name, url: url_template } @target.send(:define_method, method_name) do call = RESTinPeace::ApiCall.new(api, url_template, self, payload(false)) call.post end end
put(method_name, url_template)
click to toggle source
# File lib/rest_in_peace/definition_proxy/resource_method_definitions.rb, line 32 def put(method_name, url_template) @target.rip_registry[:resource] << { method: :put, name: method_name, url: url_template } @target.send(:define_method, method_name) do call = RESTinPeace::ApiCall.new(api, url_template, self, payload(false)) call.put end end