fruit_to_lime 2.5.0 → 2.5.1
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/fruit_to_lime/csv_helper.rb +3 -2
- data/lib/fruit_to_lime/model/deal.rb +9 -6
- metadata +3 -2
@@ -8,7 +8,7 @@ module FruitToLime
|
|
8
8
|
# @example Use specific column separator and transform to hashes
|
9
9
|
# column_separator = ','
|
10
10
|
# hashes = FruitToLime::CsvHelper.text_to_hashes(text, column_separator)
|
11
|
-
def self.text_to_hashes(text, column_separator = nil)
|
11
|
+
def self.text_to_hashes(text, column_separator = nil, row_separator = :auto, quote_char = '"')
|
12
12
|
if !text
|
13
13
|
raise "Missing text"
|
14
14
|
end
|
@@ -17,7 +17,8 @@ module FruitToLime
|
|
17
17
|
column_separator = self.detect_col_sep text
|
18
18
|
end
|
19
19
|
|
20
|
-
rows = CSV.parse(text.strip,{:col_sep => column_separator
|
20
|
+
rows = CSV.parse(text.strip,{:col_sep => column_separator,
|
21
|
+
:row_sep => row_separator, :quote_char => quote_char})
|
21
22
|
map = {}
|
22
23
|
first = rows.first
|
23
24
|
(0 .. first.length-1).each do |i|
|
@@ -3,9 +3,16 @@ module FruitToLime
|
|
3
3
|
class Deal
|
4
4
|
include SerializeHelper, ModelHasCustomFields, ModelHasTags
|
5
5
|
|
6
|
-
|
6
|
+
# Get/set the deal's status. Statuses must be configured in
|
7
|
+
# LIME Go before the import.
|
8
|
+
attr_accessor :status
|
9
|
+
|
10
|
+
attr_accessor :id, :integration_id, :name, :description, :probability, :value, :order_date
|
11
|
+
|
7
12
|
# you add custom values by using {#set_custom_value}
|
8
|
-
attr_reader :custom_values
|
13
|
+
attr_reader :custom_values
|
14
|
+
|
15
|
+
attr_reader :customer, :responsible_coworker, :customer_contact
|
9
16
|
|
10
17
|
def serialize_variables
|
11
18
|
[ :id, :integration_id, :name, :description, :probability, :value, :order_date ].map {
|
@@ -52,10 +59,6 @@ module FruitToLime
|
|
52
59
|
error = "#{error}\nA customer is required for deal."
|
53
60
|
end
|
54
61
|
|
55
|
-
if @responsible_coworker.nil?
|
56
|
-
error = "#{error}\nA responsible coworker is required for deal."
|
57
|
-
end
|
58
|
-
|
59
62
|
if error.length > 0
|
60
63
|
error = "#{error}\n#{serialize()}"
|
61
64
|
end
|
metadata
CHANGED
@@ -1,17 +1,18 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fruit_to_lime
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.5.
|
4
|
+
version: 2.5.1
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Oskar Gewalli
|
9
9
|
- Peter Wilhelmsson
|
10
10
|
- Anders Pålsson
|
11
|
+
- Ahmad Game
|
11
12
|
autorequire:
|
12
13
|
bindir: bin
|
13
14
|
cert_chain: []
|
14
|
-
date: 2014-
|
15
|
+
date: 2014-06-23 00:00:00.000000000 Z
|
15
16
|
dependencies:
|
16
17
|
- !ruby/object:Gem::Dependency
|
17
18
|
name: iso_country_codes
|