Sha256: b014297d3622e3565779853419a6c84ca966f76bca53d073703767744fc357f6

Contents?: true

Size: 1.04 KB

Versions: 5

Compression:

Stored size: 1.04 KB

Contents

module Wordnik

  class Configuration

    # Wordnik credentials
    attr_accessor :api_key
    attr_accessor :username
    attr_accessor :password
    
    # TODO: Steal all the auth stuff from the old gem!
    attr_accessor :auth_token
    attr_accessor :user_id
    
    # Response format can be :json (default) or :xml
    attr_accessor :response_format
    
    # A comma-delimited list of the API's resources
    attr_accessor :resource_names
    
    # The URL of the API server
    attr_accessor :base_uri
    
    # Defaults go in here..
    def initialize
      @response_format = :json
      @base_uri = 'api.wordnik.com/v4'
      
      # Build the default set of resource names from the filenames of the API documentation
      begin
        api_docs_path = File.join(File.dirname(__FILE__), "../../api_docs")
        @resource_names = `find #{api_docs_path} -name '*.json'`.split("\n").map {|f| f.split("/").last.sub('.json', '') }
      rescue
        raise "Problem loading the resource files in ./api_docs/"
      end
      
    end

  end

end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
wordnik-4.06.05 lib/wordnik/configuration.rb
wordnik-4.06.04 lib/wordnik/configuration.rb
wordnik-4.06.02 lib/wordnik/configuration.rb
wordnik-4.06.01 lib/wordnik/configuration.rb
wordnik-4.06.00 lib/wordnik/configuration.rb