lib/siteleaf/entity.rb in siteleaf-2.0.0 vs lib/siteleaf/entity.rb in siteleaf-2.0.1

- old
+ new

@@ -1,28 +1,28 @@ module Siteleaf class Entity - + attr_reader :error, :message def initialize(attributes = {}) self.attributes = attributes end def self.all result = Client.get endpoint - result.map { |r| new(r) } if result.is_a? Array + result.map { |r| new(r) } if result.parsed_response.is_a? Array end def self.find(identifier) result = Client.get "#{endpoint}/#{identifier}" new(result) if result end def self.create(attributes = {}) new(attributes).save end - + def self.delete(identifier) Client.delete "#{endpoint}/#{identifier}" end def save @@ -58,14 +58,14 @@ end def create_endpoint self.class.endpoint end - + def entity_endpoint "#{self.class.endpoint}/#{identifier}" end - + def identifier id end end