aylien_text_api 0.4.0 → 0.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/lib/aylien_text_api/client.rb +71 -30
- data/lib/aylien_text_api/connection.rb +7 -0
- data/lib/aylien_text_api/version.rb +1 -1
- data/spec/fixtures/aylien_text_api/client/classify_by_taxonomy_with_invalid_client.yml +3 -3
- data/spec/fixtures/aylien_text_api/client/classify_by_taxonomy_with_invalid_params.yml +5 -5
- data/spec/fixtures/aylien_text_api/client/classify_by_taxonomy_with_invalid_taxonomy.yml +5 -5
- data/spec/fixtures/aylien_text_api/client/classify_by_taxonomy_with_text.yml +5 -5
- data/spec/fixtures/aylien_text_api/client/classify_by_taxonomy_with_unauthenticated_client.yml +3 -3
- data/spec/fixtures/aylien_text_api/client/classify_by_taxonomy_with_valid_url.yml +5 -5
- data/spec/fixtures/aylien_text_api/client/classify_by_taxonomy_with_value_as_text.yml +5 -5
- data/spec/fixtures/aylien_text_api/client/classify_by_taxonomy_with_value_as_valid_url.yml +5 -5
- data/spec/fixtures/aylien_text_api/client/classify_with_invalid_client.yml +3 -3
- data/spec/fixtures/aylien_text_api/client/classify_with_invalid_params.yml +6 -6
- data/spec/fixtures/aylien_text_api/client/classify_with_text.yml +5 -5
- data/spec/fixtures/aylien_text_api/client/classify_with_unauthenticated_client.yml +3 -3
- data/spec/fixtures/aylien_text_api/client/classify_with_valid_url.yml +5 -5
- data/spec/fixtures/aylien_text_api/client/classify_with_value_as_text.yml +5 -5
- data/spec/fixtures/aylien_text_api/client/classify_with_value_as_valid_url.yml +5 -5
- data/spec/fixtures/aylien_text_api/client/combined_with_invalid_client.yml +3 -3
- data/spec/fixtures/aylien_text_api/client/combined_with_invalid_params.yml +5 -5
- data/spec/fixtures/aylien_text_api/client/combined_with_text.yml +6 -6
- data/spec/fixtures/aylien_text_api/client/combined_with_unauthenticated_client.yml +3 -3
- data/spec/fixtures/aylien_text_api/client/combined_with_valid_url.yml +6 -6
- data/spec/fixtures/aylien_text_api/client/combined_with_value_as_text.yml +6 -6
- data/spec/fixtures/aylien_text_api/client/combined_with_value_as_valid_url.yml +77 -77
- data/spec/fixtures/aylien_text_api/client/concepts_with_invalid_client.yml +3 -3
- data/spec/fixtures/aylien_text_api/client/concepts_with_invalid_params.yml +5 -5
- data/spec/fixtures/aylien_text_api/client/concepts_with_text.yml +5 -5
- data/spec/fixtures/aylien_text_api/client/concepts_with_unauthenticated_client.yml +3 -3
- data/spec/fixtures/aylien_text_api/client/concepts_with_valid_url.yml +5 -5
- data/spec/fixtures/aylien_text_api/client/concepts_with_value_as_text.yml +5 -5
- data/spec/fixtures/aylien_text_api/client/concepts_with_value_as_valid_url.yml +5 -5
- data/spec/fixtures/aylien_text_api/client/entities_with_invalid_client.yml +3 -3
- data/spec/fixtures/aylien_text_api/client/entities_with_invalid_params.yml +5 -5
- data/spec/fixtures/aylien_text_api/client/entities_with_text.yml +5 -5
- data/spec/fixtures/aylien_text_api/client/entities_with_unauthenticated_client.yml +3 -3
- data/spec/fixtures/aylien_text_api/client/entities_with_valid_url.yml +5 -5
- data/spec/fixtures/aylien_text_api/client/entities_with_value_as_text.yml +5 -5
- data/spec/fixtures/aylien_text_api/client/entities_with_value_as_valid_url.yml +5 -5
- data/spec/fixtures/aylien_text_api/client/extract_with_invalid_client.yml +3 -3
- data/spec/fixtures/aylien_text_api/client/extract_with_invalid_params.yml +6 -6
- data/spec/fixtures/aylien_text_api/client/extract_with_unauthenticated_client.yml +3 -3
- data/spec/fixtures/aylien_text_api/client/extract_with_valid_url.yml +5 -5
- data/spec/fixtures/aylien_text_api/client/extract_with_value_as_text.yml +5 -5
- data/spec/fixtures/aylien_text_api/client/extract_with_value_as_valid_url.yml +5 -5
- data/spec/fixtures/aylien_text_api/client/hashtags_with_invalid_client.yml +3 -3
- data/spec/fixtures/aylien_text_api/client/hashtags_with_invalid_params.yml +5 -5
- data/spec/fixtures/aylien_text_api/client/hashtags_with_text.yml +5 -5
- data/spec/fixtures/aylien_text_api/client/hashtags_with_unauthenticated_client.yml +3 -3
- data/spec/fixtures/aylien_text_api/client/hashtags_with_valid_url.yml +5 -5
- data/spec/fixtures/aylien_text_api/client/hashtags_with_value_as_text.yml +5 -5
- data/spec/fixtures/aylien_text_api/client/hashtags_with_value_as_valid_url.yml +5 -5
- data/spec/fixtures/aylien_text_api/client/image_tags_with_invalid_client.yml +3 -3
- data/spec/fixtures/aylien_text_api/client/image_tags_with_invalid_params.yml +6 -6
- data/spec/fixtures/aylien_text_api/client/image_tags_with_unauthenticated_client.yml +3 -3
- data/spec/fixtures/aylien_text_api/client/image_tags_with_valid_url.yml +8 -8
- data/spec/fixtures/aylien_text_api/client/image_tags_with_value_as_text.yml +5 -5
- data/spec/fixtures/aylien_text_api/client/image_tags_with_value_as_valid_url.yml +8 -8
- data/spec/fixtures/aylien_text_api/client/language_with_invalid_client.yml +3 -3
- data/spec/fixtures/aylien_text_api/client/language_with_invalid_params.yml +5 -5
- data/spec/fixtures/aylien_text_api/client/language_with_unauthenticated_client.yml +3 -3
- data/spec/fixtures/aylien_text_api/client/language_with_valid_text.yml +6 -6
- data/spec/fixtures/aylien_text_api/client/language_with_valid_url.yml +6 -6
- data/spec/fixtures/aylien_text_api/client/language_with_value_as_text.yml +6 -6
- data/spec/fixtures/aylien_text_api/client/language_with_value_as_valid_url.yml +6 -6
- data/spec/fixtures/aylien_text_api/client/microformats_with_invalid_client.yml +3 -3
- data/spec/fixtures/aylien_text_api/client/microformats_with_invalid_params.yml +5 -5
- data/spec/fixtures/aylien_text_api/client/microformats_with_unauthenticated_client.yml +3 -3
- data/spec/fixtures/aylien_text_api/client/microformats_with_valid_url.yml +6 -6
- data/spec/fixtures/aylien_text_api/client/microformats_with_value_as_valid_url.yml +6 -6
- data/spec/fixtures/aylien_text_api/client/rate_limits.yml +53 -0
- data/spec/fixtures/aylien_text_api/client/rate_limits_with_invalid_client.yml +38 -0
- data/spec/fixtures/aylien_text_api/client/rate_limits_with_unauthenticated_client.yml +42 -0
- data/spec/fixtures/aylien_text_api/client/related_with_invalid_client.yml +3 -3
- data/spec/fixtures/aylien_text_api/client/related_with_invalid_params.yml +5 -5
- data/spec/fixtures/aylien_text_api/client/related_with_phrase.yml +5 -5
- data/spec/fixtures/aylien_text_api/client/related_with_unauthenticated_client.yml +3 -3
- data/spec/fixtures/aylien_text_api/client/related_with_value_as_phrase.yml +5 -5
- data/spec/fixtures/aylien_text_api/client/related_with_value_as_valid_url.yml +5 -5
- data/spec/fixtures/aylien_text_api/client/sentiment_with_invalid_client.yml +3 -3
- data/spec/fixtures/aylien_text_api/client/sentiment_with_invalid_params.yml +5 -5
- data/spec/fixtures/aylien_text_api/client/sentiment_with_text.yml +7 -7
- data/spec/fixtures/aylien_text_api/client/sentiment_with_unauthenticated_client.yml +3 -3
- data/spec/fixtures/aylien_text_api/client/sentiment_with_valid_url.yml +6 -6
- data/spec/fixtures/aylien_text_api/client/sentiment_with_value_as_text.yml +7 -7
- data/spec/fixtures/aylien_text_api/client/sentiment_with_value_as_valid_url.yml +6 -6
- data/spec/fixtures/aylien_text_api/client/summarize_with_invalid_client.yml +3 -3
- data/spec/fixtures/aylien_text_api/client/summarize_with_invalid_params.yml +5 -5
- data/spec/fixtures/aylien_text_api/client/summarize_with_title_and_text.yml +5 -5
- data/spec/fixtures/aylien_text_api/client/summarize_with_unauthenticated_client.yml +3 -3
- data/spec/fixtures/aylien_text_api/client/summarize_with_valid_url.yml +5 -5
- data/spec/fixtures/aylien_text_api/client/summarize_with_value_as_text_and_title.yml +5 -5
- data/spec/fixtures/aylien_text_api/client/summarize_with_value_as_text_and_without_title.yml +5 -5
- data/spec/fixtures/aylien_text_api/client/summarize_with_value_as_valid_url.yml +5 -5
- data/spec/fixtures/aylien_text_api/client/unsupervised_classify_with_invalid_client.yml +3 -3
- data/spec/fixtures/aylien_text_api/client/unsupervised_classify_with_invalid_params.yml +5 -5
- data/spec/fixtures/aylien_text_api/client/unsupervised_classify_with_text.yml +5 -5
- data/spec/fixtures/aylien_text_api/client/unsupervised_classify_with_unauthenticated_client.yml +3 -3
- data/spec/fixtures/aylien_text_api/client/unsupervised_classify_with_valid_url.yml +5 -5
- data/spec/fixtures/aylien_text_api/client/unsupervised_classify_with_value_as_text.yml +5 -5
- data/spec/fixtures/aylien_text_api/client/unsupervised_classify_with_value_as_valid_url.yml +5 -5
- data/spec/lib/aylien_text_api/classify.rb +1 -1
- data/spec/lib/aylien_text_api/client_spec.rb +1 -0
- data/spec/lib/aylien_text_api/rate_limits.rb +26 -0
- metadata +11 -3
@@ -25,9 +25,9 @@ http_interactions:
|
|
25
25
|
message: OK
|
26
26
|
headers:
|
27
27
|
Server:
|
28
|
-
- openresty/1.
|
28
|
+
- openresty/1.9.3.2
|
29
29
|
Date:
|
30
|
-
-
|
30
|
+
- Fri, 22 Jan 2016 13:17:43 GMT
|
31
31
|
Content-Type:
|
32
32
|
- application/json;charset=UTF-8
|
33
33
|
Content-Length:
|
@@ -37,9 +37,9 @@ http_interactions:
|
|
37
37
|
X-Ratelimit-Limit:
|
38
38
|
- '207000'
|
39
39
|
X-Ratelimit-Remaining:
|
40
|
-
- '
|
40
|
+
- '206388'
|
41
41
|
X-Ratelimit-Reset:
|
42
|
-
- '
|
42
|
+
- '1453507200'
|
43
43
|
body:
|
44
44
|
encoding: ASCII-8BIT
|
45
45
|
string: !binary |-
|
@@ -93,5 +93,5 @@ http_interactions:
|
|
93
93
|
LCJzY29yZSI6MC4wMDQxMzY1MDQ2NTM1Njc3MzZ9LHsibGFiZWwiOiJwcmVz
|
94
94
|
aWRlbnQiLCJzY29yZSI6MC4wMDEwMzQxMjYxNjMzOTE5MzR9XX0=
|
95
95
|
http_version:
|
96
|
-
recorded_at:
|
96
|
+
recorded_at: Fri, 22 Jan 2016 13:17:43 GMT
|
97
97
|
recorded_with: VCR 2.9.3
|
@@ -25,9 +25,9 @@ http_interactions:
|
|
25
25
|
message: OK
|
26
26
|
headers:
|
27
27
|
Server:
|
28
|
-
- openresty/1.
|
28
|
+
- openresty/1.9.3.2
|
29
29
|
Date:
|
30
|
-
-
|
30
|
+
- Fri, 22 Jan 2016 13:17:44 GMT
|
31
31
|
Content-Type:
|
32
32
|
- application/json;charset=UTF-8
|
33
33
|
Content-Length:
|
@@ -37,9 +37,9 @@ http_interactions:
|
|
37
37
|
X-Ratelimit-Limit:
|
38
38
|
- '207000'
|
39
39
|
X-Ratelimit-Remaining:
|
40
|
-
- '
|
40
|
+
- '206387'
|
41
41
|
X-Ratelimit-Reset:
|
42
|
-
- '
|
42
|
+
- '1453507200'
|
43
43
|
body:
|
44
44
|
encoding: UTF-8
|
45
45
|
string: |-
|
@@ -53,5 +53,5 @@ http_interactions:
|
|
53
53
|
}]
|
54
54
|
}
|
55
55
|
http_version:
|
56
|
-
recorded_at:
|
56
|
+
recorded_at: Fri, 22 Jan 2016 13:17:44 GMT
|
57
57
|
recorded_with: VCR 2.9.3
|
@@ -25,9 +25,9 @@ http_interactions:
|
|
25
25
|
message: OK
|
26
26
|
headers:
|
27
27
|
Server:
|
28
|
-
- openresty/1.
|
28
|
+
- openresty/1.9.3.2
|
29
29
|
Date:
|
30
|
-
-
|
30
|
+
- Fri, 22 Jan 2016 13:17:52 GMT
|
31
31
|
Content-Type:
|
32
32
|
- application/json;charset=UTF-8
|
33
33
|
Content-Length:
|
@@ -37,9 +37,9 @@ http_interactions:
|
|
37
37
|
X-Ratelimit-Limit:
|
38
38
|
- '207000'
|
39
39
|
X-Ratelimit-Remaining:
|
40
|
-
- '
|
40
|
+
- '206383'
|
41
41
|
X-Ratelimit-Reset:
|
42
|
-
- '
|
42
|
+
- '1453507200'
|
43
43
|
body:
|
44
44
|
encoding: ASCII-8BIT
|
45
45
|
string: !binary |-
|
@@ -93,5 +93,5 @@ http_interactions:
|
|
93
93
|
LCJzY29yZSI6MC4wMDQxMzY1MDQ2NTM1Njc3MzZ9LHsibGFiZWwiOiJwcmVz
|
94
94
|
aWRlbnQiLCJzY29yZSI6MC4wMDEwMzQxMjYxNjMzOTE5MzR9XX0=
|
95
95
|
http_version:
|
96
|
-
recorded_at:
|
96
|
+
recorded_at: Fri, 22 Jan 2016 13:17:52 GMT
|
97
97
|
recorded_with: VCR 2.9.3
|
@@ -79,7 +79,7 @@ describe "Classify endpoint" do
|
|
79
79
|
it "should raise BadRequest with invalid params" do
|
80
80
|
VCR.use_cassette('classify_with_invalid_params') do
|
81
81
|
proc {
|
82
|
-
@
|
82
|
+
@invalid_client.classify!(wrong_param: @text)
|
83
83
|
}.must_raise AylienTextApi::Error::BadRequest
|
84
84
|
end
|
85
85
|
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
describe "RateLimits header parameter" do
|
2
|
+
before do
|
3
|
+
@text = %q(Hello there! How's it going?)
|
4
|
+
end
|
5
|
+
|
6
|
+
it "shouldn't be nil" do
|
7
|
+
VCR.use_cassette('rate_limits') do
|
8
|
+
result = @client.rate_limits
|
9
|
+
result.wont_be_nil
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
it "should be nil with unauthenticated client" do
|
14
|
+
VCR.use_cassette('rate_limits_with_unauthenticated_client') do
|
15
|
+
result = @unauthenticated_client.rate_limits
|
16
|
+
result.must_be_nil
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
it "should be nil with invalid client" do
|
21
|
+
VCR.use_cassette('rate_limits_with_invalid_client') do
|
22
|
+
result = @invalid_client.rate_limits
|
23
|
+
result.must_be_nil
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: aylien_text_api
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Aylien Inc.
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2016-01-22 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rake
|
@@ -158,6 +158,9 @@ files:
|
|
158
158
|
- spec/fixtures/aylien_text_api/client/microformats_with_unauthenticated_client.yml
|
159
159
|
- spec/fixtures/aylien_text_api/client/microformats_with_valid_url.yml
|
160
160
|
- spec/fixtures/aylien_text_api/client/microformats_with_value_as_valid_url.yml
|
161
|
+
- spec/fixtures/aylien_text_api/client/rate_limits.yml
|
162
|
+
- spec/fixtures/aylien_text_api/client/rate_limits_with_invalid_client.yml
|
163
|
+
- spec/fixtures/aylien_text_api/client/rate_limits_with_unauthenticated_client.yml
|
161
164
|
- spec/fixtures/aylien_text_api/client/related_with_invalid_client.yml
|
162
165
|
- spec/fixtures/aylien_text_api/client/related_with_invalid_params.yml
|
163
166
|
- spec/fixtures/aylien_text_api/client/related_with_phrase.yml
|
@@ -197,6 +200,7 @@ files:
|
|
197
200
|
- spec/lib/aylien_text_api/image_tags.rb
|
198
201
|
- spec/lib/aylien_text_api/language.rb
|
199
202
|
- spec/lib/aylien_text_api/microformats.rb
|
203
|
+
- spec/lib/aylien_text_api/rate_limits.rb
|
200
204
|
- spec/lib/aylien_text_api/related.rb
|
201
205
|
- spec/lib/aylien_text_api/sentiment.rb
|
202
206
|
- spec/lib/aylien_text_api/summarize.rb
|
@@ -222,7 +226,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
222
226
|
version: '0'
|
223
227
|
requirements: []
|
224
228
|
rubyforge_project:
|
225
|
-
rubygems_version: 2.
|
229
|
+
rubygems_version: 2.5.0
|
226
230
|
signing_key:
|
227
231
|
specification_version: 4
|
228
232
|
summary: AYLIEN Text Analysis API is a package of Natural Language Processing and
|
@@ -296,6 +300,9 @@ test_files:
|
|
296
300
|
- spec/fixtures/aylien_text_api/client/microformats_with_unauthenticated_client.yml
|
297
301
|
- spec/fixtures/aylien_text_api/client/microformats_with_valid_url.yml
|
298
302
|
- spec/fixtures/aylien_text_api/client/microformats_with_value_as_valid_url.yml
|
303
|
+
- spec/fixtures/aylien_text_api/client/rate_limits.yml
|
304
|
+
- spec/fixtures/aylien_text_api/client/rate_limits_with_invalid_client.yml
|
305
|
+
- spec/fixtures/aylien_text_api/client/rate_limits_with_unauthenticated_client.yml
|
299
306
|
- spec/fixtures/aylien_text_api/client/related_with_invalid_client.yml
|
300
307
|
- spec/fixtures/aylien_text_api/client/related_with_invalid_params.yml
|
301
308
|
- spec/fixtures/aylien_text_api/client/related_with_phrase.yml
|
@@ -335,6 +342,7 @@ test_files:
|
|
335
342
|
- spec/lib/aylien_text_api/image_tags.rb
|
336
343
|
- spec/lib/aylien_text_api/language.rb
|
337
344
|
- spec/lib/aylien_text_api/microformats.rb
|
345
|
+
- spec/lib/aylien_text_api/rate_limits.rb
|
338
346
|
- spec/lib/aylien_text_api/related.rb
|
339
347
|
- spec/lib/aylien_text_api/sentiment.rb
|
340
348
|
- spec/lib/aylien_text_api/summarize.rb
|