module Flexirest::Mapping::ClassMethods
Public Instance Methods
_call(name, options)
click to toggle source
# File lib/flexirest/mapping.rb, line 35 def _call(name, options) mapped = _calls[name] lazy_forced = false if mapped.nil? && name.to_s[/^lazy_/] mapped = _calls[name.to_s.gsub(/^lazy_/, '').to_sym] lazy_forced = true end request = Request.new(mapped, self, options) if lazy_load? || lazy_forced Flexirest::LazyLoader.new(request) else request.call end end
_calls()
click to toggle source
# File lib/flexirest/mapping.rb, line 50 def _calls @_calls end
_map_call(name, details)
click to toggle source
# File lib/flexirest/mapping.rb, line 24 def _map_call(name, details) _calls[name] = {name:name}.merge(details) _calls["lazy_#{name}".to_sym] = {name:name}.merge(details) (class << self; self; end).send(:define_method, name) do |options={}| _call(name, options) end (class << self; self; end).send(:define_method, "lazy_#{name}".to_sym) do |options={}| _call("lazy_#{name}", options) end end
_mapped_method(name)
click to toggle source
# File lib/flexirest/mapping.rb, line 54 def _mapped_method(name) _calls[name] end
delete(name, url, options = {})
click to toggle source
# File lib/flexirest/mapping.rb, line 16 def delete(name, url, options = {}) _map_call(name, url:url, method: :delete, options:options) end
get(name, url, options = {})
click to toggle source
# File lib/flexirest/mapping.rb, line 4 def get(name, url, options = {}) _map_call(name, url:url, method: :get, options:options) end
inherited(subclass)
click to toggle source
# File lib/flexirest/mapping.rb, line 58 def inherited(subclass) subclass.instance_variable_set(:@_calls, {}) end
patch(name, url, options = {})
click to toggle source
# File lib/flexirest/mapping.rb, line 20 def patch(name, url, options = {}) _map_call(name, url:url, method: :patch, options:options) end
post(name, url, options = {})
click to toggle source
# File lib/flexirest/mapping.rb, line 12 def post(name, url, options = {}) _map_call(name, url:url, method: :post, options:options) end
put(name, url, options = {})
click to toggle source
# File lib/flexirest/mapping.rb, line 8 def put(name, url, options = {}) _map_call(name, url:url, method: :put, options:options) end