fruit_to_lime 0.5.0 → 0.6.0

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.
@@ -37,6 +37,21 @@ module FruitToLime
37
37
  include SerializeHelper
38
38
  attr_accessor :organization_number, :email, :web_site, :source_ref,
39
39
  :postal_address, :visit_address, :employees, :notes, :custom_fields
40
+
41
+ def initialize()
42
+ serialize_variables.each do |myattr|
43
+ instance_variable_set("@"+myattr[:id].to_s,get_default(myattr[:type]))
44
+ end
45
+ end
46
+
47
+ def set_custom_field(key, title, value)
48
+ field = CustomField.new
49
+ field.integration_id = key
50
+ field.title = title
51
+ field.value = value
52
+ custom_fields.push field
53
+ end
54
+
40
55
  def tags
41
56
  @tags
42
57
  end
@@ -62,14 +77,11 @@ module FruitToLime
62
77
  {:id=>:source_ref,:type=>:source_ref}
63
78
  ]
64
79
  end
80
+
65
81
  def serialize_name
66
82
  "Organization"
67
83
  end
68
- def initialize()
69
- serialize_variables.each do |myattr|
70
- instance_variable_set("@"+myattr[:id].to_s,get_default(myattr[:type]))
71
- end
72
- end
84
+
73
85
  def to_s
74
86
  return "#{name}"
75
87
  end
@@ -36,18 +36,21 @@ module FruitToLime
36
36
  :position, :email, :alternative_email, :postal_address, :currently_employed,
37
37
  :source_ref,
38
38
  :notes, :organization, :custom_fields
39
- def serialize_variables
40
- [ :id, :integration_id, :first_name, :last_name,
41
- :direct_phone_number, :fax_phone_number, :mobile_phone_number, :home_phone_number,
42
- :position, :email, :alternative_email].map { |prop| {:id=>prop,:type=>:string} } +
43
- [{:id=>:postal_address,:type=>:address},
44
- {:id=>:currently_employed,:type=>:bool},
45
- #{:id=>:notes,:type=>:notes},
46
- {:id=>:tags,:type=>:tags},
47
- {:id=>:custom_fields,:type=>:custom_fields},
48
- {:id=>:source_ref,:type=>:source_ref}
49
- ]
39
+
40
+ def initialize()
41
+ serialize_variables.each do |myattr|
42
+ instance_variable_set("@"+myattr[:id].to_s, get_default(myattr[:type]))
43
+ end
44
+ end
45
+
46
+ def set_custom_field(key, title, value)
47
+ field = CustomField.new
48
+ field.integration_id = key
49
+ field.title = title
50
+ field.value = value
51
+ custom_fields.push field
50
52
  end
53
+
51
54
  def tags
52
55
  @tags
53
56
  end
@@ -61,20 +64,30 @@ module FruitToLime
61
64
  @tags = strOrArray
62
65
  end
63
66
  end
67
+
64
68
  def serialize_name
65
69
  "Person"
66
70
  end
67
- def initialize()
68
- serialize_variables.each do |myattr|
69
- instance_variable_set("@"+myattr[:id].to_s, get_default(myattr[:type]))
70
- end
71
- end
71
+
72
+ def serialize_variables
73
+ [ :id, :integration_id, :first_name, :last_name,
74
+ :direct_phone_number, :fax_phone_number, :mobile_phone_number, :home_phone_number,
75
+ :position, :email, :alternative_email].map { |prop| {:id=>prop,:type=>:string} } +
76
+ [{:id=>:postal_address,:type=>:address},
77
+ {:id=>:currently_employed,:type=>:bool},
78
+ #{:id=>:notes,:type=>:notes},
79
+ {:id=>:tags,:type=>:tags},
80
+ {:id=>:custom_fields,:type=>:custom_fields},
81
+ {:id=>:source_ref,:type=>:source_ref}
82
+ ]
83
+ end
72
84
 
73
85
  def get_import_rows
74
86
  (serialize_variables+[{:id=>:organization, :type=>:organization_reference}]).map do |p|
75
87
  map_to_row p
76
- end
88
+ end
77
89
  end
90
+
78
91
  def to_s
79
92
  return "#{first_name} #{last_name}"
80
93
  end
@@ -0,0 +1,16 @@
1
+ require "spec_helper"
2
+ require 'fruit_to_lime'
3
+
4
+ describe "Organization" do
5
+ before (:all) do
6
+ @organization = FruitToLime::Organization.new
7
+ end
8
+ it "can set a customfield" do
9
+ @organization.set_custom_field('the key', 'the title', 'the value')
10
+
11
+ field = @organization.custom_fields[0]
12
+ field.integration_id.should eq 'the key'
13
+ field.title.should eq 'the title'
14
+ field.value.should eq 'the value'
15
+ end
16
+ end
@@ -0,0 +1,17 @@
1
+ require "spec_helper"
2
+ require 'fruit_to_lime'
3
+
4
+ describe "Person" do
5
+ before (:all) do
6
+ @person = FruitToLime::Person.new
7
+ end
8
+ it "can set a customfield" do
9
+ @person.set_custom_field('the key', 'the title', 'the value')
10
+
11
+ field = @person.custom_fields[0]
12
+ field.integration_id.should eq 'the key'
13
+ field.title.should eq 'the title'
14
+ field.value.should eq 'the value'
15
+ end
16
+ end
17
+
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.5.0
4
+ version: 0.6.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-09-18 00:00:00.000000000 Z
12
+ date: 2013-09-19 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: iso_country_codes
@@ -86,6 +86,8 @@ files:
86
86
  - spec/helpers/address_helper_spec.rb
87
87
  - spec/helpers/csv_helper_spec.rb
88
88
  - spec/helpers/serialize_helper_spec.rb
89
+ - spec/organization_spec.rb
90
+ - spec/person_spec.rb
89
91
  - spec/spec_helper.rb
90
92
  homepage:
91
93
  licenses: []
@@ -116,4 +118,6 @@ test_files:
116
118
  - spec/helpers/address_helper_spec.rb
117
119
  - spec/helpers/csv_helper_spec.rb
118
120
  - spec/helpers/serialize_helper_spec.rb
121
+ - spec/organization_spec.rb
122
+ - spec/person_spec.rb
119
123
  - spec/spec_helper.rb