Sha256: 16538a7282de8e1874be59da3112ac399c035ddfcadf5987861942690da20668
Contents?: true
Size: 1.29 KB
Versions: 2
Compression:
Stored size: 1.29 KB
Contents
require "amee/data_api/data_category" require "amee/data_api/data_item_value" module Amee module ProfileApi class ProfileItem include Amee::Model self.path_prefix = "/profiles" attr_accessor :end, :amount, :data_item, :profile, :valid_from, :start_date, :end_date, :data_item, :amount_per_month, :total_amount list_populators :item_values => {:class => Amee::DataApi::DataItemValue} item_populators :data_category => {:class => Amee::DataApi::DataCategory}, :item_definition => {:class => Amee::DataApi::ItemDefinition} def self.create(session, path, data_item_uid, fields ={}) hash = session.create_profile_data_category(path, data_item_uid, :fields => fields) self.from_hash(hash, session) end def update(fields) session.update_profile_item(self.full_path, :fields => fields) end def destroy session.delete_profile_item(self.full_path) end def co2_unit amount["unit"] end def co2_value amount["value"] end def profile_uid profile["uid"] end def full_path "#{self.class.path_prefix}/#{profile_uid}" + resource_path end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
hookercookerman-amee-0.0.2 | lib/amee/profile_api/profile_item.rb |
hookercookerman-amee-0.0.3 | lib/amee/profile_api/profile_item.rb |