-
Notifications
You must be signed in to change notification settings - Fork 0
/
class_setup.rb
52 lines (43 loc) · 1.11 KB
/
class_setup.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
class ApiConnector
attr_accessor :title, :description, :url
def initialize(title: title(), description: description(), url: url = "google.com")
@title = title
@description = description
@url = url
end
def testing_initializers
puts @title
puts @description
puts @url
end
def api_logger
puts "Api connection starting"
end
end
class SmsConnector < ApiConnector
def send_sms
puts "Sending sms..."
end
end
class PhoneConnector < ApiConnector
def api_logger
puts "Phone call Api connection starting"
end
def send_phone_call
puts "Sending phone call..."
end
end
class MailConnector < ApiConnector
def send_email
puts "Sending email..."
end
end
api = ApiConnector.new(title: "My title",description: "My description", url: "yahoo.com")
sms = SmsConnector.new(title: "My title",description: "My description", url: "yahoo.com")
phone = PhoneConnector.new(title: "My title",description: "My description", url: "yahoo.com")
email = MailConnector.new(title: "My title",description: "My description", url: "yahoo.com")
sms.send_sms
phone.send_phone_call
email.send_email
api.api_logger
phone.api_logger