lib/yao/resources/resource.rb in yao-0.7.0 vs lib/yao/resources/resource.rb in yao-0.8.0

- old
+ new

@@ -1,21 +1,19 @@ require 'time' module Yao::Resources class Resource < Base - friendly_attributes :user_id, :resource_id, :project_id, + include TenantAssociationable + + friendly_attributes :user_id, :resource_id, :last_sample_timestamp, :first_sample_timestamp, :metadata, :links def id resource_id end - def tenant - @tenant ||= Yao::User.get(project_id) - end - def user @user ||= Yao::User.get(user_id) end def last_sampled_at @@ -40,15 +38,22 @@ self.api_version = "v2" self.resources_name = "resources" class << self private + + # override Yao::Resources::RestfullyAccessible.resource_from_json + # @param [Hash] + # @return [Yao::Resources::Resource] def resource_from_json(json) - json + new(json) end + # override Yao::Resources::RestfullyAccessible.resources_from_json + # @param [Hash] + # @return [Yao::Resources::Resource] def resources_from_json(json) - json + new(json) end end end end