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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 8034fd3f3afb91d27f11300b42e15e07c92808c473daec3459f82c14ab772ff6
4
- data.tar.gz: f656f97d23da62a99d618ec197ddf8f3b9f3d8c818d71ed16d27cb35b8d25123
3
+ metadata.gz: '059a4dd680f130343508367f8a4d661ea3de1ef4bd74fa6b700d9ddd323e41c4'
4
+ data.tar.gz: 68d9b31fcc64272a7c7df41764ffda58c4066af19fc7132346e7dcfc7ab0ceaa
5
5
  SHA512:
6
- metadata.gz: afc81df11373573a7ce572a09574f7c5159f278f3173a924202b1f0f11cd913922f89caaac117901eca27c4634576180733050da46f839c2b714b40ce4d8b068
7
- data.tar.gz: 97e1f728a14dd6f67af0985a2d382753579fd160c16866b85946e19d855d15ec2c8ed9ed24d921cdddde2c2064e76541a145abac090360bd2670bec57f15cf82
6
+ metadata.gz: c09a4393cab84897c62bd0c980dd8e2a7315f94e34fa181bd2d0f43346c5ecfd9e9e04fd579e86095633cb8d79a93f908a004a67673dccda7c1751ff0f40e36c
7
+ data.tar.gz: d3f9ad82007908d96c2d3a96d85fb7436af46643bc4e7ca08341f7e93f458bbd9e41248c92caa06fbf817fd08b43d0e3fc8978bec62c0ada6e267d6dfee4b555
data/.gitignore CHANGED
@@ -9,3 +9,5 @@
9
9
 
10
10
  # rspec failure tracking
11
11
  .rspec_status
12
+
13
+ *.gem
data/CHANGELOG.md CHANGED
@@ -1,5 +1,4 @@
1
- ## [Unreleased]
2
-
3
1
  ## [0.1.0] - 2021-07-15
4
2
 
3
+ - Send unread messages to your email address
5
4
  - Initial release
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- fuck_facebook (0.1.0)
4
+ fuck_facebook (0.1.1)
5
5
  activesupport (~> 6.1)
6
6
  highline (~> 2.0)
7
7
  mail (~> 2.7)
@@ -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('>= 3.0.1')
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
 
@@ -1,3 +1,3 @@
1
1
  module FuckFacebook
2
- VERSION = '0.1.0'.freeze
2
+ VERSION = '0.1.1'.freeze
3
3
  end
@@ -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(message_thread: message_thread, text: text, read: read, timestamp: timestamp)
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.0
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: 3.0.1
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
  - - ">="