amee_rails_layer 0.6.1 → 0.6.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.6.1
1
+ 0.6.2
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{amee_rails_layer}
8
- s.version = "0.6.1"
8
+ s.version = "0.6.2"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["George Palmer", "James Smith"]
@@ -141,9 +141,12 @@ module AmeeCarbonStore
141
141
  end
142
142
 
143
143
  def update_amee
144
- result = AMEE::Profile::Item.update(connection_to_amee, amee_profile_item_path,
145
- :name => get_name, amount_symbol => get_amount, :get_item => true)
146
- self.carbon_output_cache = result.total_amount
144
+ repetitions_changed = self.class.read_inheritable_attribute(:repetitions) && repetitions_changed?
145
+ if (name_changed? || units_changed? || amount_changed? || repetitions_changed)
146
+ result = AMEE::Profile::Item.update(connection_to_amee, amee_profile_item_path,
147
+ :name => get_name, amount_symbol => get_amount, :get_item => true)
148
+ self.carbon_output_cache = result.total_amount
149
+ end
147
150
  return true
148
151
  end
149
152
 
@@ -155,7 +158,8 @@ module AmeeCarbonStore
155
158
 
156
159
  def create_amee_profile
157
160
  options = {:name => get_name, amount_symbol => get_amount,
158
- amount_unit_symbol => get_units, :get_item => true}
161
+ amount_unit_symbol => get_units, :get_item => true,
162
+ :returnUnit => "kg", :returnPerUnit => "year"}
159
163
  if self.class.read_inheritable_attribute(:has_date_range)
160
164
  options.merge!(:start_date => self.start_date, :end_date => self.end_date)
161
165
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: amee_rails_layer
3
3
  version: !ruby/object:Gem::Version
4
- hash: 5
4
+ hash: 3
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 6
9
- - 1
10
- version: 0.6.1
9
+ - 2
10
+ version: 0.6.2
11
11
  platform: ruby
12
12
  authors:
13
13
  - George Palmer