Permalink
Browse files

added samples

  • Loading branch information...
fehguy committed May 26, 2012
1 parent dc8ca5d commit 8d4f2ffe35459604ef124e7b027eacb77730f71a
Showing with 1,874 additions and 0 deletions.
  1. +163 −0 samples/wordnik-api-ruby/lib/Account_api.rb
  2. +210 −0 samples/wordnik-api-ruby/lib/WordList_api.rb
  3. +316 −0 samples/wordnik-api-ruby/lib/Word_api.rb
  4. +170 −0 samples/wordnik-api-ruby/lib/Words_api.rb
  5. +35 −0 samples/wordnik-api-ruby/models/ApiTokenStatus.rb
  6. +35 −0 samples/wordnik-api-ruby/models/AudioFile.rb
  7. +35 −0 samples/wordnik-api-ruby/models/AuthenticationToken.rb
  8. +35 −0 samples/wordnik-api-ruby/models/Bigram.rb
  9. +35 −0 samples/wordnik-api-ruby/models/Citation.rb
  10. +35 −0 samples/wordnik-api-ruby/models/ContentProvider.rb
  11. +35 −0 samples/wordnik-api-ruby/models/Definition.rb
  12. +35 −0 samples/wordnik-api-ruby/models/Example.rb
  13. +35 −0 samples/wordnik-api-ruby/models/ExampleSearchResults.rb
  14. +35 −0 samples/wordnik-api-ruby/models/ExampleUsage.rb
  15. +35 −0 samples/wordnik-api-ruby/models/Facet.rb
  16. +35 −0 samples/wordnik-api-ruby/models/Frequency.rb
  17. +35 −0 samples/wordnik-api-ruby/models/FrequencySummary.rb
  18. +35 −0 samples/wordnik-api-ruby/models/Label.rb
  19. +35 −0 samples/wordnik-api-ruby/models/Note.rb
  20. +35 −0 samples/wordnik-api-ruby/models/Related.rb
  21. +35 −0 samples/wordnik-api-ruby/models/ScoredWord.rb
  22. +35 −0 samples/wordnik-api-ruby/models/Sentence.rb
  23. +35 −0 samples/wordnik-api-ruby/models/StringValue.rb
  24. +35 −0 samples/wordnik-api-ruby/models/Syllable.rb
  25. +35 −0 samples/wordnik-api-ruby/models/TextPron.rb
  26. +35 −0 samples/wordnik-api-ruby/models/User.rb
  27. +35 −0 samples/wordnik-api-ruby/models/WordFrequency.rb
  28. +35 −0 samples/wordnik-api-ruby/models/WordList.rb
  29. +35 −0 samples/wordnik-api-ruby/models/WordListWord.rb
  30. +35 −0 samples/wordnik-api-ruby/models/WordObject.rb
  31. +35 −0 samples/wordnik-api-ruby/models/WordOfTheDay.rb
  32. +35 −0 samples/wordnik-api-ruby/models/WordSearchResult.rb
  33. +35 −0 samples/wordnik-api-ruby/models/WordSearchResults.rb
@@ -0,0 +1,163 @@
+require "uri"
+
+class Account_api
+ basePath = "http://api.wordnik.com/v4"
+ # apiInvoker = APIInvoker
+
+ def self.escapeString(string)
+ URI.encode(string.to_s)
+ end
+
+ def self.authenticate (username,password,opts={})
+ query_param_keys = [
+ :password]
+
+ # verify existence of params
+ raise "username is required" if username.nil?
+ raise "password is required" if password.nil?
+ # set default values and merge with input
+ options = {
+ :username=>username,
+ :password=>password,
+ }.merge(opts)
+
+ #resource path
+ path = "/account.{format}/authenticate/{username}".sub('{format}','json').sub('{' + 'username' + '}', escapeString(username))
+
+
+
+ # pull querystring keys from options
+ queryopts = options.select do |key,value|
+ query_param_keys.include? key
+ end
+
+ response = Swagger::Request.new(:GET, path, {:params=>queryopts,:headers=>nil, :body=>nil}).make.body
+ AuthenticationToken.new(response)
+
+ end
+
+
+ def self.authenticate_post (username,body,opts={})
+ query_param_keys = [
+ ]
+
+ # verify existence of params
+ raise "username is required" if username.nil?
+ raise "body is required" if body.nil?
+ # set default values and merge with input
+ options = {
+ :username=>username,
+ :body=>body,
+ }.merge(opts)
+
+ #resource path
+ path = "/account.{format}/authenticate/{username}".sub('{format}','json').sub('{' + 'username' + '}', escapeString(username))
+
+
+
+ # pull querystring keys from options
+ queryopts = options.select do |key,value|
+ query_param_keys.include? key
+ end
+
+ response = Swagger::Request.new(:POST, path, {:params=>queryopts,:headers=>nil, :body=>body.to_body}).make.body
+ AuthenticationToken.new(response)
+
+ end
+
+
+ def self.get_word_lists_for_current_user (api_key,auth_token,skip,limit,opts={})
+ query_param_keys = [
+ :skip, :limit]
+
+ # verify existence of params
+ raise "api_key is required" if api_key.nil?
+ raise "auth_token is required" if auth_token.nil?
+ # set default values and merge with input
+ options = {
+ :api_key=>api_key,
+ :auth_token=>auth_token,
+ :skip=>skip,
+ :limit=>limit,
+ }.merge(opts)
+
+ #resource path
+ path = "/account.{format}/wordLists".sub('{format}','json')
+
+
+ # pull querystring keys from options
+ queryopts = options.select do |key,value|
+ query_param_keys.include? key
+ end
+
+ headers = {
+ api_key: api_key,
+ }
+ headers = {
+ auth_token: auth_token,
+ }
+ response = Swagger::Request.new(:GET, path, {:params=>queryopts,:headers=>nil, :body=>nil}).make.body
+ response.map {|response|WordList.new(response)}
+
+ end
+
+
+ def self.get_api_token_status (api_key,opts={})
+ # set default values and merge with input
+ options = {
+ :api_key=>api_key,
+ }.merge(opts)
+
+ #resource path
+ path = "/account.{format}/apiTokenStatus".sub('{format}','json')
+
+
+ # pull querystring keys from options
+ queryopts = options.select do |key,value|
+ query_param_keys.include? key
+ end
+
+ headers = {
+ api_key: api_key,
+ }
+ response = Swagger::Request.new(:GET, path, {:params=>queryopts,:headers=>nil, :body=>nil}).make.body
+ ApiTokenStatus.new(response)
+
+ end
+
+
+ def self.get_logged_in_user (api_key,auth_token,opts={})
+ query_param_keys = [
+ ]
+
+ # verify existence of params
+ raise "api_key is required" if api_key.nil?
+ raise "auth_token is required" if auth_token.nil?
+ # set default values and merge with input
+ options = {
+ :api_key=>api_key,
+ :auth_token=>auth_token,
+ }.merge(opts)
+
+ #resource path
+ path = "/account.{format}/user".sub('{format}','json')
+
+
+ # pull querystring keys from options
+ queryopts = options.select do |key,value|
+ query_param_keys.include? key
+ end
+
+ headers = {
+ api_key: api_key,
+ }
+ headers = {
+ auth_token: auth_token,
+ }
+ response = Swagger::Request.new(:GET, path, {:params=>queryopts,:headers=>nil, :body=>nil}).make.body
+ User.new(response)
+
+ end
+
+
+ end
@@ -0,0 +1,210 @@
+require "uri"
+
+class WordList_api
+ basePath = "http://api.wordnik.com/v4"
+ # apiInvoker = APIInvoker
+
+ def self.escapeString(string)
+ URI.encode(string.to_s)
+ end
+
+ def self.update_word_list (word_list_id,body,auth_token,opts={})
+ query_param_keys = [
+ ]
+
+ # verify existence of params
+ raise "word_list_id is required" if word_list_id.nil?
+ raise "auth_token is required" if auth_token.nil?
+ # set default values and merge with input
+ options = {
+ :word_list_id=>word_list_id,
+ :body=>body,
+ :auth_token=>auth_token,
+ }.merge(opts)
+
+ #resource path
+ path = "/wordList.{format}/{wordListId}".sub('{format}','json').sub('{' + 'wordListId' + '}', escapeString(word_list_id))
+
+
+
+ # pull querystring keys from options
+ queryopts = options.select do |key,value|
+ query_param_keys.include? key
+ end
+
+ headers = {
+ auth_token: auth_token,
+ }
+ Swagger::Request.new(:PUT, path, {:params=>queryopts,:headers=>nil, :body=>body.to_body}).make
+
+
+ end
+
+
+ def self.delete_word_list (word_list_id,auth_token,opts={})
+ query_param_keys = [
+ ]
+
+ # verify existence of params
+ raise "word_list_id is required" if word_list_id.nil?
+ raise "auth_token is required" if auth_token.nil?
+ # set default values and merge with input
+ options = {
+ :word_list_id=>word_list_id,
+ :auth_token=>auth_token,
+ }.merge(opts)
+
+ #resource path
+ path = "/wordList.{format}/{wordListId}".sub('{format}','json').sub('{' + 'wordListId' + '}', escapeString(word_list_id))
+
+
+
+ # pull querystring keys from options
+ queryopts = options.select do |key,value|
+ query_param_keys.include? key
+ end
+
+ headers = {
+ auth_token: auth_token,
+ }
+ Swagger::Request.new(:DELETE, path, {:params=>queryopts,:headers=>nil, :body=>nil}).make
+
+
+ end
+
+
+ def self.get_word_list_by_id (word_list_id,auth_token,opts={})
+ query_param_keys = [
+ ]
+
+ # verify existence of params
+ raise "word_list_id is required" if word_list_id.nil?
+ raise "auth_token is required" if auth_token.nil?
+ # set default values and merge with input
+ options = {
+ :word_list_id=>word_list_id,
+ :auth_token=>auth_token,
+ }.merge(opts)
+
+ #resource path
+ path = "/wordList.{format}/{wordListId}".sub('{format}','json').sub('{' + 'wordListId' + '}', escapeString(word_list_id))
+
+
+
+ # pull querystring keys from options
+ queryopts = options.select do |key,value|
+ query_param_keys.include? key
+ end
+
+ headers = {
+ auth_token: auth_token,
+ }
+ response = Swagger::Request.new(:GET, path, {:params=>queryopts,:headers=>nil, :body=>nil}).make.body
+ WordList.new(response)
+
+ end
+
+
+ def self.add_words_to_word_list (word_list_id,body,auth_token,opts={})
+ query_param_keys = [
+ ]
+
+ # verify existence of params
+ raise "word_list_id is required" if word_list_id.nil?
+ raise "auth_token is required" if auth_token.nil?
+ # set default values and merge with input
+ options = {
+ :word_list_id=>word_list_id,
+ :body=>body,
+ :auth_token=>auth_token,
+ }.merge(opts)
+
+ #resource path
+ path = "/wordList.{format}/{wordListId}/words".sub('{format}','json').sub('{' + 'wordListId' + '}', escapeString(word_list_id))
+
+
+
+ # pull querystring keys from options
+ queryopts = options.select do |key,value|
+ query_param_keys.include? key
+ end
+
+ headers = {
+ auth_token: auth_token,
+ }
+ Swagger::Request.new(:POST, path, {:params=>queryopts,:headers=>nil, :body=>body.to_body}).make
+
+
+ end
+
+
+ def self.get_word_list_words (word_list_id,skip,limit,auth_token,sort_by= "createDate",sort_order= "desc",opts={})
+ query_param_keys = [
+ :sort_by, :sort_order, :skip, :limit]
+
+ # verify existence of params
+ raise "word_list_id is required" if word_list_id.nil?
+ raise "auth_token is required" if auth_token.nil?
+ # set default values and merge with input
+ options = {
+ :word_list_id=>word_list_id,
+ :skip=>skip,
+ :limit=>limit,
+ :auth_token=>auth_token,
+ :sort_by=>sort_by,
+ :sort_order=>sort_order,
+ }.merge(opts)
+
+ #resource path
+ path = "/wordList.{format}/{wordListId}/words".sub('{format}','json').sub('{' + 'wordListId' + '}', escapeString(word_list_id))
+
+
+
+ # pull querystring keys from options
+ queryopts = options.select do |key,value|
+ query_param_keys.include? key
+ end
+
+ headers = {
+ auth_token: auth_token,
+ }
+ response = Swagger::Request.new(:GET, path, {:params=>queryopts,:headers=>nil, :body=>nil}).make.body
+ response.map {|response|WordListWord.new(response)}
+
+ end
+
+
+ def self.delete_words_from_word_list (word_list_id,body,auth_token,opts={})
+ query_param_keys = [
+ ]
+
+ # verify existence of params
+ raise "word_list_id is required" if word_list_id.nil?
+ raise "auth_token is required" if auth_token.nil?
+ # set default values and merge with input
+ options = {
+ :word_list_id=>word_list_id,
+ :body=>body,
+ :auth_token=>auth_token,
+ }.merge(opts)
+
+ #resource path
+ path = "/wordList.{format}/{wordListId}/deleteWords".sub('{format}','json').sub('{' + 'wordListId' + '}', escapeString(word_list_id))
+
+
+
+ # pull querystring keys from options
+ queryopts = options.select do |key,value|
+ query_param_keys.include? key
+ end
+
+ headers = {
+ auth_token: auth_token,
+ }
+ Swagger::Request.new(:POST, path, {:params=>queryopts,:headers=>nil, :body=>body.to_body}).make
+
+
+ end
+
+
+ end
Oops, something went wrong.

0 comments on commit 8d4f2ff

Please sign in to comment.