class ContentNetwork::EntriesFetcher
Public Class Methods
new(path_params = {}, pagination_params = {})
click to toggle source
# File lib/content_network/entries_fetcher.rb, line 3 def initialize(path_params = {}, pagination_params = {}) @path_params = PathParams.build(path_params) @pagination_params = PaginationParams.build(pagination_params) end
Public Instance Methods
fetch()
click to toggle source
# File lib/content_network/entries_fetcher.rb, line 8 def fetch response = execute_query Collection.new(response.body) end
Private Instance Methods
build_query()
click to toggle source
# File lib/content_network/entries_fetcher.rb, line 21 def build_query URI.encode_www_form(@pagination_params.to_h) end
build_uri()
click to toggle source
# File lib/content_network/entries_fetcher.rb, line 25 def build_uri path = @path_params.path URI.join(ContentNetwork.base_uri, path) end
execute_query()
click to toggle source
# File lib/content_network/entries_fetcher.rb, line 15 def execute_query uri = build_uri uri.query = build_query Net::HTTP.get_response(uri) end