class Retentiongrid::Resource
Retentiongrid
Resource
Base class for all API resources.
Constants
- ATTRIBUTES_NAMES
Public Class Methods
new(attribs={})
click to toggle source
# File lib/retentiongrid/resource.rb, line 14 def initialize(attribs={}) attribs.each do |attrib, value| self.send("#{attrib}=", value) end end
Public Instance Methods
attributes()
click to toggle source
Return all attributes as a hash @return [Hash]
# File lib/retentiongrid/resource.rb, line 28 def attributes self.class::ATTRIBUTES_NAMES.inject({}) do |attribs, attrib_name| value = self.send(attrib_name) attribs[attrib_name] = value unless value.nil? attribs end end
save()
click to toggle source
Create or update a product with given id @return [Boolean] successfully created or updated?
# File lib/retentiongrid/resource.rb, line 22 def save !!(save!) rescue false end