fb_page_api 0.0.3 → 0.0.4

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: 6a394ee438f8ff148dc5dc0660b3eaa200883af0
4
- data.tar.gz: 1501899c12a975ff3b89d4b3b2ef8670c42fec12
3
+ metadata.gz: 2c06efeb097f935b89a6afa536ad53664fbd7ab3
4
+ data.tar.gz: 73e9f993b4866058d5fb438ddb6115df12c29144
5
5
  SHA512:
6
- metadata.gz: 9cbd2a75a51e7708516774cbec553e595d5a642984f3780767da46c0adc33dddeff10776c7d334ebe93bb685f4afc9af52299d32d7f310e603def732b66c4874
7
- data.tar.gz: 86f30898ab8e33505448528e2a2229cc275d10bf69cd14804e860e88cf8076710c6bbbd77f12e42d8a62b2d371841eb628f2b5b3b9bf249dc5461f06ccf1ce86
6
+ metadata.gz: c5f07d486cf12951e2b048a5ee5d01cc47c88b5374cbbbcc90e4dabaca02017d6b5b90f52dcc630e2bbb0b418e318fc8ab268fd2c644677ab2b5de33cefc671a
7
+ data.tar.gz: 7d072576a8e430332d900f5dbd065bf1956ec57379e708c3d17ecec533646883267fab14a38c47198cf2d2b2cd807758fa8f30a54d0c2660732515ccbcc4ef75
data/lib/fb_page_api.rb CHANGED
@@ -18,4 +18,12 @@ module FbPageApi
18
18
  def admin_notes
19
19
  FbPageApi::Edge::AdminNote.new
20
20
  end
21
+
22
+ def conversations
23
+ FbPageApi::Edge::Conversation.new
24
+ end
25
+
26
+ def users
27
+ FbPageApi::Edge::User.new
28
+ end
21
29
  end
@@ -1,3 +1,5 @@
1
1
  require "fb_page_api/edge/base"
2
2
  require "fb_page_api/edge/admin_label"
3
3
  require "fb_page_api/edge/admin_note"
4
+ require "fb_page_api/edge/conversation"
5
+ require "fb_page_api/edge/user"
@@ -1,7 +1,7 @@
1
1
  module FbPageApi
2
2
  module Edge
3
3
  class Base
4
- attr_accessor :parent_id, :page_after, :page_before
4
+ attr_accessor :parent_id, :page_after, :page_before, :next_url
5
5
 
6
6
  def initialize(parent_id = Config.page_id)
7
7
  self.parent_id = parent_id
@@ -11,11 +11,19 @@ module FbPageApi
11
11
  options = args.extract_options!
12
12
  @collection = []
13
13
  begin
14
- rs = http_request(:get, api_endpoint, query: body_params(options))
14
+ rs = http_request(:get, self.next_url || api_endpoint, query: body_params(options))
15
15
  data = rs.parsed_response['data']
16
16
  if data.present?
17
17
  @collection = @collection | data
18
- self.page_after = rs.parsed_response['paging']['cursors']['after']
18
+ if rs.parsed_response['paging']['cursors'].present?
19
+ self.page_after = rs.parsed_response['paging']['cursors']['after']
20
+ self.next_url = nil
21
+ elsif rs.parsed_response['paging']['next'].present?
22
+ self.next_url = rs.parsed_response['paging']['next']
23
+ self.page_after = nil
24
+ else
25
+ data = []
26
+ end
19
27
  end
20
28
  end while data.present?
21
29
  @collection
@@ -0,0 +1,13 @@
1
+ module FbPageApi
2
+ module Edge
3
+ class Conversation < Base
4
+ def edge_name
5
+ 'conversations'
6
+ end
7
+
8
+ def request_fields
9
+ ['link', 'id']
10
+ end
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,9 @@
1
+ module FbPageApi
2
+ module Edge
3
+ class User < Base
4
+ def request_fields
5
+ ['name', 'id']
6
+ end
7
+ end
8
+ end
9
+ end
@@ -1,3 +1,3 @@
1
1
  module FbPageApi
2
- VERSION = "0.0.3"
2
+ VERSION = "0.0.4"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fb_page_api
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tuan Mai
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-05-12 00:00:00.000000000 Z
11
+ date: 2016-05-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -103,6 +103,8 @@ files:
103
103
  - lib/fb_page_api/edge/admin_note.rb
104
104
  - lib/fb_page_api/edge/all.rb
105
105
  - lib/fb_page_api/edge/base.rb
106
+ - lib/fb_page_api/edge/conversation.rb
107
+ - lib/fb_page_api/edge/user.rb
106
108
  - lib/fb_page_api/version.rb
107
109
  homepage: http://github.com/tuanmai/fb_page_api
108
110
  licenses: []