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

Version Path
wordnik-0.4.0 Rakefile
wordnik-0.3.9 Rakefile
wordnik-0.3.8 Rakefile
wordnik-0.3.7 Rakefile
wordnik-0.3.6 Rakefile
wordnik-0.3.5 Rakefile
wordnik-0.3.4 Rakefile
wordnik-0.3.2 Rakefile
wordnik-0.3.1 Rakefile
wordnik-0.3.0 Rakefile