Sha256: 7aa288f6d7027383ee70796f6da8186bcd1ae3006211f35ace276ce14c18a199
Contents?: true
Size: 1.15 KB
Versions: 2
Compression:
Stored size: 1.15 KB
Contents
module Copy module Operations module Base module ClassMethods # Options for request # overwrite this in the model to set security # # @return [Hash] def options_for_request(attributes) raise AuthenticationError unless attributes[:session] { session: attributes[:session] } end protected # URl for the member endpoints # overwrite this in the model if the api is not well named # def api_member_url(id=nil, method=nil) url = api_resource_name(method) url += "/#{id}" if id url end # URl for the collection endpoints # overwrite this in the model if the api is not well named # def api_collection_url(attrs={}) api_resource_name end # resource name # overwrite this in the model if the api is not well named # def api_resource_name(method=nil) "#{self.name.split("::").last.downcase}s" end end def self.included(base) base.extend(ClassMethods) end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
copy-ruby-0.0.2 | lib/copy/operations/base.rb |
copy-ruby-0.0.1 | lib/copy/operations/base.rb |