Skip to content

Commit

Permalink
Merge pull request #99 from Fullscreen/use-fetch-and-fetch_all-both
Browse files Browse the repository at this point in the history
Try to make test pass - see if it's working on Travis
  • Loading branch information
kangkyu committed Oct 16, 2017
2 parents a2a4c70 + 1ad6d54 commit 78e6453
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 4 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@ For more information about changelogs, check
[Keep a Changelog](http://keepachangelog.com) and
[Vandamme](http://tech-angels.github.io/vandamme).

## 0.2.30 - 2017/10/16

* [BUGFIX] Test should pass when call Page#videos. Partly revert the change
of version 0.2.28

## 0.2.29 - 2017/10/16

* [ENHANCEMENT] Use request to get app access token. Do not use
Expand Down
2 changes: 1 addition & 1 deletion lib/funky/connections/api.rb
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ def self.fetch_multiple_pages(uri)
json = json_for(uri)
if json[:data].empty?
@try_count ||= 0
if @previous_timestamp && @try_count < 1 && (Date.parse @previous_timestamp rescue nil)
if @previous_timestamp && @try_count < 10 && (Date.parse @previous_timestamp rescue nil)
timestamp = (Date.parse(@previous_timestamp) - 1).strftime('%F')
@try_count += 1
@previous_timestamp = timestamp
Expand Down
9 changes: 7 additions & 2 deletions lib/funky/page.rb
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,13 @@ def self.find(page_id)
# fetched by Facebook Graph API.
def videos(options = {})
path_query = "#{id}/videos?fields=id,title,description,created_time,length,comments.limit(0).summary(true),likes.limit(0).summary(true),reactions.limit(0).summary(true)"
path_query << "&since=#{options[:since]}" if options[:since]
videos = Funky::Connection::API.fetch_all(path_query)
videos = []
if options[:since]
path_query << "&since=#{options[:since]}"
videos = Funky::Connection::API.fetch_all(path_query)
else
videos = Funky::Connection::API.fetch(path_query, is_array: true)
end
videos.map {|video| Video.new(video) }
end

Expand Down
2 changes: 1 addition & 1 deletion lib/funky/version.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module Funky
VERSION = "0.2.29"
VERSION = "0.2.30"
end

0 comments on commit 78e6453

Please sign in to comment.