Sha256: 69b555a04ee27fb07fb00cc5981a4321f218a8a075824ac8540a6ec474d9cb6d
Contents?: true
Size: 691 Bytes
Versions: 10
Compression:
Stored size: 691 Bytes
Contents
require 'bundler' Bundler::GemHelper.install_tasks require 'rspec/core/rake_task' require 'wordnik' RSpec::Core::RakeTask.new('spec') # If you want to make this the default task task :default => :spec desc 'Download the API docs to disk' task :fetch_api_docs do Wordnik.configure Wordnik.resource_names.each do |resource_name| # Roll in API key headers = {} # headers[:api_key] = params[:api_key] if params[:api_key].present? request = Wordnik::Request.new(:get, "#{resource_name}.json", :headers => headers) filename = "api_docs/#{resource_name}.json" File.open(filename, 'w') {|f| f.write(request.response.raw.body) } puts filename end end
Version data entries
10 entries across 10 versions & 1 rubygems