ffcrm_cloudfuji 0.1.5 → 0.1.6

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.
@@ -9,7 +9,7 @@ module FatFreeCRM
9
9
  data = params['data']
10
10
  ido_id = data.try(:[], 'ido_id')
11
11
 
12
- if user = User.find_by_email(data['email'])
12
+ if user = User.find(:first, :conditions => ["email = ? OR ido_id = ?", data['email'], data['ido_id']])
13
13
  puts "Updating #{user.inspect} with incoming data #{params.inspect}" if debug
14
14
  else
15
15
  user = User.new
@@ -31,6 +31,10 @@ module FatFreeCRM
31
31
  params['data']
32
32
  end
33
33
 
34
+ def recipient
35
+ data['recipient']
36
+ end
37
+
34
38
  def find_or_create_activity_subject!
35
39
  lookups = [Account, Lead, Contact]
36
40
  lookups.each do |model|
@@ -46,7 +50,7 @@ module FatFreeCRM
46
50
  lead.first_name ||= data['first_name'] || recipient.split("@").first if lead.first_name.blank?
47
51
  lead.last_name ||= data['last_name'] || recipient.split("@").last if lead.last_name.blank?
48
52
 
49
- lead.save
53
+ lead.save!
50
54
 
51
55
  lead
52
56
  end
@@ -1,5 +1,5 @@
1
1
  module FatFreeCRM
2
2
  module Cloudfuji
3
- VERSION = '0.1.5'
3
+ VERSION = '0.1.6'
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ffcrm_cloudfuji
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.5
4
+ version: 0.1.6
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -140,7 +140,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
140
140
  version: '0'
141
141
  segments:
142
142
  - 0
143
- hash: -478798927
143
+ hash: -405230095
144
144
  required_rubygems_version: !ruby/object:Gem::Requirement
145
145
  none: false
146
146
  requirements:
@@ -149,7 +149,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
149
149
  version: '0'
150
150
  segments:
151
151
  - 0
152
- hash: -478798927
152
+ hash: -405230095
153
153
  requirements: []
154
154
  rubyforge_project:
155
155
  rubygems_version: 1.8.24