Permalink
Browse files

Merge pull request #277 from arsduo/test-suite-refactor

[2.0] Restructure Test Suite
  • Loading branch information...
2 parents 95c1c8a + 5095ef2 commit e7b31ce801d7b49918dd40002729b1bd4760fb74 @arsduo committed Jan 25, 2013
View
@@ -5,6 +5,9 @@ Internal improvements:
* CHANGED: Gem version restrictions have been removed, and versions updated.
* CHANGED: How support files are loaded in spec_helper has been improved.
+Testing improvements:
+* FIXED: MockHTTPService compares Ruby objects rather than strings.
+
v1.6
====
View
@@ -368,6 +368,21 @@ def get_page_access_token(id, args = {}, options = {}, &block)
block ? block.call(access_token) : access_token
end
+ # Get an access token information
+ # The access token used to instantiate the API object needs to be
+ # the app access token or a valid User Access Token from a developer of the app.
+ # See https://developers.facebook.com/docs/howtos/login/debugging-access-tokens/#step1
+ #
+ # @param input_token the access token you want to inspect
+ # @param block (see Koala::Facebook::API#api)
+ #
+ # @return a JSON array containing data and a map of fields
+ def debug_token(input_token, &block)
+ access_token_info = graph_call("debug_token", {:input_token => input_token})
+
+ block ? block.call(access_token_info) : access_token_info
+ end
+
# Fetches the comments from fb:comments widgets for a given set of URLs (array or comma-separated string).
# See https://developers.facebook.com/blog/post/490.
#
@@ -6,22 +6,22 @@ class API
# A light wrapper for collections returned from the Graph API.
# It extends Array to allow you to page backward and forward through
# result sets, and providing easy access to paging information.
- class GraphCollection < Array
-
+ class GraphCollection < Array
+
# The raw paging information from Facebook (next/previous URLs).
attr_reader :paging
# @return [Koala::Facebook::GraphAPI] the api used to make requests.
attr_reader :api
# The entire raw response from Facebook.
attr_reader :raw_response
-
+
# Initialize the array of results and store various additional paging-related information.
- #
+ #
# @param response the response from Facebook (a hash whose "data" key is an array)
# @param api the Graph {Koala::Facebook::API API} instance to use to make calls
# (usually the API that made the original call).
#
- # @return [Koala::Facebook::GraphCollection] an initialized GraphCollection
+ # @return [Koala::Facebook::GraphCollection] an initialized GraphCollection
# whose paging, raw_response, and api attributes are populated.
def initialize(response, api)
super response["data"]
@@ -31,50 +31,50 @@ def initialize(response, api)
end
# @private
- # Turn the response into a GraphCollection if they're pageable;
+ # Turn the response into a GraphCollection if they're pageable;
# if not, return the original response.
# The Ads API (uniquely so far) returns a hash rather than an array when queried
- # with get_connections.
+ # with get_connections.
def self.evaluate(response, api)
response.is_a?(Hash) && response["data"].is_a?(Array) ? self.new(response, api) : response
end
-
+
# Retrieve the next page of results.
- #
+ #
# @return a GraphCollection array of additional results (an empty array if there are no more results)
def next_page
base, args = next_page_params
base ? @api.get_page([base, args]) : nil
end
-
+
# Retrieve the previous page of results.
- #
+ #
# @return a GraphCollection array of additional results (an empty array if there are no earlier results)
def previous_page
base, args = previous_page_params
base ? @api.get_page([base, args]) : nil
end
-
- # Arguments that can be sent to {Koala::Facebook::API#graph_call} to retrieve the next page of results.
- #
+
+ # Arguments that can be sent to {Koala::Facebook::API#graph_call} to retrieve the next page of results.
+ #
# @example
# @api.graph_call(*collection.next_page_params)
#
# @return an array of arguments, or nil if there are no more pages
def next_page_params
@paging && @paging["next"] ? parse_page_url(@paging["next"]) : nil
end
-
- # Arguments that can be sent to {Koala::Facebook::API#graph_call} to retrieve the previous page of results.
- #
+
+ # Arguments that can be sent to {Koala::Facebook::API#graph_call} to retrieve the previous page of results.
+ #
# @example
# @api.graph_call(*collection.previous_page_params)
#
# @return an array of arguments, or nil if there are no previous pages
def previous_page_params
@paging && @paging["previous"] ? parse_page_url(@paging["previous"]) : nil
end
-
+
# @private
def parse_page_url(url)
GraphCollection.parse_page_url(url)
@@ -102,9 +102,9 @@ def self.parse_page_url(url)
end
end
end
-
+
# @private
- # legacy support for when GraphCollection lived directly under Koala::Facebook
+ # legacy support for when GraphCollection lived directly under Koala::Facebook
GraphCollection = API::GraphCollection
end
end
@@ -218,4 +218,4 @@ def self.deprecated_interface
Faraday.default_adapter = :net_http
end
end
-end
+end
Oops, something went wrong.

0 comments on commit e7b31ce

Please sign in to comment.