testrd_gem 0.2.0 → 0.3.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.
- checksums.yaml +4 -4
- data/lib/testrd_gem/lead.rb +45 -8
- data/lib/testrd_gem/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bcf93728071d04d827ac7ca8190fa898e01c4be0
|
4
|
+
data.tar.gz: 581ccdc7d044c5981033e3c390f26fbe2118948f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fe413aa6d99118f876daa38f8eb065965ace2fbbb046f13d9e74743166c44e8e295967c40c6f049c5ee3fb2403e0045c358ab6e69d90553aac9309644a4e5194
|
7
|
+
data.tar.gz: 25da3f0cd36f5885628e894a6af0fe7b4046d8ad050dde75301487e29479e30fbd11efbad8552d125d100b416963bf37d23fae80944c8412af50431be4e2acd2
|
data/lib/testrd_gem/lead.rb
CHANGED
@@ -1,16 +1,53 @@
|
|
1
1
|
module TestrdGem
|
2
2
|
class Lead
|
3
3
|
|
4
|
-
|
4
|
+
@@index = 0
|
5
|
+
@@leads = []
|
5
6
|
|
6
7
|
def initialize(name, last_name, email, company, job_title, phone, website)
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
8
|
+
lead = {}
|
9
|
+
lead[:id] = @@index
|
10
|
+
lead[:name] = name
|
11
|
+
lead[:last_name] = last_name
|
12
|
+
lead[:email] = email
|
13
|
+
lead[:company] = company
|
14
|
+
lead[:job_title] = job_title
|
15
|
+
lead[:phone] = phone
|
16
|
+
lead[:website] = website
|
17
|
+
|
18
|
+
@@index += 1
|
19
|
+
@@leads.push(lead)
|
20
|
+
end
|
21
|
+
|
22
|
+
def self.count
|
23
|
+
@@leads.count
|
24
|
+
end
|
25
|
+
|
26
|
+
def self.all
|
27
|
+
@@leads
|
28
|
+
end
|
29
|
+
|
30
|
+
def self.show(id)
|
31
|
+
for lead in @@leads
|
32
|
+
if lead[:id] == id
|
33
|
+
return lead
|
34
|
+
end
|
35
|
+
end
|
36
|
+
return nil
|
37
|
+
end
|
38
|
+
|
39
|
+
def self.delete(id)
|
40
|
+
idx_del = nil
|
41
|
+
size = @@leads.count
|
42
|
+
for i in 0..size-1
|
43
|
+
if @@leads[i][:id] == id
|
44
|
+
idx_del = i
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
if idx_del
|
49
|
+
@@leads.delete_at(idx_del)
|
50
|
+
end
|
14
51
|
end
|
15
52
|
|
16
53
|
end
|
data/lib/testrd_gem/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: testrd_gem
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Vicente Silveira Inácio
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-08-
|
11
|
+
date: 2015-08-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|