fruit_to_lime 0.6.6 → 0.6.7

Sign up to get free protection for your applications and to get access to all the features.
@@ -51,7 +51,6 @@ module FruitToLime
51
51
  yield @visit_address
52
52
  end
53
53
 
54
-
55
54
  def set_custom_field(obj)
56
55
  @custom_fields = [] if @custom_fields==nil
57
56
  @custom_fields.push CustomField.new(obj)
@@ -67,6 +66,11 @@ module FruitToLime
67
66
  end
68
67
  end
69
68
 
69
+ def add_employee(val)
70
+ @employees = [] if @employees==nil
71
+ @employees.push(if val.is_a? Person then val else Person.new(val) end)
72
+ end
73
+
70
74
  def tags
71
75
  @tags
72
76
  end
@@ -37,7 +37,13 @@ module FruitToLime
37
37
  :notes, :organization
38
38
  attr_reader :custom_fields
39
39
 
40
- def initialize()
40
+ def initialize(opt=nil)
41
+ if opt!=nil
42
+ serialize_variables.each do |myattr|
43
+ val = opt[myattr[:id]]
44
+ instance_variable_set("@"+myattr[:id].to_s,val) if val!=nil
45
+ end
46
+ end
41
47
  end
42
48
 
43
49
  def with_postal_address
@@ -96,11 +96,20 @@ describe FruitToLime::SerializeHelper do
96
96
  o.with_visit_address do |addr|
97
97
  addr.city = "Gaaseborg"
98
98
  end
99
+ o.add_employee({
100
+ :id => "1",
101
+ :first_name => "Kalle",
102
+ :last_name => "Anka"
103
+ })
99
104
  FruitToLime::SerializeHelper::serialize(o)
100
105
  }
101
106
  it "should contain name" do
102
107
  serialized.should match(/Ankeborgs bibliotek/)
103
108
  end
109
+ it "should contain employee" do
110
+ serialized.should match(/Kalle/)
111
+ serialized.should match(/Anka/)
112
+ end
104
113
  it "should contain address" do
105
114
  serialized.should match(/Ankeborg/)
106
115
  serialized.should match(/Gaaseborg/)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fruit_to_lime
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.6
4
+ version: 0.6.7
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: