rosette_api 1.7.0 → 1.8.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/lib/rosette_api.rb +20 -1
  3. data/tests/tests_spec.rb +42 -21
  4. metadata +3 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: cd2e11be02e9d5b53eb5e70f2878713438155663
4
- data.tar.gz: 255a67fd51abe249733fc8713bba8f642cfd770a
3
+ metadata.gz: 3c1f4e6645988fd741245aa36c5184ef0ad146fd
4
+ data.tar.gz: 4de158e6217545c6dbf806311689f7ba268481d4
5
5
  SHA512:
6
- metadata.gz: 3646013573953385758c5c87bcb92e92ab5d4215f68d34d69a3ef085b6e13ed270c9a04c16961ee694048e75d53fc1a4195477731ea1ded724900f910def4acb
7
- data.tar.gz: 666aa84265d7adcd15440e875fd6582d3a24536cb0456f845bcf7ace86b04c6f01b26dd319fbaf5b18a79bb8735be753672bcb836aee46eb43df1f4c189e9a78
6
+ metadata.gz: 72078164616ffe28787dd17303c4839f2fe31e2cfb0293614aab4ceac70692144d10a9e0704deff1f8e0386a721cf9da65a60f1afb389164d9699f512f7e97da
7
+ data.tar.gz: 79f50f13ce4eeaf8e51bcb8b0096a207127d5955cefd0e5ff3606ae9f8fd4eb54cccae6544730f3e903d157b62aa9d95e07b1821b7588ef564c8dc38463521e1
@@ -10,7 +10,7 @@ require_relative 'bad_request_format_error'
10
10
  # This class allows you to access all Rosette API endpoints.
11
11
  class RosetteAPI
12
12
  # Version of Ruby binding
13
- BINDING_VERSION = '1.7.0'
13
+ BINDING_VERSION = '1.8.0'
14
14
  # Rosette API language endpoint
15
15
  LANGUAGE_ENDPOINT = '/language'.freeze
16
16
  # Rosette API morphology endpoint
@@ -43,6 +43,9 @@ class RosetteAPI
43
43
  SYNTACTIC_DEPENDENCIES_ENDPOINT = '/syntax/dependencies'.freeze
44
44
  # Transliteration endpoint
45
45
  TRANSLITERATION_ENDPOINT = '/transliteration'.freeze
46
+ # Topics endpoint
47
+ TOPICS_ENDPOINT = '/topics'.freeze
48
+
46
49
 
47
50
  # Rosette API key
48
51
  attr_accessor :user_key
@@ -365,6 +368,22 @@ class RosetteAPI
365
368
  .send_post_request
366
369
  end
367
370
 
371
+ # Divides the input into topics (key phrases and concepts).
372
+ #
373
+ # ==== Attributes
374
+ #
375
+ # * +params+ - DocumentParameters helps to build the request body in RequestBuilder.
376
+ #
377
+ # Returns list of topics of the input.
378
+ def get_topics(params)
379
+ check_params params
380
+
381
+ params = params.load_params
382
+
383
+ RequestBuilder.new(@user_key, @alternate_url + TOPICS_ENDPOINT, @http_client, params, @url_parameters, BINDING_VERSION)
384
+ .send_post_request
385
+ end
386
+
368
387
  # Gets information about the Rosette API, returns name, build number
369
388
  # and build time.
370
389
  def info
@@ -21,7 +21,7 @@ describe RosetteAPI do
21
21
  'User-Agent' => 'Ruby',
22
22
  'X-Rosetteapi-Key' => '0123456789',
23
23
  'X-Rosetteapi-Binding' => 'ruby',
24
- 'X-Rosetteapi-Binding-Version' => '1.7.0' })
24
+ 'X-Rosetteapi-Binding-Version' => '1.8.0' })
25
25
  .to_return(status: 200, body: '{"test": "language"}', headers: {})
26
26
  end
27
27
  it 'test language' do
@@ -55,7 +55,7 @@ describe RosetteAPI do
55
55
  'User-Agent' => 'Ruby',
56
56
  'X-Rosetteapi-Key' => '0123456789',
57
57
  'X-Rosetteapi-Binding' => 'ruby',
58
- 'X-Rosetteapi-Binding-Version' => '1.7.0' })
58
+ 'X-Rosetteapi-Binding-Version' => '1.8.0' })
59
59
  .to_return(status: 200, body: '{"test": "morphology/complete"}', headers: {})
60
60
  end
61
61
  it 'test morphology complete' do
@@ -76,7 +76,7 @@ describe RosetteAPI do
76
76
  'User-Agent' => 'Ruby',
77
77
  'X-Rosetteapi-Key' => '0123456789',
78
78
  'X-Rosetteapi-Binding' => 'ruby',
79
- 'X-Rosetteapi-Binding-Version' => '1.7.0' })
79
+ 'X-Rosetteapi-Binding-Version' => '1.8.0' })
80
80
  .to_return(status: 200, body: '{"test": "morphology/compound-components"}', headers: {})
81
81
  end
82
82
  it 'test morphology compound components' do
@@ -97,7 +97,7 @@ describe RosetteAPI do
97
97
  'User-Agent' => 'Ruby',
98
98
  'X-Rosetteapi-Key' => '0123456789',
99
99
  'X-Rosetteapi-Binding' => 'ruby',
100
- 'X-Rosetteapi-Binding-Version' => '1.7.0' })
100
+ 'X-Rosetteapi-Binding-Version' => '1.8.0' })
101
101
  .to_return(status: 200, body: '{"test": "morphology/han-readings"}', headers: {})
102
102
  end
103
103
  it 'test morphology han readings' do
@@ -118,7 +118,7 @@ describe RosetteAPI do
118
118
  'User-Agent' => 'Ruby',
119
119
  'X-Rosetteapi-Key' => '0123456789',
120
120
  'X-Rosetteapi-Binding' => 'ruby',
121
- 'X-Rosetteapi-Binding-Version' => '1.7.0' })
121
+ 'X-Rosetteapi-Binding-Version' => '1.8.0' })
122
122
  .to_return(status: 200, body: '{"test": "morphology/parts-of-speech"}', headers: {})
123
123
  end
124
124
  it 'test morphology parts of speech' do
@@ -139,7 +139,7 @@ describe RosetteAPI do
139
139
  'User-Agent' => 'Ruby',
140
140
  'X-Rosetteapi-Key' => '0123456789',
141
141
  'X-Rosetteapi-Binding' => 'ruby',
142
- 'X-Rosetteapi-Binding-Version' => '1.7.0' })
142
+ 'X-Rosetteapi-Binding-Version' => '1.8.0' })
143
143
  .to_return(status: 200, body: '{"test": "morphology/lemmas"}', headers: {})
144
144
  end
145
145
  it 'test morphology lemmas' do
@@ -160,7 +160,7 @@ describe RosetteAPI do
160
160
  'User-Agent' => 'Ruby',
161
161
  'X-Rosetteapi-Key' => '0123456789',
162
162
  'X-Rosetteapi-Binding' => 'ruby',
163
- 'X-Rosetteapi-Binding-Version' => '1.7.0' })
163
+ 'X-Rosetteapi-Binding-Version' => '1.8.0' })
164
164
  .to_return(status: 200, body: '{"test": "entities"}', headers: {})
165
165
  end
166
166
  it 'test entities' do
@@ -182,7 +182,7 @@ describe RosetteAPI do
182
182
  'User-Agent' => 'Ruby',
183
183
  'X-Rosetteapi-Key' => '0123456789',
184
184
  'X-Rosetteapi-Binding' => 'ruby',
185
- 'X-Rosetteapi-Binding-Version' => '1.7.0' })
185
+ 'X-Rosetteapi-Binding-Version' => '1.8.0' })
186
186
  .to_return(status: 200, body: '{"test": "entities"}', headers: {})
187
187
  end
188
188
  it 'test entities without qids' do
@@ -213,7 +213,7 @@ describe RosetteAPI do
213
213
  'User-Agent' => 'Ruby',
214
214
  'X-Rosetteapi-Key' => '0123456789',
215
215
  'X-Rosetteapi-Binding' => 'ruby',
216
- 'X-Rosetteapi-Binding-Version' => '1.7.0' })
216
+ 'X-Rosetteapi-Binding-Version' => '1.8.0' })
217
217
  .to_return(status: 200, body: '{"test": "categories"}', headers: {})
218
218
  end
219
219
  it 'test categories' do
@@ -234,7 +234,7 @@ describe RosetteAPI do
234
234
  'User-Agent' => 'Ruby',
235
235
  'X-Rosetteapi-Key' => '0123456789',
236
236
  'X-Rosetteapi-Binding' => 'ruby',
237
- 'X-Rosetteapi-Binding-Version' => '1.7.0' })
237
+ 'X-Rosetteapi-Binding-Version' => '1.8.0' })
238
238
  .to_return(status: 200, body: '{"test": "relationships"}', headers: {})
239
239
  end
240
240
  it 'test relationships' do
@@ -256,7 +256,7 @@ describe RosetteAPI do
256
256
  'User-Agent' => 'Ruby',
257
257
  'X-Rosetteapi-Key' => '0123456789',
258
258
  'X-Rosetteapi-Binding' => 'ruby',
259
- 'X-Rosetteapi-Binding-Version' => '1.7.0' })
259
+ 'X-Rosetteapi-Binding-Version' => '1.8.0' })
260
260
  .to_return(status: 200, body: '{"test": "name-translation"}', headers: {})
261
261
  end
262
262
  it 'test name translation' do
@@ -283,7 +283,7 @@ describe RosetteAPI do
283
283
  'User-Agent' => 'Ruby',
284
284
  'X-Rosetteapi-Key' => '0123456789',
285
285
  'X-Rosetteapi-Binding' => 'ruby',
286
- 'X-Rosetteapi-Binding-Version' => '1.7.0' })
286
+ 'X-Rosetteapi-Binding-Version' => '1.8.0' })
287
287
  .to_return(status: 200, body: '{"test": "name-similarity"}', headers: {})
288
288
  end
289
289
  it 'test name similarity' do
@@ -321,7 +321,7 @@ describe RosetteAPI do
321
321
  'User-Agent' => 'Ruby',
322
322
  'X-Rosetteapi-Key' => '0123456789',
323
323
  'X-Rosetteapi-Binding' => 'ruby',
324
- 'X-Rosetteapi-Binding-Version' => '1.7.0' })
324
+ 'X-Rosetteapi-Binding-Version' => '1.8.0' })
325
325
  .to_return(status: 200, body: '{"test": "name-deduplication"}', headers: {})
326
326
 
327
327
  nothresh_json = { names: names.map(&:load_param) }.to_json
@@ -334,7 +334,7 @@ describe RosetteAPI do
334
334
  'User-Agent' => 'Ruby',
335
335
  'X-Rosetteapi-Key' => '0123456789',
336
336
  'X-Rosetteapi-Binding' => 'ruby',
337
- 'X-Rosetteapi-Binding-Version' => '1.7.0' })
337
+ 'X-Rosetteapi-Binding-Version' => '1.8.0' })
338
338
  .to_return(status: 200, body: '{"test": "name-deduplication"}', headers: {})
339
339
  end
340
340
  it 'test name deduplication' do
@@ -342,7 +342,7 @@ describe RosetteAPI do
342
342
  response = RosetteAPI.new('0123456789').get_name_deduplication(params)
343
343
  expect(response).instance_of? Hash
344
344
  end
345
-
345
+
346
346
  it 'test null threshold' do
347
347
  params = NameDeduplicationParameters.new(names, nil)
348
348
  response = RosetteAPI.new('0123456789').get_name_deduplication(params)
@@ -385,7 +385,7 @@ describe RosetteAPI do
385
385
  'User-Agent' => 'Ruby',
386
386
  'X-Rosetteapi-Key' => '0123456789',
387
387
  'X-Rosetteapi-Binding' => 'ruby',
388
- 'X-Rosetteapi-Binding-Version' => '1.7.0' })
388
+ 'X-Rosetteapi-Binding-Version' => '1.8.0' })
389
389
  .to_return(status: 200, body: '{"test": "transliteration"}', headers: {})
390
390
  end
391
391
  it 'test transliteration' do
@@ -418,7 +418,7 @@ describe RosetteAPI do
418
418
  'User-Agent' => 'Ruby',
419
419
  'X-Rosetteapi-Key' => '0123456789',
420
420
  'X-Rosetteapi-Binding' => 'ruby',
421
- 'X-Rosetteapi-Binding-Version' => '1.7.0' })
421
+ 'X-Rosetteapi-Binding-Version' => '1.8.0' })
422
422
  .to_return(status: 200, body: '{"test": "tokens"}', headers: {})
423
423
  end
424
424
  it 'test tokens' do
@@ -429,6 +429,27 @@ describe RosetteAPI do
429
429
  end
430
430
  end
431
431
 
432
+ describe '.get_topics' do
433
+ before do
434
+ stub_request(:post, 'https://api.rosette.com/rest/v1/topics')
435
+ .with(body: @json,
436
+ headers: { 'Accept' => 'application/json',
437
+ 'Accept-Encoding' => 'gzip;q=1.0,deflate;q=0.6,identity;q=0.3',
438
+ 'Content-Type' => 'application/json',
439
+ 'User-Agent' => 'Ruby',
440
+ 'X-Rosetteapi-Key' => '0123456789',
441
+ 'X-Rosetteapi-Binding' => 'ruby',
442
+ 'X-Rosetteapi-Binding-Version' => '1.8.0' })
443
+ .to_return(status: 200, body: '{"test": "topics"}', headers: {})
444
+ end
445
+ it 'test topics' do
446
+ params = DocumentParameters.new
447
+ params.content = @content
448
+ response = RosetteAPI.new('0123456789').get_topics(params)
449
+ expect(response).instance_of? Hash
450
+ end
451
+ end
452
+
432
453
  describe '.get_sentences' do
433
454
  before do
434
455
  stub_request(:post, 'https://api.rosette.com/rest/v1/sentences')
@@ -439,7 +460,7 @@ describe RosetteAPI do
439
460
  'User-Agent' => 'Ruby',
440
461
  'X-Rosetteapi-Key' => '0123456789',
441
462
  'X-Rosetteapi-Binding' => 'ruby',
442
- 'X-Rosetteapi-Binding-Version' => '1.7.0' })
463
+ 'X-Rosetteapi-Binding-Version' => '1.8.0' })
443
464
  .to_return(status: 200, body: '{"test": "sentences"}', headers: {})
444
465
  end
445
466
  it 'test sentences' do
@@ -490,7 +511,7 @@ describe RosetteAPI do
490
511
  'User-Agent' => 'Ruby',
491
512
  'X-Rosetteapi-Key' => '0123456789',
492
513
  'X-Rosetteapi-Binding' => 'ruby',
493
- 'X-Rosetteapi-Binding-Version' => '1.7.0',
514
+ 'X-Rosetteapi-Binding-Version' => '1.8.0',
494
515
  'X-RosetteApi-App' => 'ruby-app' })
495
516
  .to_return(status: 200, body: '{"test": "language"}', headers: {})
496
517
  end
@@ -527,7 +548,7 @@ describe RosetteAPI do
527
548
  'User-Agent' => 'Ruby',
528
549
  'X-Rosetteapi-Key' => '0123456789',
529
550
  'X-Rosetteapi-Binding' => 'ruby',
530
- 'X-Rosetteapi-Binding-Version' => '1.7.0' })
551
+ 'X-Rosetteapi-Binding-Version' => '1.8.0' })
531
552
  .to_return(status: 200, body: '{"test": "language"}', headers: {})
532
553
  end
533
554
  it 'test text_embedding' do
@@ -548,7 +569,7 @@ describe RosetteAPI do
548
569
  'User-Agent' => 'Ruby',
549
570
  'X-Rosetteapi-Key' => '0123456789',
550
571
  'X-Rosetteapi-Binding' => 'ruby',
551
- 'X-Rosetteapi-Binding-Version' => '1.7.0' })
572
+ 'X-Rosetteapi-Binding-Version' => '1.8.0' })
552
573
  .to_return(status: 200, body: '{"test": "language"}', headers: {})
553
574
  end
554
575
  it 'test syntax_dependencies' do
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rosette_api
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.7.0
4
+ version: 1.8.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Basis Technology Corp
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-06-14 00:00:00.000000000 Z
11
+ date: 2017-10-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rubysl-securerandom
@@ -63,7 +63,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
63
63
  version: '0'
64
64
  requirements: []
65
65
  rubyforge_project:
66
- rubygems_version: 2.6.12
66
+ rubygems_version: 2.6.14
67
67
  signing_key:
68
68
  specification_version: 2
69
69
  summary: Rosette API gem that supports multilingual text-analytics.