lib/recurly/resource.rb in recurly-3.0.0.beta.5 vs lib/recurly/resource.rb in recurly-3.0.0
- old
+ new
@@ -3,11 +3,11 @@
# Recurly servers. It is generated from a response. If you wish to
# update or change a resource, you need to send a request to the server
# and get a new Resource.
class Resource
extend Schema::SchemaFactory
- extend Schema::JsonDeserializer
+ extend Schema::ResourceCaster
include Schema::SchemaValidator
attr_reader :attributes
def requires_client?
@@ -16,11 +16,24 @@
def ==(other_resource)
self.attributes == other_resource.attributes
end
+ # Hide instance variables to keep from accidental logging
+ def inspect
+ "#<#{self.class.name}:#{object_id}} @attributes=#{attributes}>"
+ end
+
def to_s
self.inspect
+ end
+
+ def to_json
+ raise NoMethodError, "to_json is not implemented for Resources. Please use Resource#attributes"
+ end
+
+ def get_response
+ @response
end
protected
def schema