lib/storyblok/client.rb in storyblok-2.0.3 vs lib/storyblok/client.rb in storyblok-2.0.4
- old
+ new
@@ -39,10 +39,20 @@
end
setup_logger
end
+ # Dynamic cdn endpoint call
+ #
+ # @param [String] id
+ # @param [Hash] query
+ #
+ # @return [Hash]
+ def get_from_cdn(slug, query = {}, id = nil)
+ Request.new(self, "/cdn/#{slug}", query, id).get
+ end
+
# Gets the space info
#
# @param [Hash] query
#
# @return [Hash]
@@ -206,10 +216,10 @@
{'headers' => res.headers, 'data' => JSON.parse(res.body)}.to_json
end
# Patches a query hash with the client configurations for queries
def request_query(query)
- query[:token] = configuration[:token]
+ query[:token] = configuration[:token] if query[:token].nil?
query[:version] = configuration[:version] if query[:version].nil?
query[:cv] = configuration[:cache_version] if query[:cache_version].nil?
query
end