BAT_Notifications 0.0.0 → 0.0.4
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/A_User.rb +29 -28
- data/lib/BasicNotificationDecorator.rb +44 -44
- data/lib/BookingNotificationDecorator.rb +83 -66
- data/lib/Content.rb +38 -36
- data/lib/InboxNotificationDecorator.rb +66 -66
- data/lib/NotificationDb.rb +11 -11
- data/lib/ReviewNotificationDecorator.rb +83 -66
- data/lib/SendNotification.rb +90 -90
- data/lib/bat_notifications.rb +254 -0
- data/lib/functions/BookingFunctions.rb +32 -0
- data/lib/functions/ReviewFunctions.rb +10 -0
- data/lib/interface.rb +16 -0
- metadata +6 -3
- data/lib/Notification.rb +0 -153
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0cf413e7951a8fc361e6d3aa460a5bfaaae177411fab9e633a32f44bfd411eb5
|
4
|
+
data.tar.gz: f4639bb3f5dfd3d621a0aaf335f6e22214f94b79bf4890120c61dc420e6b42bb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 25b623519b99e38ee5f932629739d0bb8916567279dcf70ba380fc48762996b3517cd97f22a25d9f8ac762742ace4a4a498c40e1220ac19cb450f6c4d280cbca
|
7
|
+
data.tar.gz: ea4c4ebebfbea0cd4f62ced77cb53c812041faeec8f046948e4687f3957ad35df15561edb429fe276a7fb48c4f6eaa231b502718822cee7a0e25db7fb65919a4
|
data/lib/A_User.rb
CHANGED
@@ -1,29 +1,30 @@
|
|
1
|
-
module AUser
|
2
|
-
def self.sender
|
3
|
-
return {
|
4
|
-
"id" => "3",
|
5
|
-
"email" => "
|
6
|
-
"firstname" => "John",
|
7
|
-
"lastname" => "Sender",
|
8
|
-
"role" => "Student",
|
9
|
-
"gender" => "Male",
|
10
|
-
"has_profile" => "true",
|
11
|
-
"location" => "Dublin"
|
12
|
-
}
|
13
|
-
end
|
14
|
-
|
15
|
-
def self.receiver
|
16
|
-
return {
|
17
|
-
"id" => "3",
|
18
|
-
"email" => "femi.abdul67@gmail.com",
|
19
|
-
"firstname" => "John",
|
20
|
-
"lastname" => "Receiver",
|
21
|
-
"role" => "Tutor",
|
22
|
-
"gender" => "Male",
|
23
|
-
"has_profile" => "true",
|
24
|
-
"location" => "Dublin"
|
25
|
-
}
|
26
|
-
end
|
27
|
-
|
28
|
-
|
1
|
+
module AUser
|
2
|
+
def self.sender
|
3
|
+
return {
|
4
|
+
"id" => "3",
|
5
|
+
"email" => "house16studio@gmail.com",
|
6
|
+
"firstname" => "John",
|
7
|
+
"lastname" => "Sender",
|
8
|
+
"role" => "Student",
|
9
|
+
"gender" => "Male",
|
10
|
+
"has_profile" => "true",
|
11
|
+
"location" => "Dublin"
|
12
|
+
}
|
13
|
+
end
|
14
|
+
|
15
|
+
def self.receiver
|
16
|
+
return {
|
17
|
+
"id" => "3",
|
18
|
+
"email" => "femi.abdul67@gmail.com",
|
19
|
+
"firstname" => "John",
|
20
|
+
"lastname" => "Receiver",
|
21
|
+
"role" => "Tutor",
|
22
|
+
"gender" => "Male",
|
23
|
+
"has_profile" => "true",
|
24
|
+
"location" => "Dublin"
|
25
|
+
}
|
26
|
+
end
|
27
|
+
|
28
|
+
|
29
|
+
|
29
30
|
end
|
@@ -1,44 +1,44 @@
|
|
1
|
-
require_relative '
|
2
|
-
|
3
|
-
|
4
|
-
module BasicNotificationDecorator
|
5
|
-
|
6
|
-
def self.set_action(action)
|
7
|
-
@action = action
|
8
|
-
end
|
9
|
-
|
10
|
-
def self.init_basic_decorator
|
11
|
-
set_action("Basic Notification")
|
12
|
-
@basicNotification = BasicNotification.new(@action, "Sender", "Receiver", "Message" )
|
13
|
-
end
|
14
|
-
|
15
|
-
|
16
|
-
def self.get_basic_notification_action
|
17
|
-
init_basic_decorator
|
18
|
-
return @basicNotification.get_action
|
19
|
-
end
|
20
|
-
|
21
|
-
def self.get_basic_notification_sender
|
22
|
-
init_basic_decorator
|
23
|
-
return @basicNotification.get_sender
|
24
|
-
end
|
25
|
-
|
26
|
-
def self.get_basic_notification_receiver
|
27
|
-
init_basic_decorator
|
28
|
-
return @basicNotification.get_receiver
|
29
|
-
end
|
30
|
-
|
31
|
-
def self.get_basic_notification_content
|
32
|
-
init_basic_decorator
|
33
|
-
return @basicNotification.get_content
|
34
|
-
end
|
35
|
-
|
36
|
-
def self.get_basic_notification_base
|
37
|
-
init_basic_decorator
|
38
|
-
return @basicNotification.get_notification_base
|
39
|
-
end
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
end
|
44
|
-
|
1
|
+
require_relative 'bat_notifications'
|
2
|
+
|
3
|
+
|
4
|
+
module BasicNotificationDecorator
|
5
|
+
|
6
|
+
def self.set_action(action)
|
7
|
+
@action = action
|
8
|
+
end
|
9
|
+
|
10
|
+
def self.init_basic_decorator
|
11
|
+
set_action("Basic Notification")
|
12
|
+
@basicNotification = BasicNotification.new(@action, "Sender", "Receiver", "Message" )
|
13
|
+
end
|
14
|
+
|
15
|
+
|
16
|
+
def self.get_basic_notification_action
|
17
|
+
init_basic_decorator
|
18
|
+
return @basicNotification.get_action
|
19
|
+
end
|
20
|
+
|
21
|
+
def self.get_basic_notification_sender
|
22
|
+
init_basic_decorator
|
23
|
+
return @basicNotification.get_sender
|
24
|
+
end
|
25
|
+
|
26
|
+
def self.get_basic_notification_receiver
|
27
|
+
init_basic_decorator
|
28
|
+
return @basicNotification.get_receiver
|
29
|
+
end
|
30
|
+
|
31
|
+
def self.get_basic_notification_content
|
32
|
+
init_basic_decorator
|
33
|
+
return @basicNotification.get_content
|
34
|
+
end
|
35
|
+
|
36
|
+
def self.get_basic_notification_base
|
37
|
+
init_basic_decorator
|
38
|
+
return @basicNotification.get_notification_base
|
39
|
+
end
|
40
|
+
|
41
|
+
|
42
|
+
|
43
|
+
end
|
44
|
+
|
@@ -1,66 +1,83 @@
|
|
1
|
-
require_relative '
|
2
|
-
require_relative 'NotificationDb'
|
3
|
-
require_relative "Content.rb"
|
4
|
-
|
5
|
-
require "async"
|
6
|
-
|
7
|
-
|
8
|
-
module BookingNotificationDecorator
|
9
|
-
|
10
|
-
def self.set_action(action)
|
11
|
-
@action = action
|
12
|
-
end
|
13
|
-
|
14
|
-
|
15
|
-
def self.set_content
|
16
|
-
@content = Content.booking_content
|
17
|
-
end
|
18
|
-
|
19
|
-
def self.set_sender
|
20
|
-
@sender = NotificationDb.get_sender
|
21
|
-
end
|
22
|
-
|
23
|
-
def self.set_receiver
|
24
|
-
@receiver = NotificationDb.get_receiver
|
25
|
-
end
|
26
|
-
|
27
|
-
|
28
|
-
def self.init_booking_decorator
|
29
|
-
|
30
|
-
set_content
|
31
|
-
set_sender
|
32
|
-
set_receiver
|
33
|
-
@
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
1
|
+
require_relative 'bat_notifications'
|
2
|
+
require_relative 'NotificationDb'
|
3
|
+
require_relative "Content.rb"
|
4
|
+
|
5
|
+
require "async"
|
6
|
+
|
7
|
+
|
8
|
+
module BookingNotificationDecorator
|
9
|
+
|
10
|
+
def self.set_action(action)
|
11
|
+
@action = action
|
12
|
+
end
|
13
|
+
|
14
|
+
|
15
|
+
def self.set_content
|
16
|
+
@content = Content.booking_content
|
17
|
+
end
|
18
|
+
|
19
|
+
def self.set_sender
|
20
|
+
@sender = NotificationDb.get_sender
|
21
|
+
end
|
22
|
+
|
23
|
+
def self.set_receiver
|
24
|
+
@receiver = NotificationDb.get_receiver
|
25
|
+
end
|
26
|
+
|
27
|
+
|
28
|
+
def self.init_booking_decorator
|
29
|
+
|
30
|
+
set_content
|
31
|
+
set_sender
|
32
|
+
set_receiver
|
33
|
+
@notification = Notification.new(@sender, @receiver, @content)
|
34
|
+
@notification = BookingNotification.new(@notification)
|
35
|
+
end
|
36
|
+
|
37
|
+
def self.get_booking_action
|
38
|
+
init_booking_decorator
|
39
|
+
return @notification.get_action
|
40
|
+
end
|
41
|
+
|
42
|
+
def self.get_booking_content
|
43
|
+
init_booking_decorator
|
44
|
+
content = @notification.get_content
|
45
|
+
booking_location = content["location"]
|
46
|
+
return true if booking_location
|
47
|
+
end
|
48
|
+
|
49
|
+
def self.get_booking_creator
|
50
|
+
init_booking_decorator
|
51
|
+
return @notification.get_sender["lastname"]
|
52
|
+
end
|
53
|
+
|
54
|
+
def self.get_user_booked
|
55
|
+
init_booking_decorator
|
56
|
+
return @notification.get_receiver["lastname"]
|
57
|
+
end
|
58
|
+
|
59
|
+
def self.send_notification
|
60
|
+
init_booking_decorator
|
61
|
+
return @notification.send_notification_to_receiver
|
62
|
+
end
|
63
|
+
|
64
|
+
def self.get_user_booking_notification
|
65
|
+
init_booking_decorator
|
66
|
+
@notification = UserBookingNotification.new(@notification)
|
67
|
+
end
|
68
|
+
|
69
|
+
def self.get_user_booking_notification_subject
|
70
|
+
init_booking_decorator
|
71
|
+
@notification = UserBookingNotification.new(@notification)
|
72
|
+
return @notification.get_subject
|
73
|
+
end
|
74
|
+
|
75
|
+
def self.user_send_notification
|
76
|
+
init_booking_decorator
|
77
|
+
@notification = UserBookingNotification.new(@notification)
|
78
|
+
return @notification.send_notification_to_sender
|
79
|
+
end
|
80
|
+
end
|
81
|
+
|
82
|
+
|
83
|
+
|
data/lib/Content.rb
CHANGED
@@ -1,37 +1,39 @@
|
|
1
|
-
require_relative 'A_User'
|
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
|
-
|
1
|
+
require_relative 'A_User'
|
2
|
+
require 'date'
|
3
|
+
|
4
|
+
module Content
|
5
|
+
def self.review_content
|
6
|
+
return {
|
7
|
+
"id" => "3",
|
8
|
+
"reviewee" => AUser.receiver,
|
9
|
+
"content" => "Very good tutor",
|
10
|
+
"review_stars" => "4",
|
11
|
+
"user_id" => AUser.sender[:id]
|
12
|
+
}
|
13
|
+
end
|
14
|
+
|
15
|
+
def self.booking_content
|
16
|
+
return {
|
17
|
+
"id" => "4",
|
18
|
+
"date" => DateTime.now,
|
19
|
+
"location" => {
|
20
|
+
"longitude" => "-6.243153391200242",
|
21
|
+
"latitude" => "53.348738600000004"
|
22
|
+
},
|
23
|
+
"user_id" => AUser.sender[:id],
|
24
|
+
"user_booked" => AUser.receiver,
|
25
|
+
"hours_booked" => "4"
|
26
|
+
}
|
27
|
+
end
|
28
|
+
|
29
|
+
def self.inbox_content
|
30
|
+
return {
|
31
|
+
"id" => "5",
|
32
|
+
"message_to" => AUser.receiver,
|
33
|
+
"message_from" => AUser.sender,
|
34
|
+
"status" => "unread",
|
35
|
+
"user_id" => AUser.sender[:id],
|
36
|
+
"message_content" => "Hi, I will like to book you for a session."
|
37
|
+
}
|
38
|
+
end
|
37
39
|
end
|
@@ -1,66 +1,66 @@
|
|
1
|
-
require_relative '
|
2
|
-
require_relative 'NotificationDb'
|
3
|
-
require_relative "Content.rb"
|
4
|
-
|
5
|
-
require "async"
|
6
|
-
|
7
|
-
|
8
|
-
module InboxNotificationDecorator
|
9
|
-
|
10
|
-
def self.set_action(action)
|
11
|
-
@action = action
|
12
|
-
end
|
13
|
-
|
14
|
-
|
15
|
-
def self.set_content
|
16
|
-
@content = Content.inbox_content
|
17
|
-
end
|
18
|
-
|
19
|
-
def self.set_sender
|
20
|
-
@sender = NotificationDb.get_sender
|
21
|
-
end
|
22
|
-
|
23
|
-
def self.set_receiver
|
24
|
-
@receiver = NotificationDb.get_receiver
|
25
|
-
end
|
26
|
-
|
27
|
-
|
28
|
-
def self.init_inbox_decorator
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
@
|
34
|
-
end
|
35
|
-
|
36
|
-
def self.get_inbox_action
|
37
|
-
init_inbox_decorator
|
38
|
-
return @
|
39
|
-
end
|
40
|
-
|
41
|
-
def self.get_inbox_content
|
42
|
-
init_inbox_decorator
|
43
|
-
content = @
|
44
|
-
inbox_content = content["message_content"]
|
45
|
-
return true if inbox_content
|
46
|
-
end
|
47
|
-
|
48
|
-
def self.get_inbox_sender
|
49
|
-
init_inbox_decorator
|
50
|
-
return @
|
51
|
-
end
|
52
|
-
|
53
|
-
def self.get_inbox_receiver
|
54
|
-
init_inbox_decorator
|
55
|
-
return @
|
56
|
-
end
|
57
|
-
|
58
|
-
def self.send_notification
|
59
|
-
init_inbox_decorator
|
60
|
-
return @
|
61
|
-
end
|
62
|
-
|
63
|
-
end
|
64
|
-
|
65
|
-
|
66
|
-
|
1
|
+
require_relative 'bat_notifications'
|
2
|
+
require_relative 'NotificationDb'
|
3
|
+
require_relative "Content.rb"
|
4
|
+
|
5
|
+
require "async"
|
6
|
+
|
7
|
+
|
8
|
+
module InboxNotificationDecorator
|
9
|
+
|
10
|
+
def self.set_action(action)
|
11
|
+
@action = action
|
12
|
+
end
|
13
|
+
|
14
|
+
|
15
|
+
def self.set_content
|
16
|
+
@content = Content.inbox_content
|
17
|
+
end
|
18
|
+
|
19
|
+
def self.set_sender
|
20
|
+
@sender = NotificationDb.get_sender
|
21
|
+
end
|
22
|
+
|
23
|
+
def self.set_receiver
|
24
|
+
@receiver = NotificationDb.get_receiver
|
25
|
+
end
|
26
|
+
|
27
|
+
|
28
|
+
def self.init_inbox_decorator
|
29
|
+
set_content
|
30
|
+
set_sender
|
31
|
+
set_receiver
|
32
|
+
@notification = Notification.new(@sender, @receiver, @content)
|
33
|
+
@notification = InboxNotification.new(@notification)
|
34
|
+
end
|
35
|
+
|
36
|
+
def self.get_inbox_action
|
37
|
+
init_inbox_decorator
|
38
|
+
return @notification.get_action
|
39
|
+
end
|
40
|
+
|
41
|
+
def self.get_inbox_content
|
42
|
+
init_inbox_decorator
|
43
|
+
content = @notification.get_content
|
44
|
+
inbox_content = content["message_content"]
|
45
|
+
return true if inbox_content
|
46
|
+
end
|
47
|
+
|
48
|
+
def self.get_inbox_sender
|
49
|
+
init_inbox_decorator
|
50
|
+
return @notification.get_sender["lastname"]
|
51
|
+
end
|
52
|
+
|
53
|
+
def self.get_inbox_receiver
|
54
|
+
init_inbox_decorator
|
55
|
+
return @notification.get_receiver["lastname"]
|
56
|
+
end
|
57
|
+
|
58
|
+
def self.send_notification
|
59
|
+
init_inbox_decorator
|
60
|
+
return @notification.send_notification_to_receiver
|
61
|
+
end
|
62
|
+
|
63
|
+
end
|
64
|
+
|
65
|
+
|
66
|
+
|