wordnik 4.06.15 → 4.07

Sign up to get free protection for your applications and to get access to all the features.
@@ -84,34 +84,6 @@ module WordListsMethods
84
84
  request_only ? request : request.response.body
85
85
  end
86
86
 
87
- # Fetches WordList objects containing a word.
88
- # Results are scoped to the supplied user.
89
- #
90
- def find_containing_word(word, *args)
91
- http_method = :get
92
- path = '/wordLists/containing/{word}'
93
- path.sub!('{word}', word.to_s)
94
-
95
- # Ruby turns all key-value arguments at the end into a single hash
96
- # e.g. Wordnik.word.get_examples('dingo', :limit => 10, :part_of_speech => 'verb')
97
- # becomes {:limit => 10, :part_of_speech => 'verb'}
98
- last_arg = args.pop if args.last.is_a?(Hash)
99
- last_arg = args.pop if args.last.is_a?(Array)
100
- last_arg ||= {}
101
-
102
- # Look for a kwarg called :request_only, whose presence indicates
103
- # that we want the request itself back, not the response body
104
- if last_arg.is_a?(Hash) && last_arg[:request_only].present?
105
- request_only = true
106
- last_arg.delete(:request_only)
107
- end
108
-
109
- params = last_arg
110
- body ||= {}
111
- request = Wordnik::Request.new(http_method, path, :params => params, :body => body)
112
- request_only ? request : request.response.body
113
- end
114
-
115
87
  # Fetches recently created WordList objects.
116
88
  #
117
89
  def find_recent_lists(*args)
@@ -82,11 +82,11 @@ module WordsMethods
82
82
  request_only ? request : request.response.body
83
83
  end
84
84
 
85
- # Searches dictionary entries.
85
+ # Searches definitions.
86
86
  #
87
- def search_entries(*args)
87
+ def search_definitions(*args)
88
88
  http_method = :get
89
- path = '/words/searchEntries'
89
+ path = '/words/searchDefinitions'
90
90
 
91
91
  # Ruby turns all key-value arguments at the end into a single hash
92
92
  # e.g. Wordnik.word.get_examples('dingo', :limit => 10, :part_of_speech => 'verb')
@@ -108,11 +108,11 @@ module WordsMethods
108
108
  request_only ? request : request.response.body
109
109
  end
110
110
 
111
- # Searches definitions.
111
+ # Fetches corpus-level word frequency
112
112
  #
113
- def search_definitions(*args)
113
+ def get_frequency(*args)
114
114
  http_method = :get
115
- path = '/words/searchDefinitions'
115
+ path = '/words/frequency'
116
116
 
117
117
  # Ruby turns all key-value arguments at the end into a single hash
118
118
  # e.g. Wordnik.word.get_examples('dingo', :limit => 10, :part_of_speech => 'verb')
@@ -186,32 +186,6 @@ module WordsMethods
186
186
  request_only ? request : request.response.body
187
187
  end
188
188
 
189
- # Fetches canonical forms of a word
190
- #
191
- def get_canonical_forms(*args)
192
- http_method = :get
193
- path = '/words/canonicalForms'
194
-
195
- # Ruby turns all key-value arguments at the end into a single hash
196
- # e.g. Wordnik.word.get_examples('dingo', :limit => 10, :part_of_speech => 'verb')
197
- # becomes {:limit => 10, :part_of_speech => 'verb'}
198
- last_arg = args.pop if args.last.is_a?(Hash)
199
- last_arg = args.pop if args.last.is_a?(Array)
200
- last_arg ||= {}
201
-
202
- # Look for a kwarg called :request_only, whose presence indicates
203
- # that we want the request itself back, not the response body
204
- if last_arg.is_a?(Hash) && last_arg[:request_only].present?
205
- request_only = true
206
- last_arg.delete(:request_only)
207
- end
208
-
209
- params = last_arg
210
- body ||= {}
211
- request = Wordnik::Request.new(http_method, path, :params => params, :body => body)
212
- request_only ? request : request.response.body
213
- end
214
-
215
189
  # Searches words.
216
190
  #
217
191
  def search_words_new(query, *args)
@@ -1,5 +1,5 @@
1
1
  module Wordnik
2
- VERSION = "4.06.15"
2
+ VERSION = "4.07"
3
3
  end
4
4
 
5
5
 
@@ -25,7 +25,7 @@ describe Wordnik::Resource do
25
25
  it "defines a method for each operation nickname" do
26
26
  @resource.public_methods.should include(:get_word)
27
27
  @resource.public_methods.should include(:get_definitions)
28
- @resource.public_methods.should include(:contextual_lookup_post)
28
+ @resource.public_methods.should include(:get_word_of_the_day)
29
29
  @resource.public_methods.should_not include(:get_busy)
30
30
  end
31
31
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: wordnik
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.06.15
4
+ version: '4.07'
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -10,11 +10,11 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2012-02-27 00:00:00.000000000 Z
13
+ date: 2012-03-21 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: typhoeus
17
- requirement: &70256630936440 !ruby/object:Gem::Requirement
17
+ requirement: &70231383390040 !ruby/object:Gem::Requirement
18
18
  none: false
19
19
  requirements:
20
20
  - - ! '>='
@@ -22,10 +22,10 @@ dependencies:
22
22
  version: 0.2.1
23
23
  type: :runtime
24
24
  prerelease: false
25
- version_requirements: *70256630936440
25
+ version_requirements: *70231383390040
26
26
  - !ruby/object:Gem::Dependency
27
27
  name: htmlentities
28
- requirement: &70256630935720 !ruby/object:Gem::Requirement
28
+ requirement: &70231383389460 !ruby/object:Gem::Requirement
29
29
  none: false
30
30
  requirements:
31
31
  - - ! '>='
@@ -33,10 +33,10 @@ dependencies:
33
33
  version: 4.2.4
34
34
  type: :runtime
35
35
  prerelease: false
36
- version_requirements: *70256630935720
36
+ version_requirements: *70231383389460
37
37
  - !ruby/object:Gem::Dependency
38
38
  name: addressable
39
- requirement: &70256630934900 !ruby/object:Gem::Requirement
39
+ requirement: &70231383388940 !ruby/object:Gem::Requirement
40
40
  none: false
41
41
  requirements:
42
42
  - - ! '>='
@@ -44,10 +44,10 @@ dependencies:
44
44
  version: 2.2.4
45
45
  type: :runtime
46
46
  prerelease: false
47
- version_requirements: *70256630934900
47
+ version_requirements: *70231383388940
48
48
  - !ruby/object:Gem::Dependency
49
49
  name: nokogiri
50
- requirement: &70256630918460 !ruby/object:Gem::Requirement
50
+ requirement: &70231383388400 !ruby/object:Gem::Requirement
51
51
  none: false
52
52
  requirements:
53
53
  - - ! '>='
@@ -55,10 +55,10 @@ dependencies:
55
55
  version: 1.4.4
56
56
  type: :runtime
57
57
  prerelease: false
58
- version_requirements: *70256630918460
58
+ version_requirements: *70231383388400
59
59
  - !ruby/object:Gem::Dependency
60
60
  name: activemodel
61
- requirement: &70256630917140 !ruby/object:Gem::Requirement
61
+ requirement: &70231383387680 !ruby/object:Gem::Requirement
62
62
  none: false
63
63
  requirements:
64
64
  - - ! '>='
@@ -66,10 +66,10 @@ dependencies:
66
66
  version: 3.0.3
67
67
  type: :runtime
68
68
  prerelease: false
69
- version_requirements: *70256630917140
69
+ version_requirements: *70231383387680
70
70
  - !ruby/object:Gem::Dependency
71
71
  name: json
72
- requirement: &70256630916360 !ruby/object:Gem::Requirement
72
+ requirement: &70231383386500 !ruby/object:Gem::Requirement
73
73
  none: false
74
74
  requirements:
75
75
  - - ! '>='
@@ -77,10 +77,10 @@ dependencies:
77
77
  version: 1.4.6
78
78
  type: :runtime
79
79
  prerelease: false
80
- version_requirements: *70256630916360
80
+ version_requirements: *70231383386500
81
81
  - !ruby/object:Gem::Dependency
82
82
  name: rspec
83
- requirement: &70256630915400 !ruby/object:Gem::Requirement
83
+ requirement: &70231383385940 !ruby/object:Gem::Requirement
84
84
  none: false
85
85
  requirements:
86
86
  - - ~>
@@ -88,10 +88,10 @@ dependencies:
88
88
  version: 2.8.0
89
89
  type: :development
90
90
  prerelease: false
91
- version_requirements: *70256630915400
91
+ version_requirements: *70231383385940
92
92
  - !ruby/object:Gem::Dependency
93
93
  name: vcr
94
- requirement: &70256630913980 !ruby/object:Gem::Requirement
94
+ requirement: &70231383385360 !ruby/object:Gem::Requirement
95
95
  none: false
96
96
  requirements:
97
97
  - - ~>
@@ -99,10 +99,10 @@ dependencies:
99
99
  version: 1.11.3
100
100
  type: :development
101
101
  prerelease: false
102
- version_requirements: *70256630913980
102
+ version_requirements: *70231383385360
103
103
  - !ruby/object:Gem::Dependency
104
104
  name: webmock
105
- requirement: &70256630912400 !ruby/object:Gem::Requirement
105
+ requirement: &70231383382840 !ruby/object:Gem::Requirement
106
106
  none: false
107
107
  requirements:
108
108
  - - ! '>='
@@ -110,10 +110,10 @@ dependencies:
110
110
  version: 1.6.2
111
111
  type: :development
112
112
  prerelease: false
113
- version_requirements: *70256630912400
113
+ version_requirements: *70231383382840
114
114
  - !ruby/object:Gem::Dependency
115
115
  name: autotest
116
- requirement: &70256630911800 !ruby/object:Gem::Requirement
116
+ requirement: &70231383398820 !ruby/object:Gem::Requirement
117
117
  none: false
118
118
  requirements:
119
119
  - - ! '>='
@@ -121,10 +121,10 @@ dependencies:
121
121
  version: '0'
122
122
  type: :development
123
123
  prerelease: false
124
- version_requirements: *70256630911800
124
+ version_requirements: *70231383398820
125
125
  - !ruby/object:Gem::Dependency
126
126
  name: autotest-rails-pure
127
- requirement: &70256630910740 !ruby/object:Gem::Requirement
127
+ requirement: &70231383398220 !ruby/object:Gem::Requirement
128
128
  none: false
129
129
  requirements:
130
130
  - - ! '>='
@@ -132,7 +132,7 @@ dependencies:
132
132
  version: '0'
133
133
  type: :development
134
134
  prerelease: false
135
- version_requirements: *70256630910740
135
+ version_requirements: *70231383398220
136
136
  description: This gem provides a simple interface to the entire Wordnik API. Its methods
137
137
  are defined by the documentation that comes from the API itself, so it's guaranteed
138
138
  to be up to date.
@@ -156,8 +156,9 @@ files:
156
156
  - api_docs/corpus.json
157
157
  - api_docs/document.json
158
158
  - api_docs/feeds.json
159
- - api_docs/glossary.json
160
159
  - api_docs/health.json
160
+ - api_docs/partner.json
161
+ - api_docs/partners.json
161
162
  - api_docs/suggest.json
162
163
  - api_docs/system.json
163
164
  - api_docs/tag.json
@@ -181,7 +182,6 @@ files:
181
182
  - lib/wordnik/resource_modules/corpus.rb
182
183
  - lib/wordnik/resource_modules/document.rb
183
184
  - lib/wordnik/resource_modules/feeds.rb
184
- - lib/wordnik/resource_modules/glossary.rb
185
185
  - lib/wordnik/resource_modules/health.rb
186
186
  - lib/wordnik/resource_modules/suggest.rb
187
187
  - lib/wordnik/resource_modules/system.rb
@@ -1 +0,0 @@
1
- {"resourcePath":"/glossary","apis":[{"path":"/glossary.{format}/{permalinkId}","description":"","operations":[{"parameters":[{"name":"permalinkId","description":"Permalink of Glossary to fetch.","required":true,"dataType":"string","allowMultiple":false,"paramType":"path"},{"name":"version","description":"Version to fetch","required":false,"dataType":"string","allowMultiple":false,"paramType":"query"}],"summary":"Fetches a glossary.","responseTypeInternal":"com.wordnik.community.entity.Glossary","errorResponses":[{"reason":"Invalid Permalink ID supplied.","code":404}],"nickname":"getGlossary","responseClass":"Glossary","httpMethod":"GET"},{"parameters":[{"name":"permalinkId","description":"Permalink of Glossary to fetch.","required":true,"dataType":"string","allowMultiple":false,"paramType":"path"},{"name":"version","description":"Version to fetch","required":false,"dataType":"string","allowMultiple":false,"paramType":"query"},{"description":"Updated Glossary","required":false,"dataType":"Glossary","valueTypeInternal":"Glossary","allowMultiple":false,"paramType":"body"}],"summary":"Updates a Glossary.","responseTypeInternal":"com.wordnik.community.entity.Glossary","errorResponses":[{"reason":"Invalid Permalink ID supplied.","code":404}],"nickname":"updateGlossary","responseClass":"Glossary","httpMethod":"PUT"},{"parameters":[{"name":"permalinkId","description":"Permalink of Glossary to delete.","required":true,"dataType":"string","allowMultiple":false,"paramType":"path"},{"name":"version","description":"Version to delete","required":false,"dataType":"string","allowMultiple":false,"paramType":"query"}],"summary":"Deletes the Glossary.","responseTypeInternal":"ok","errorResponses":[{"reason":"Invalid Permalink ID supplied.","code":404}],"nickname":"deleteGlossary","responseClass":"ok","httpMethod":"DELETE"}]},{"path":"/glossary.{format}/{permalinkId}/entries","description":"","operations":[{"parameters":[{"name":"permalinkId","description":"Permalink of Glossary.","required":true,"dataType":"string","allowMultiple":false,"paramType":"path"},{"name":"version","description":"Specific Glossary version to fetch Entries for","required":false,"dataType":"string","allowMultiple":false,"paramType":"query"},{"description":"Glossary Entries to add","required":false,"dataType":"Array[com.wordnik.community.entity.GlossaryEntry]","valueTypeInternal":"com.wordnik.community.entity.GlossaryEntry","allowMultiple":false,"paramType":"body"}],"summary":"Adds GlossaryEntry objects for the specified Glossary.","responseTypeInternal":"ok","errorResponses":[{"reason":"Invalid Permalink ID supplied.","code":404}],"nickname":"addGlossaryEntry","responseClass":"ok","httpMethod":"POST"}]},{"path":"/glossary.{format}/{permalinkId}/publish","description":"","operations":[{"parameters":[{"name":"permalinkId","description":"Permalink of Glossary to publish.","required":true,"dataType":"string","allowMultiple":false,"paramType":"path"},{"name":"version","description":"Version to publish.","required":false,"dataType":"string","allowMultiple":false,"paramType":"query"}],"summary":"Publishes a Glossary.","responseTypeInternal":"ok","errorResponses":[{"reason":"Invalid Permalink ID supplied.","code":404}],"nickname":"publishGlossary","responseClass":"ok","httpMethod":"POST"}]},{"path":"/glossary.{format}/{permalinkId}/clone","description":"","operations":[{"parameters":[{"name":"permalinkId","description":"Permalink of Glossary to version.","required":true,"dataType":"string","allowMultiple":false,"paramType":"path"},{"name":"version","description":"New version number to assign.","required":false,"dataType":"string","allowMultiple":false,"paramType":"query"}],"summary":"Creates a new version of a Glossary.","responseTypeInternal":"com.wordnik.community.entity.Glossary","errorResponses":[{"reason":"Invalid Permalink ID supplied.","code":404}],"nickname":"createVersion","responseClass":"Glossary","httpMethod":"POST"}]},{"path":"/glossary.{format}/{permalinkId}/entries/{word}","description":"","operations":[{"parameters":[{"name":"permalinkId","description":"Permalink of Glossary.","required":true,"dataType":"string","allowMultiple":false,"paramType":"path"},{"name":"word","description":"Word to remove.","required":true,"dataType":"string","allowMultiple":false,"paramType":"path"},{"name":"version","description":"Specific Glossary version to fetch Entries for","required":false,"dataType":"string","allowMultiple":false,"paramType":"query"}],"summary":"Removes a GlossaryEntry object from the specified Glossary.","responseTypeInternal":"ok","errorResponses":[{"reason":"Invalid word being removed.","code":400},{"reason":"Invalid Permalink ID supplied.","code":404}],"nickname":"deleteGlossaryEntry","responseClass":"ok","httpMethod":"DELETE"}]},{"path":"/glossary.{format}/{permalinkId}/deleteEntries","description":"","operations":[{"parameters":[{"name":"permalinkId","description":"Permalink of Glossary.","required":true,"dataType":"string","allowMultiple":false,"paramType":"path"},{"description":"Words to remove.","required":false,"dataType":"Array[com.wordnik.resource.StringValue]","valueTypeInternal":"com.wordnik.resource.StringValue","allowMultiple":false,"paramType":"body"},{"name":"version","description":"Specific Glossary version to remove Entries from","required":false,"dataType":"string","allowMultiple":false,"paramType":"query"}],"summary":"Removes a GlossaryEntry object from the specified Glossary.","responseTypeInternal":"ok","errorResponses":[{"reason":"Invalid word being removed.","code":400},{"reason":"Invalid Permalink ID supplied.","code":404}],"nickname":"deleteGlossaryEntries","responseClass":"ok","httpMethod":"POST"}]},{"path":"/glossary.{format}/{permalinkId}/randomEntry","description":"","operations":[{"parameters":[{"name":"permalinkId","description":"Permalink of Glossary.","required":true,"dataType":"string","allowMultiple":false,"paramType":"path"},{"name":"version","description":"Specific Glossary version to fetch Entries for","required":false,"dataType":"string","allowMultiple":false,"paramType":"query"},{"name":"sourceDictionaries","description":"Gets definitions from dictionaries in the supplied order of precedence","required":false,"dataType":"string","allowableValues":{"values":["ahd"," century"," wiktionary"," webster"," wordnet"],"valueType":"LIST"},"allowMultiple":false,"paramType":"query"},{"name":"definitionsLimit","description":"Maximum number of definitions to return","required":false,"dataType":"string","allowMultiple":false,"paramType":"query"},{"name":"examplesLimit","description":"Maximum number of examples to return","required":false,"dataType":"string","allowMultiple":false,"paramType":"query"},{"name":"audioPronunciationsLimit","description":"Maximum number of audio pronunciations to return","required":false,"dataType":"string","allowMultiple":false,"paramType":"query"}],"summary":"Fetches a random GlossaryEntry object for the specified Glossary.","responseTypeInternal":"com.wordnik.community.entity.GlossaryEntry","errorResponses":[{"reason":"Invalid Permalink ID supplied.","code":404}],"nickname":"getRandomGlossaryEntry","responseClass":"GlossaryEntry","httpMethod":"GET"}]},{"path":"/glossary.{format}/{permalinkId}/entries/{word}/examples","description":"","operations":[{"parameters":[{"name":"permalinkId","description":"Permalink of Glossary.","required":true,"dataType":"string","allowMultiple":false,"paramType":"path"},{"name":"version","description":"Specific Glossary version to fetch Entries for","required":false,"dataType":"string","allowMultiple":false,"paramType":"query"},{"name":"word","description":"The word for which the Glossary Entry is requested","required":true,"dataType":"string","allowMultiple":false,"paramType":"path"},{"name":"skip","defaultValue":"0","description":"Results to skip","required":false,"dataType":"string","allowableValues":{"max":1000.0,"min":0.0,"valueType":"RANGE"},"allowMultiple":false,"paramType":"query"},{"name":"limit","defaultValue":"10","description":"Maximum number of results to return","required":false,"dataType":"string","allowableValues":{"max":1000.0,"min":1.0,"valueType":"RANGE"},"allowMultiple":false,"paramType":"query"}],"summary":"Fetches examples for the Glossary entry","responseTypeInternal":"com.wordnik.corpus.model.Example","errorResponses":[{"reason":"Invalid word being removed.","code":400},{"reason":"Invalid Permalink ID supplied.","code":404}],"nickname":"getGlossaryEntryExamples","responseClass":"List[example]","httpMethod":"GET"}]}],"models":{"GlossaryStatus":{"properties":{"id":{"type":"int"},"name":{"type":"string"}},"id":"glossaryStatus"},"GlossaryEntry":{"properties":{"audioFiles":{"type":"array","items":{"$ref":"audioFile"}},"definitions":{"type":"array","items":{"$ref":"definition"}},"glossaryId":{"type":"long"},"examples":{"type":"array","items":{"$ref":"example"}},"wordstring":{"type":"string"}},"id":"GlossaryEntry"},"Glossary":{"properties":{"status":{"type":"glossaryStatus"},"permalinkId":{"type":"string"},"partnerId":{"type":"string"},"totalEntries":{"type":"int"},"version":{"type":"double"},"id":{"type":"long"},"updatedAt":{"type":"Date"},"draft":{"type":"boolean"},"archived":{"type":"boolean"},"description":{"type":"string"},"createdAt":{"type":"Date"},"name":{"type":"string"},"publishedDate":{"type":"Date"},"published":{"type":"boolean"}},"id":"Glossary"},"Example":{"properties":{"id":{"type":"long"},"exampleId":{"type":"long"},"title":{"type":"string"},"text":{"type":"string"},"score":{"type":"scoredWord"},"sentence":{"type":"sentence"},"word":{"type":"string"},"provider":{"type":"contentProvider"},"year":{"type":"integer"},"rating":{"type":"float"},"documentId":{"type":"long"},"url":{"type":"string"}},"id":"example"},"Sentence":{"properties":{"hasScoredWords":{"type":"boolean"},"id":{"type":"long"},"scoredWords":{"type":"array","items":{"$ref":"scoredWord"}},"display":{"type":"string"},"rating":{"type":"int"},"documentMetadataId":{"type":"long"}},"id":"sentence"},"ContentProvider":{"properties":{"id":{"type":"int"},"name":{"type":"string"}},"id":"contentProvider"},"AudioFile":{"properties":{"attributionUrl":{"type":"string"},"commentCount":{"type":"int"},"voteCount":{"type":"integer"},"fileUrl":{"type":"string"},"audioType":{"type":"string"},"id":{"type":"long","required":true},"duration":{"type":"double"},"attributionText":{"type":"string"},"createdBy":{"type":"string"},"description":{"type":"string"},"createdAt":{"type":"Date"},"voteWeightedAverage":{"type":"float"},"voteAverage":{"type":"float"},"word":{"type":"string"}},"id":"audioFile"},"StringValue":{"properties":{"word":{"type":"string"}},"id":"StringValue"},"ScoredWord":{"properties":{"position":{"type":"int"},"id":{"type":"long"},"docTermCount":{"type":"int"},"lemma":{"type":"string"},"wordType":{"type":"string"},"score":{"type":"float"},"sentenceId":{"type":"long"},"word":{"type":"string"},"stopword":{"type":"boolean"},"baseWordScore":{"type":"double"},"partOfSpeech":{"type":"string"}},"id":"scoredWord"},"Definition":{"properties":{"extendedText":{"type":"string"},"text":{"type":"string"},"sourceDictionary":{"type":"string"},"citations":{"type":"array","items":{"$ref":"citation"}},"labels":{"type":"array","items":{"$ref":"Label"}},"score":{"type":"float"},"exampleUses":{"type":"array","items":{"$ref":"ExampleUsage"}},"attributionUrl":{"type":"string"},"seqString":{"type":"string"},"attributionText":{"type":"string"},"relatedWords":{"type":"array","items":{"$ref":"related"}},"word":{"type":"string"},"notes":{"type":"array","items":{"$ref":"note"}},"textProns":{"type":"array","items":{"$ref":"textPron"}},"partOfSpeech":{"type":"string"}},"id":"definition"}},"basePath":"http://api.wordnik.com/v4","swaggerVersion":"1.1-SNAPSHOT","apiVersion":"4.0"}
@@ -1,278 +0,0 @@
1
- # HEY HACKER! THIS IS AN AUTO-GENERATED FILE.
2
- # So don't bother editing it. To see how it's built, take a look at the Rakefile
3
-
4
- module GlossaryMethods
5
-
6
- # Fetches a glossary.
7
- #
8
- def get_glossary(permalinkId, *args)
9
- http_method = :get
10
- path = '/glossary/{permalinkId}'
11
- path.sub!('{permalinkId}', permalinkId.to_s)
12
-
13
- # Ruby turns all key-value arguments at the end into a single hash
14
- # e.g. Wordnik.word.get_examples('dingo', :limit => 10, :part_of_speech => 'verb')
15
- # becomes {:limit => 10, :part_of_speech => 'verb'}
16
- last_arg = args.pop if args.last.is_a?(Hash)
17
- last_arg = args.pop if args.last.is_a?(Array)
18
- last_arg ||= {}
19
-
20
- # Look for a kwarg called :request_only, whose presence indicates
21
- # that we want the request itself back, not the response body
22
- if last_arg.is_a?(Hash) && last_arg[:request_only].present?
23
- request_only = true
24
- last_arg.delete(:request_only)
25
- end
26
-
27
- params = last_arg
28
- body ||= {}
29
- request = Wordnik::Request.new(http_method, path, :params => params, :body => body)
30
- request_only ? request : request.response.body
31
- end
32
-
33
- # Updates a Glossary.
34
- #
35
- def update_glossary(permalinkId, body, *args)
36
- http_method = :put
37
- path = '/glossary/{permalinkId}'
38
- path.sub!('{permalinkId}', permalinkId.to_s)
39
-
40
- # Ruby turns all key-value arguments at the end into a single hash
41
- # e.g. Wordnik.word.get_examples('dingo', :limit => 10, :part_of_speech => 'verb')
42
- # becomes {:limit => 10, :part_of_speech => 'verb'}
43
- last_arg = args.pop if args.last.is_a?(Hash)
44
- last_arg = args.pop if args.last.is_a?(Array)
45
- last_arg ||= {}
46
-
47
- # Look for a kwarg called :request_only, whose presence indicates
48
- # that we want the request itself back, not the response body
49
- if last_arg.is_a?(Hash) && last_arg[:request_only].present?
50
- request_only = true
51
- last_arg.delete(:request_only)
52
- end
53
-
54
- params = last_arg
55
- body ||= {}
56
- request = Wordnik::Request.new(http_method, path, :params => params, :body => body)
57
- request_only ? request : request.response.body
58
- end
59
-
60
- # Deletes the Glossary.
61
- #
62
- def delete_glossary(permalinkId, *args)
63
- http_method = :delete
64
- path = '/glossary/{permalinkId}'
65
- path.sub!('{permalinkId}', permalinkId.to_s)
66
-
67
- # Ruby turns all key-value arguments at the end into a single hash
68
- # e.g. Wordnik.word.get_examples('dingo', :limit => 10, :part_of_speech => 'verb')
69
- # becomes {:limit => 10, :part_of_speech => 'verb'}
70
- last_arg = args.pop if args.last.is_a?(Hash)
71
- last_arg = args.pop if args.last.is_a?(Array)
72
- last_arg ||= {}
73
-
74
- # Look for a kwarg called :request_only, whose presence indicates
75
- # that we want the request itself back, not the response body
76
- if last_arg.is_a?(Hash) && last_arg[:request_only].present?
77
- request_only = true
78
- last_arg.delete(:request_only)
79
- end
80
-
81
- params = last_arg
82
- body ||= {}
83
- request = Wordnik::Request.new(http_method, path, :params => params, :body => body)
84
- request_only ? request : request.response.body
85
- end
86
-
87
- # Adds GlossaryEntry objects for the specified Glossary.
88
- #
89
- def add_glossary_entry(permalinkId, body, *args)
90
- http_method = :post
91
- path = '/glossary/{permalinkId}/entries'
92
- path.sub!('{permalinkId}', permalinkId.to_s)
93
-
94
- # Ruby turns all key-value arguments at the end into a single hash
95
- # e.g. Wordnik.word.get_examples('dingo', :limit => 10, :part_of_speech => 'verb')
96
- # becomes {:limit => 10, :part_of_speech => 'verb'}
97
- last_arg = args.pop if args.last.is_a?(Hash)
98
- last_arg = args.pop if args.last.is_a?(Array)
99
- last_arg ||= {}
100
-
101
- # Look for a kwarg called :request_only, whose presence indicates
102
- # that we want the request itself back, not the response body
103
- if last_arg.is_a?(Hash) && last_arg[:request_only].present?
104
- request_only = true
105
- last_arg.delete(:request_only)
106
- end
107
-
108
- params = last_arg
109
- body ||= {}
110
- request = Wordnik::Request.new(http_method, path, :params => params, :body => body)
111
- request_only ? request : request.response.body
112
- end
113
-
114
- # Publishes a Glossary.
115
- #
116
- def publish_glossary(permalinkId, *args)
117
- http_method = :post
118
- path = '/glossary/{permalinkId}/publish'
119
- path.sub!('{permalinkId}', permalinkId.to_s)
120
-
121
- # Ruby turns all key-value arguments at the end into a single hash
122
- # e.g. Wordnik.word.get_examples('dingo', :limit => 10, :part_of_speech => 'verb')
123
- # becomes {:limit => 10, :part_of_speech => 'verb'}
124
- last_arg = args.pop if args.last.is_a?(Hash)
125
- last_arg = args.pop if args.last.is_a?(Array)
126
- last_arg ||= {}
127
-
128
- # Look for a kwarg called :request_only, whose presence indicates
129
- # that we want the request itself back, not the response body
130
- if last_arg.is_a?(Hash) && last_arg[:request_only].present?
131
- request_only = true
132
- last_arg.delete(:request_only)
133
- end
134
-
135
- params = last_arg
136
- body ||= {}
137
- request = Wordnik::Request.new(http_method, path, :params => params, :body => body)
138
- request_only ? request : request.response.body
139
- end
140
-
141
- # Creates a new version of a Glossary.
142
- #
143
- def create_version(permalinkId, *args)
144
- http_method = :post
145
- path = '/glossary/{permalinkId}/clone'
146
- path.sub!('{permalinkId}', permalinkId.to_s)
147
-
148
- # Ruby turns all key-value arguments at the end into a single hash
149
- # e.g. Wordnik.word.get_examples('dingo', :limit => 10, :part_of_speech => 'verb')
150
- # becomes {:limit => 10, :part_of_speech => 'verb'}
151
- last_arg = args.pop if args.last.is_a?(Hash)
152
- last_arg = args.pop if args.last.is_a?(Array)
153
- last_arg ||= {}
154
-
155
- # Look for a kwarg called :request_only, whose presence indicates
156
- # that we want the request itself back, not the response body
157
- if last_arg.is_a?(Hash) && last_arg[:request_only].present?
158
- request_only = true
159
- last_arg.delete(:request_only)
160
- end
161
-
162
- params = last_arg
163
- body ||= {}
164
- request = Wordnik::Request.new(http_method, path, :params => params, :body => body)
165
- request_only ? request : request.response.body
166
- end
167
-
168
- # Removes a GlossaryEntry object from the specified Glossary.
169
- #
170
- def delete_glossary_entry(permalinkId, word, *args)
171
- http_method = :delete
172
- path = '/glossary/{permalinkId}/entries/{word}'
173
- path.sub!('{permalinkId}', permalinkId.to_s)
174
- path.sub!('{word}', word.to_s)
175
-
176
- # Ruby turns all key-value arguments at the end into a single hash
177
- # e.g. Wordnik.word.get_examples('dingo', :limit => 10, :part_of_speech => 'verb')
178
- # becomes {:limit => 10, :part_of_speech => 'verb'}
179
- last_arg = args.pop if args.last.is_a?(Hash)
180
- last_arg = args.pop if args.last.is_a?(Array)
181
- last_arg ||= {}
182
-
183
- # Look for a kwarg called :request_only, whose presence indicates
184
- # that we want the request itself back, not the response body
185
- if last_arg.is_a?(Hash) && last_arg[:request_only].present?
186
- request_only = true
187
- last_arg.delete(:request_only)
188
- end
189
-
190
- params = last_arg
191
- body ||= {}
192
- request = Wordnik::Request.new(http_method, path, :params => params, :body => body)
193
- request_only ? request : request.response.body
194
- end
195
-
196
- # Removes a GlossaryEntry object from the specified Glossary.
197
- #
198
- def delete_glossary_entries(permalinkId, body, *args)
199
- http_method = :post
200
- path = '/glossary/{permalinkId}/deleteEntries'
201
- path.sub!('{permalinkId}', permalinkId.to_s)
202
-
203
- # Ruby turns all key-value arguments at the end into a single hash
204
- # e.g. Wordnik.word.get_examples('dingo', :limit => 10, :part_of_speech => 'verb')
205
- # becomes {:limit => 10, :part_of_speech => 'verb'}
206
- last_arg = args.pop if args.last.is_a?(Hash)
207
- last_arg = args.pop if args.last.is_a?(Array)
208
- last_arg ||= {}
209
-
210
- # Look for a kwarg called :request_only, whose presence indicates
211
- # that we want the request itself back, not the response body
212
- if last_arg.is_a?(Hash) && last_arg[:request_only].present?
213
- request_only = true
214
- last_arg.delete(:request_only)
215
- end
216
-
217
- params = last_arg
218
- body ||= {}
219
- request = Wordnik::Request.new(http_method, path, :params => params, :body => body)
220
- request_only ? request : request.response.body
221
- end
222
-
223
- # Fetches a random GlossaryEntry object for the specified Glossary.
224
- #
225
- def get_random_glossary_entry(permalinkId, *args)
226
- http_method = :get
227
- path = '/glossary/{permalinkId}/randomEntry'
228
- path.sub!('{permalinkId}', permalinkId.to_s)
229
-
230
- # Ruby turns all key-value arguments at the end into a single hash
231
- # e.g. Wordnik.word.get_examples('dingo', :limit => 10, :part_of_speech => 'verb')
232
- # becomes {:limit => 10, :part_of_speech => 'verb'}
233
- last_arg = args.pop if args.last.is_a?(Hash)
234
- last_arg = args.pop if args.last.is_a?(Array)
235
- last_arg ||= {}
236
-
237
- # Look for a kwarg called :request_only, whose presence indicates
238
- # that we want the request itself back, not the response body
239
- if last_arg.is_a?(Hash) && last_arg[:request_only].present?
240
- request_only = true
241
- last_arg.delete(:request_only)
242
- end
243
-
244
- params = last_arg
245
- body ||= {}
246
- request = Wordnik::Request.new(http_method, path, :params => params, :body => body)
247
- request_only ? request : request.response.body
248
- end
249
-
250
- # Fetches examples for the Glossary entry
251
- #
252
- def get_glossary_entry_examples(permalinkId, word, *args)
253
- http_method = :get
254
- path = '/glossary/{permalinkId}/entries/{word}/examples'
255
- path.sub!('{permalinkId}', permalinkId.to_s)
256
- path.sub!('{word}', word.to_s)
257
-
258
- # Ruby turns all key-value arguments at the end into a single hash
259
- # e.g. Wordnik.word.get_examples('dingo', :limit => 10, :part_of_speech => 'verb')
260
- # becomes {:limit => 10, :part_of_speech => 'verb'}
261
- last_arg = args.pop if args.last.is_a?(Hash)
262
- last_arg = args.pop if args.last.is_a?(Array)
263
- last_arg ||= {}
264
-
265
- # Look for a kwarg called :request_only, whose presence indicates
266
- # that we want the request itself back, not the response body
267
- if last_arg.is_a?(Hash) && last_arg[:request_only].present?
268
- request_only = true
269
- last_arg.delete(:request_only)
270
- end
271
-
272
- params = last_arg
273
- body ||= {}
274
- request = Wordnik::Request.new(http_method, path, :params => params, :body => body)
275
- request_only ? request : request.response.body
276
- end
277
-
278
- end