lead_create 0.0.5 → 0.0.6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/lead_create.rb +19 -12
  3. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 5234d5699caa87f6d6caccb4b8c4527522cae552
4
- data.tar.gz: 8fe5e398dcdd42ee87a83bc518513e3e854d2504
3
+ metadata.gz: 45999e31b3245b8fabd9733a2c8f2fa3dc2656b6
4
+ data.tar.gz: 1c8b5d696aa2902f6a23978f39b60ba58d07492d
5
5
  SHA512:
6
- metadata.gz: cee11df269bf2086fc768019b3e2028cc5a83bfcde1e04333a8d58e1371ed010c1562920fd26d79f5c3fc020237731e516e5c4777b7fee0fee584eaf3d56067b
7
- data.tar.gz: be542aa081a51a8601cdf196aa045c3ce6a452d10bba3afcfdc87ac98bf1dc1e6a2f8828749124d4c4112bebffc2a898460b70795a040fee4cab94ab773992f5
6
+ metadata.gz: ca268215b2c2abec4ad62ae487de4aab26632e6513bcd03aceca0199c9bf43c676a23541be4e0710145bda0469bd7d0ff58a783e3f817b1c2e53adf44255e88f
7
+ data.tar.gz: 73d69cfc3625999efc5170e0263291da4d4c87fa91190e100b1a87910e8f3aa9c37c117dc36f37300e3294c9789f8b92f571cc25754bfbeec4166b89f2bd4cee
data/lib/lead_create.rb CHANGED
@@ -1,10 +1,27 @@
1
1
  class LeadCreate
2
2
  def self.create(contato)
3
+ lead = get_lead_object
4
+ @lead = lead.new
5
+ @lead = load_new_lead(contato)
6
+ if @lead.save
7
+ contato.name + ' successfully added'
8
+ end
9
+ end
10
+
11
+ def self.list_leads
12
+ lead = get_lead
13
+ lead.all
14
+ end
15
+
16
+ private
17
+ def get_lead_object
3
18
  client = Databasedotcom::Client.new('config/databasedotcom.yml')
4
19
  client.authenticate :username => 'matheuslucena@gmail.com', :password => 'slayer666DT0tilUUmpLca7X5kWKGCKDf'
5
- lead = client.materialize('Lead')
20
+ client.materialize('Lead')
21
+ end
22
+
23
+ def load_new_lead(contato)
6
24
  user = client.materialize('User')
7
- @lead = lead.new
8
25
  @lead.OwnerId = user.first.Id
9
26
  @lead.FirstName = contato.name
10
27
  @lead.LastName = contato.last_name
@@ -15,15 +32,5 @@ class LeadCreate
15
32
  @lead.Website = contato.website
16
33
  @lead.IsConverted = false
17
34
  @lead.IsUnreadByOwner = true
18
- if @lead.save
19
- contato.name + ' successfully added'
20
- end
21
- end
22
-
23
- def self.list_leads
24
- client = Databasedotcom::Client.new('config/databasedotcom.yml')
25
- client.authenticate :username => 'matheuslucena@gmail.com', :password => 'slayer666DT0tilUUmpLca7X5kWKGCKDf'
26
- lead = client.materialize('Lead')
27
- lead.all
28
35
  end
29
36
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lead_create
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.5
4
+ version: 0.0.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Matheus Lucena