lib/rest_model.rb in rest_model-0.1.12 vs lib/rest_model.rb in rest_model-0.1.13
- old
+ new
@@ -38,13 +38,10 @@
extend Source::Retriever
include Source::Sender
include Response
include Serialization
- cattr_accessor :id_key
- cattr_writer :resource_name
-
def initialize(attrs = {})
return if attrs.nil? or attrs.empty?
attrs = attrs.with_indifferent_access
@@ -73,9 +70,21 @@
self
end
def resource_id
__send__(id_key.name)
+ end
+
+ def self.id_key
+ @id_key
+ end
+
+ def self.id_key=(id_key)
+ @id_key = id_key
+ end
+
+ def self.resource_name=(resource_name)
+ @resource_name = resource_name
end
def self.keys
@keys ||= []
end