lib/dato/api_client.rb in dato-0.6.2 vs lib/dato/api_client.rb in dato-0.6.3.beta
- old
+ new
@@ -28,13 +28,12 @@
@token = token
@base_url = options[:base_url] || "https://#{subdomain}.datocms.com"
@extra_headers = options[:extra_headers] || {}
end
- url = URI.parse("https://#{subdomain}.datocms.com/docs/#{subdomain}-hyperschema.json")
- response = Net::HTTP.get(url)
+ response = Faraday.get("https://#{subdomain}.datocms.com/docs/#{subdomain}-hyperschema.json")
- schema = JsonSchema.parse!(JSON.parse(response))
+ schema = JsonSchema.parse!(JSON.parse(response.body))
schema.expand_references!
schema.definitions.each do |type, schema|
is_collection = schema.links.select{|x| x.rel === "instances"}.any?