hookercookerman-amee 0.0.7 → 0.0.8

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/lib/amee/parser.rb CHANGED
@@ -57,6 +57,7 @@ module Amee
57
57
  def self.process(data)
58
58
  profile_categories = {"profile_categories" => data["children"].delete("dataCategories")}
59
59
  profile_items = {"profile_items" => data["children"]["profileItems"].delete("rows")} if data["children"]["profileItems"]
60
+ profile_items["profile_items"].each{ |profile_item| profile_item.merge!({"profile" => data["profile"]})} if profile_items
60
61
  data.merge(profile_items).merge(profile_categories).
61
62
  merge({"resource_path" => data["path"]})
62
63
  end
@@ -64,7 +65,9 @@ module Amee
64
65
 
65
66
  class ProfileItem < Parser
66
67
  def self.process(data)
67
- data["profileItem"].merge({"resource_path" => data["path"]})
68
+ profile_item = data["profileItem"]
69
+ item_values = {"item_values" => data["profileItem"].delete("itemValues")}
70
+ profile_item.merge(item_values).merge({"resource_path" => data["path"]})
68
71
  end
69
72
  end
70
73
 
@@ -6,7 +6,8 @@ module Amee
6
6
  include Amee::Model
7
7
  self.path_prefix = "/profiles"
8
8
 
9
- attr_accessor :end, :amount, :data_item, :profile, :valid_from, :start_date, :end_date, :amount_per_month, :total_amount
9
+ attr_accessor :end, :amount, :data_item, :profile, :valid_from, :start_date, :end_date
10
+ attr_accessor :data_item_label, :data_item_uid, :amount_per_month, :total_amount
10
11
 
11
12
  list_populators :item_values => {:class => Amee::DataApi::DataItemValue}
12
13
  item_populators :data_category => {:class => Amee::DataApi::DataCategory},
@@ -42,9 +43,11 @@ module Amee
42
43
  "#{self.class.path_prefix}/#{profile_uid}" + resource_path
43
44
  end
44
45
 
45
- # its be default already totally loaded
46
- def lazy_loaded
47
- true
46
+ def populate!
47
+ session.api_call(:get, "profile_item", self.full_path) do |response|
48
+ populate_from_hash!(response)
49
+ end
50
+ @lazy_loaded = true
48
51
  end
49
52
 
50
53
  end
data/lib/amee.rb CHANGED
@@ -33,5 +33,5 @@ require "amee/profile_api/profile_category"
33
33
  require "amee/profile_api/profile"
34
34
 
35
35
  module Amee
36
- VERSION = '0.0.7'
36
+ VERSION = '0.0.8'
37
37
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hookercookerman-amee
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.7
4
+ version: 0.0.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Richard Hooker