secondHandler 1.2.5 → 1.2.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/fb_data_handler.rb +0 -2
- data/lib/parser_collection.rb +11 -7
- data/lib/second_handler.rb +5 -2
- data/lib/second_handler/version.rb +2 -2
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a14ea04282e1a681932eb9e3938a50dbe79ecf8b
|
4
|
+
data.tar.gz: 8b0e9c3e7c9a979e547665e91e5bb01e39c5edd7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 536f8d29d9caff9ea5f04968960da44fee6091771cfd1d61a58133caaeadad37e7a3921239e3be90d9697dba1a0993a21016a50d3991f7313a937be70089d23a
|
7
|
+
data.tar.gz: 28df91c6935f4817ce6a2a203075d6a4aa8050bf72cf573fbe42de4045bb5462d285b0eb9678d3eed7ced003fcfd06041e185cdb8c919d859cef1555171dd0cf
|
data/lib/fb_data_handler.rb
CHANGED
data/lib/parser_collection.rb
CHANGED
@@ -1,12 +1,12 @@
|
|
1
1
|
module FBParsers
|
2
2
|
|
3
|
-
@@
|
3
|
+
@@basic_sell_parser = lambda do |message|
|
4
4
|
price = nil
|
5
5
|
title = nil
|
6
6
|
message_body = nil
|
7
7
|
price_regex = /NT\$([\d,\.]+)/
|
8
8
|
lines = message.split("\n")
|
9
|
-
if lines.length
|
9
|
+
if lines.length > 3
|
10
10
|
unless price_regex.match(lines[1]).nil?
|
11
11
|
|
12
12
|
price = price_regex.match(lines[1])[1]
|
@@ -14,17 +14,21 @@ module FBParsers
|
|
14
14
|
end
|
15
15
|
if not price.nil?
|
16
16
|
|
17
|
-
{"price" => price.gsub(",","").to_i , "title" => lines[0] ,"message" => lines[
|
17
|
+
{"price" => price.gsub(",","").to_i , "title" => lines[0] ,"message" => lines[3..-1].join("\n")}
|
18
18
|
else
|
19
19
|
raise ArgumentError, "message parse fail"
|
20
20
|
end
|
21
21
|
|
22
22
|
end
|
23
23
|
@@tools = {
|
24
|
-
"1730742887066429" => @@
|
25
|
-
"144498012423141" => @@
|
26
|
-
"107793636088378" => @@
|
27
|
-
"191505604299442" => @@
|
24
|
+
"1730742887066429" => @@basic_sell_parser,
|
25
|
+
"144498012423141" => @@basic_sell_parser,
|
26
|
+
"107793636088378" => @@basic_sell_parser,
|
27
|
+
"191505604299442" => @@basic_sell_parser,
|
28
|
+
"815837461828111" => @@basic_sell_parser,
|
29
|
+
"952367224814302" => @@basic_sell_parser,
|
30
|
+
"373766972786317" => @@basic_sell_parser,
|
31
|
+
"1049467665068019" => @@basic_sell_parser,
|
28
32
|
}
|
29
33
|
|
30
34
|
def self.message_parser (gid)
|
data/lib/second_handler.rb
CHANGED
@@ -36,7 +36,6 @@ module SecondHandler
|
|
36
36
|
|
37
37
|
def first_comment
|
38
38
|
@comment = @graph.get_connections(@post_id, "comments",
|
39
|
-
:limit=>1,
|
40
39
|
:fields => ["from{name,id,picture}",
|
41
40
|
"id",
|
42
41
|
"message",
|
@@ -148,7 +147,11 @@ module SecondHandler
|
|
148
147
|
data = Array.new
|
149
148
|
@feed.to_a.each do |single_post|
|
150
149
|
begin
|
151
|
-
|
150
|
+
if func.nil?
|
151
|
+
data << clean_post_content(single_post, &@message_parser)
|
152
|
+
else
|
153
|
+
data << clean_post_content(single_post, &func)
|
154
|
+
end
|
152
155
|
rescue
|
153
156
|
end
|
154
157
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: secondHandler
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.2.
|
4
|
+
version: 1.2.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sheng Jung Wu
|
@@ -11,7 +11,7 @@ authors:
|
|
11
11
|
autorequire:
|
12
12
|
bindir: bin
|
13
13
|
cert_chain: []
|
14
|
-
date: 2016-01-
|
14
|
+
date: 2016-01-09 00:00:00.000000000 Z
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: minitest
|