fb_scrape 0.0.7 → 0.0.8

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
  SHA1:
3
- metadata.gz: 1ab5def24d779332f6b0cef2b22cad529d688965
4
- data.tar.gz: 933385cdea599dcd0e03cba569bc2b69c1c38e4e
3
+ metadata.gz: a990a8a5717489cc8e4a670232d99a873e705d81
4
+ data.tar.gz: c2be56834af3ae1d968f62ac19d4d1aeb5d42ccb
5
5
  SHA512:
6
- metadata.gz: 0df57427570ab8c6b6a9a690590169217f7c2de8371ff02a60dfbe096a1087691dd6012b7911fa988e67f8c99c69024d8cbd6e70a89ac02d9347afb873cec090
7
- data.tar.gz: 77ee341b0732ef947985e05dd385a921f0259bfa7d63bd1eb1fa77cfcd98ab51423478f7e39649a58a2415143171d936a1f8da459c2f7b25c7566244ef986f45
6
+ metadata.gz: 8164a7e6ee628edf4d66b9b238a6f31a8b25acdf8872a98072bce187580f31ed8676c4688be85aca0fbcc8441d342885b051cd816678fdeaa4e62be623410e1e
7
+ data.tar.gz: '08dd959a6c0b71271afc521ffd332d6d23199744ae05edc8e0d2aa8d4e1fd47b861da71beda08344628c69f2e7d20139a9a1064c404458b66e2d5eae41051a5c'
@@ -29,12 +29,12 @@ class FBScrape::Conversation
29
29
  end
30
30
 
31
31
  def load_initial_messages
32
- url = "https://graph.facebook.com/v#{FBScrape::GRAPH_VERSION}/#{@id}?access_token=#{@token}&fields=messages{message,to,from}"
32
+ url = "https://graph.facebook.com/v#{FBScrape::GRAPH_VERSION}/#{@id}?access_token=#{@token}&fields=messages{message,to,from,created_time}"
33
33
  load_from_url url
34
34
  end
35
35
 
36
36
  def load_more_messages
37
- url = "https://graph.facebook.com/v#{FBScrape::GRAPH_VERSION}/#{@id}?access_token=#{@token}&fields=messages{message,to,from}&limit=25&after=#{next_cursor}"
37
+ url = "https://graph.facebook.com/v#{FBScrape::GRAPH_VERSION}/#{@id}?access_token=#{@token}&fields=messages{message,to,from,created_time}&limit=25&after=#{next_cursor}"
38
38
  load_from_url url
39
39
  end
40
40
 
@@ -43,7 +43,7 @@ class FBScrape::Conversation
43
43
  case resp.code
44
44
  when 200
45
45
  response = JSON.parse(resp.body)
46
- @messages = @messages.concat(response['messages']['data'].collect { |m| FBScrape::Message.new(m, @page_id) })
46
+ @messages = @messages.concat(response['messages']['data'].collect { |m| FBScrape::Message.new(m, @id, @page_id) })
47
47
  @page_info = response['messages']['paging']
48
48
  when 400
49
49
  end
@@ -1,13 +1,14 @@
1
1
  class FBScrape::Message
2
- attr_accessor :id, :created_at, :from_name, :from_id, :text, :reply_id, :to_id, :to_name
2
+ attr_accessor :id, :created_at, :from_name, :from_id, :text, :reply_id, :to_id, :to_name, :conversation_id
3
3
 
4
4
 
5
- def initialize(payload, page_id=nil)
5
+ def initialize(payload, conversation_id, page_id=nil)
6
6
  @page_id = page_id
7
-
7
+ @conversation_id = conversation_id
8
+
8
9
  @id = payload['id']
9
10
  @text = payload['message']
10
- @created_at = payload['created_time']
11
+ @created_at = DateTime.strptime payload['created_time'] if payload['created_time']
11
12
 
12
13
  @from_id = payload['from']['id']
13
14
  @from_name = payload['from']['name']
@@ -1,3 +1,3 @@
1
1
  module FBScrape
2
- VERSION = "0.0.7"
2
+ VERSION = "0.0.8"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fb_scrape
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.7
4
+ version: 0.0.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Trevor Kimenye
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-12-02 00:00:00.000000000 Z
11
+ date: 2017-12-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler