Sha256: cbfa7d18a80dce16507480e9e1c268253407419d6d22e1474102b09a5f2bc6b0
Contents?: true
Size: 1.1 KB
Versions: 15
Compression:
Stored size: 1.1 KB
Contents
# HEY HACKER! THIS IS AN AUTO-GENERATED FILE. # So don't bother editing it. To see how it's built, take a look at the Rakefile module SuggestMethods # Returns Word strings based on the input. # def get_tag_suggestions(word, *args) http_method = :get path = '/suggest/tags/{word}' path.sub!('{word}', word.to_s) # Ruby turns all key-value arguments at the end into a single hash # e.g. Wordnik.word.get_examples('dingo', :limit => 10, :part_of_speech => 'verb') # becomes {:limit => 10, :part_of_speech => 'verb'} last_arg = args.pop if args.last.is_a?(Hash) last_arg = args.pop if args.last.is_a?(Array) last_arg ||= {} # Look for a kwarg called :request_only, whose presence indicates # that we want the request itself back, not the response body if last_arg.is_a?(Hash) && last_arg[:request_only].present? request_only = true last_arg.delete(:request_only) end params = last_arg body ||= {} request = Wordnik::Request.new(http_method, path, :params => params, :body => body) request_only ? request : request.response.body end end
Version data entries
15 entries across 15 versions & 1 rubygems