Class: Yao::Resources::Resource
Instance Attribute Summary
#service
Instance Method Summary
collapse
included, #tenant
Methods inherited from Base
#[], #[]=, #created, friendly_attributes, #initialize, map_attribute_to_attribute, map_attribute_to_resource, map_attribute_to_resources, #updated
#admin=, #api_version, #api_version=, #as_member, #client, #create, #destroy, extended, #find_by_name, #get, #get!, #list, #resources_path, #resources_path=, #return_single_on_querying, #return_single_on_querying=, #update
Instance Method Details
#first_sampled_at ⇒ Object
23
24
25
|
# File 'lib/yao/resources/resource.rb', line 23
def first_sampled_at
Time.parse first_sample_timestamp
end
|
#get_meter(name) ⇒ Object
27
28
29
30
31
|
# File 'lib/yao/resources/resource.rb', line 27
def get_meter(name)
if link = links.find{|l| l["rel"] == name }
Yao::Sample.list(link["href"])
end
end
|
#id ⇒ Object
11
12
13
|
# File 'lib/yao/resources/resource.rb', line 11
def id
resource_id
end
|
#last_sampled_at ⇒ Object
19
20
21
|
# File 'lib/yao/resources/resource.rb', line 19
def last_sampled_at
Time.parse last_sample_timestamp
end
|
#meters ⇒ Object
33
34
35
|
# File 'lib/yao/resources/resource.rb', line 33
def meters
links.map{|l| l["rel"] }.delete_if{|n| n == 'self' }
end
|
#user ⇒ Object
15
16
17
|
# File 'lib/yao/resources/resource.rb', line 15
def user
@user ||= Yao::User.get(user_id)
end
|