hookercookerman-amee 0.1.2 → 0.1.3
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/README.rdoc +6 -4
- data/Rakefile +13 -0
- data/lib/amee.rb +1 -1
- data/lib/amee/profile_api/profile.rb +1 -1
- data/lib/amee/session.rb +12 -4
- metadata +1 -1
data/README.rdoc
CHANGED
@@ -1,18 +1,20 @@
|
|
1
1
|
= Amee
|
2
2
|
|
3
|
-
* http://wiki.github.com/hookercookerman/amee
|
4
|
-
|
5
3
|
== DESCRIPTION:
|
6
4
|
|
7
|
-
Amee is a Ruby wrapper over the
|
5
|
+
Amee is a Ruby wrapper over the "AMEE carbon calculator"[http://www.amee.com]
|
8
6
|
|
9
7
|
* Idiomatic Ruby
|
10
8
|
* Concrete classes and methods modeling Amee data, so it's easy for a Rubyist to understand what's available
|
11
9
|
* Cucumber Features and specs
|
12
10
|
|
11
|
+
== DOCUMENTATION
|
12
|
+
|
13
|
+
* http://wiki.github.com/hookercookerman/amee
|
14
|
+
|
13
15
|
== REQUIREMENTS:
|
14
16
|
|
15
|
-
|
17
|
+
Monetra
|
16
18
|
Httparty
|
17
19
|
will_paginate (if you want to paginate data_items)
|
18
20
|
|
data/Rakefile
CHANGED
@@ -25,3 +25,16 @@ Dir['tasks/**/*.rake'].each { |t| load t }
|
|
25
25
|
|
26
26
|
# TODO - want other tests/tasks run by default? Add them to the list
|
27
27
|
# task :default => [:spec, :features]
|
28
|
+
require 'cucumber/rake/task'
|
29
|
+
|
30
|
+
namespace :features do
|
31
|
+
Cucumber::Rake::Task.new(:all) do |t|
|
32
|
+
t.cucumber_opts = "--format pretty"
|
33
|
+
end
|
34
|
+
|
35
|
+
Cucumber::Rake::Task.new(:rcov) do |t|
|
36
|
+
t.rcov = true
|
37
|
+
t.rcov_opts = %w{--rails --exclude osx\/objc,gems\/,spec\/}
|
38
|
+
t.rcov_opts << %[-o "features_rcov"]
|
39
|
+
end
|
40
|
+
end
|
data/lib/amee.rb
CHANGED
@@ -8,7 +8,7 @@ module Amee
|
|
8
8
|
|
9
9
|
attr_accessor :profile_date, :amount_per_month
|
10
10
|
list_populators :profile_categories => {:class => Amee::ProfileApi::ProfileCategory}
|
11
|
-
item_populators :data_category => {:class => Amee::
|
11
|
+
item_populators :data_category => {:class => Amee::DataApi::DataCategory}
|
12
12
|
|
13
13
|
def self.create(session)
|
14
14
|
self.from_hash(session.new_profile, session)
|
data/lib/amee/session.rb
CHANGED
@@ -102,7 +102,9 @@ module Amee
|
|
102
102
|
# @return [Amee::DataApi::DataCategory]
|
103
103
|
def get_data_category(path, options = {})
|
104
104
|
api_call(:get, "data.category", path, options) do |response|
|
105
|
-
Amee::DataApi::DataCategory.from_hash(response, self)
|
105
|
+
Amee::DataApi::DataCategory.from_hash(response, self) do |data_category|
|
106
|
+
data_category.lazy_loaded = true
|
107
|
+
end
|
106
108
|
end
|
107
109
|
end
|
108
110
|
|
@@ -116,7 +118,9 @@ module Amee
|
|
116
118
|
# @return [Amee::DataApi::DataItem]
|
117
119
|
def get_data_item(path, options = {})
|
118
120
|
api_call(:get, "data.item", path, options) do |response|
|
119
|
-
Amee::DataApi::DataItem.from_hash(response, self)
|
121
|
+
Amee::DataApi::DataItem.from_hash(response, self) do |data_item|
|
122
|
+
data_item.lazy_loaded = true
|
123
|
+
end
|
120
124
|
end
|
121
125
|
end
|
122
126
|
|
@@ -187,14 +191,18 @@ module Amee
|
|
187
191
|
# @return [Amee::ProfileApi::ProfileCategory]
|
188
192
|
def get_profile_category(path, options = {})
|
189
193
|
api_call(:get, "profile_category", path, options) do |response|
|
190
|
-
Amee::ProfileApi::ProfileCategory.from_hash(response, self)
|
194
|
+
Amee::ProfileApi::ProfileCategory.from_hash(response, self) do |profile_category|
|
195
|
+
profile_category.lazy_loaded = true
|
196
|
+
end
|
191
197
|
end
|
192
198
|
end
|
193
199
|
|
194
200
|
# @return [Amee::ProfileApi::ProfileItem]
|
195
201
|
def get_profile_item(path, options = {})
|
196
202
|
api_call(:get, "profile_item", path, options) do |response|
|
197
|
-
Amee::ProfileApi::ProfileItem.from_hash(response, self)
|
203
|
+
Amee::ProfileApi::ProfileItem.from_hash(response, self) do |profile_item|
|
204
|
+
profile_item.lazy_loaded = true
|
205
|
+
end
|
198
206
|
end
|
199
207
|
end
|
200
208
|
|