lib/prx/model/base.rb in prx_client-0.3.1 vs lib/prx/model/base.rb in prx_client-1.0.0
- old
+ new
@@ -1,9 +1,12 @@
+require 'roar/decorator'
+require 'roar/json'
+
module PRX
module Model
class Base
-
+ include ActiveModel::Model
attr_accessor :id
def initialize(*args)
return unless args
if args[0].is_a?(Hash)
@@ -17,10 +20,10 @@
def save
opts = {
:action => (id ? :put : :post),
:path => (id ? "#{class_path_part}/#{id}" : class_path_part),
- :body => as_json
+ :body => to_hash
}
response = request(opts)
self.from_json(response.response.body)
end