fuck_facebook 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +2 -0
- data/CHANGELOG.md +1 -2
- data/Gemfile.lock +1 -1
- data/fuck_facebook.gemspec +1 -1
- data/lib/fuck_facebook/version.rb +1 -1
- data/src/message_handler.rb +19 -5
- metadata +5 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: '059a4dd680f130343508367f8a4d661ea3de1ef4bd74fa6b700d9ddd323e41c4'
|
4
|
+
data.tar.gz: 68d9b31fcc64272a7c7df41764ffda58c4066af19fc7132346e7dcfc7ab0ceaa
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c09a4393cab84897c62bd0c980dd8e2a7315f94e34fa181bd2d0f43346c5ecfd9e9e04fd579e86095633cb8d79a93f908a004a67673dccda7c1751ff0f40e36c
|
7
|
+
data.tar.gz: d3f9ad82007908d96c2d3a96d85fb7436af46643bc4e7ca08341f7e93f458bbd9e41248c92caa06fbf817fd08b43d0e3fc8978bec62c0ada6e267d6dfee4b555
|
data/.gitignore
CHANGED
data/CHANGELOG.md
CHANGED
data/Gemfile.lock
CHANGED
data/fuck_facebook.gemspec
CHANGED
@@ -13,7 +13,7 @@ Gem::Specification.new do |spec|
|
|
13
13
|
DESCRIPTION
|
14
14
|
spec.homepage = 'https://gitlab.com/keeyan/fuck_facebook'
|
15
15
|
spec.license = 'MIT'
|
16
|
-
spec.required_ruby_version = Gem::Requirement.new('>=
|
16
|
+
spec.required_ruby_version = Gem::Requirement.new('>= 2.7.0', '< 3.1')
|
17
17
|
|
18
18
|
spec.metadata['allowed_push_host'] = 'https://rubygems.org'
|
19
19
|
|
data/src/message_handler.rb
CHANGED
@@ -32,15 +32,29 @@ class MessageHandler
|
|
32
32
|
def messages_for_chats(chats)
|
33
33
|
chats.map do |chat|
|
34
34
|
message_thread = MessageThread.new(title: xpaths.child_element(chat, :messages, :title_relative).text)
|
35
|
-
text = xpaths.child_element(chat, :messages, :text_relative).text
|
36
|
-
read = !xpaths.element_has_child?(chat, :messages, :mark_as_read_button_relative)
|
37
|
-
message_time_ago = xpaths.child_element(chat, :messages, :time_sent_ago_relative).text
|
38
|
-
timestamp = FbDuration.parse_to_time(message_time_ago)
|
39
35
|
|
40
|
-
Message.new(
|
36
|
+
Message.new(
|
37
|
+
message_thread: message_thread,
|
38
|
+
text: chat_text(chat),
|
39
|
+
read: chat_read?(chat),
|
40
|
+
timestamp: chat_timestamp(chat)
|
41
|
+
)
|
41
42
|
end
|
42
43
|
end
|
43
44
|
|
45
|
+
def chat_text(chat)
|
46
|
+
xpaths.child_element(chat, :messages, :text_relative).text
|
47
|
+
end
|
48
|
+
|
49
|
+
def chat_read?(chat)
|
50
|
+
!xpaths.element_has_child?(chat, :messages, :mark_as_read_button_relative)
|
51
|
+
end
|
52
|
+
|
53
|
+
def chat_timestamp(chat)
|
54
|
+
message_time_ago = xpaths.child_element(chat, :messages, :time_sent_ago_relative).text
|
55
|
+
FbDuration.parse_to_time(message_time_ago)
|
56
|
+
end
|
57
|
+
|
44
58
|
def messages_after_last_message_time(messages)
|
45
59
|
last_message_time = Storage.get(:last_message_time, default: Time.new(2004, 2, 4))
|
46
60
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fuck_facebook
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Keeyan Nejad
|
@@ -125,7 +125,10 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
125
125
|
requirements:
|
126
126
|
- - ">="
|
127
127
|
- !ruby/object:Gem::Version
|
128
|
-
version:
|
128
|
+
version: 2.7.0
|
129
|
+
- - "<"
|
130
|
+
- !ruby/object:Gem::Version
|
131
|
+
version: '3.1'
|
129
132
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
130
133
|
requirements:
|
131
134
|
- - ">="
|