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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 9945129f57370aa5f04b0968beb93f0f17e028f7
4
- data.tar.gz: f749ad01b852b5bcb274aae62af5a12651c3779d
3
+ metadata.gz: bcf93728071d04d827ac7ca8190fa898e01c4be0
4
+ data.tar.gz: 581ccdc7d044c5981033e3c390f26fbe2118948f
5
5
  SHA512:
6
- metadata.gz: 616a08d2cb30f662117cf36374299a3892b289c042a4506fbd46d15deec45a3ff1cde1bcbbe82a846c45e171af6c45756b757249091e1bf7185ae99762e5aebd
7
- data.tar.gz: b409edf31f6483a696ccb47c2dde87f36f44dda2de6e7151eb60683e240f282110ebd850ae6c89d49e13070b5b2c730a75cf97c5085c99d32c2a572d5f1486db
6
+ metadata.gz: fe413aa6d99118f876daa38f8eb065965ace2fbbb046f13d9e74743166c44e8e295967c40c6f049c5ee3fb2403e0045c358ab6e69d90553aac9309644a4e5194
7
+ data.tar.gz: 25da3f0cd36f5885628e894a6af0fe7b4046d8ad050dde75301487e29479e30fbd11efbad8552d125d100b416963bf37d23fae80944c8412af50431be4e2acd2
@@ -1,16 +1,53 @@
1
1
  module TestrdGem
2
2
  class Lead
3
3
 
4
- attr_accessor :name, :last_name, :email, :company, :job_title, :phone, :website
4
+ @@index = 0
5
+ @@leads = []
5
6
 
6
7
  def initialize(name, last_name, email, company, job_title, phone, website)
7
- @name = name
8
- @last_name = last_name
9
- @email = email
10
- @company = company
11
- @job_title = job_title
12
- @phone = phone
13
- @website = website
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
@@ -1,3 +1,3 @@
1
1
  module TestrdGem
2
- VERSION = "0.2.0"
2
+ VERSION = "0.3.0"
3
3
  end
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.2.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-25 00:00:00.000000000 Z
11
+ date: 2015-08-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler