aylien_text_api 0.3.0 → 0.4.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 +6 -6
- data/lib/aylien_text_api/client.rb +160 -12
- data/lib/aylien_text_api/configuration.rb +1 -0
- data/lib/aylien_text_api/error.rb +5 -2
- data/lib/aylien_text_api/version.rb +1 -1
- data/spec/fixtures/aylien_text_api/client/classify_by_taxonomy_with_invalid_client.yml +38 -0
- data/spec/fixtures/aylien_text_api/client/classify_by_taxonomy_with_invalid_params.yml +57 -0
- data/spec/fixtures/aylien_text_api/client/classify_by_taxonomy_with_invalid_taxonomy.yml +48 -0
- data/spec/fixtures/aylien_text_api/client/classify_by_taxonomy_with_text.yml +75 -0
- data/spec/fixtures/aylien_text_api/client/classify_by_taxonomy_with_unauthenticated_client.yml +42 -0
- data/spec/fixtures/aylien_text_api/client/classify_by_taxonomy_with_valid_url.yml +155 -0
- data/spec/fixtures/aylien_text_api/client/classify_by_taxonomy_with_value_as_text.yml +75 -0
- data/spec/fixtures/aylien_text_api/client/classify_by_taxonomy_with_value_as_valid_url.yml +155 -0
- 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 +5 -5
- 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 +11 -11
- 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 +9 -9
- data/spec/fixtures/aylien_text_api/client/combined_with_value_as_text.yml +11 -11
- data/spec/fixtures/aylien_text_api/client/combined_with_value_as_valid_url.yml +9 -9
- 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 +5 -5
- 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 +8 -8
- 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 +9 -9
- data/spec/fixtures/aylien_text_api/client/hashtags_with_value_as_text.yml +8 -8
- data/spec/fixtures/aylien_text_api/client/hashtags_with_value_as_valid_url.yml +9 -9
- 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/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 +5 -5
- 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 +5 -5
- data/spec/fixtures/aylien_text_api/client/sentiment_with_value_as_text.yml +5 -5
- data/spec/fixtures/aylien_text_api/client/sentiment_with_value_as_valid_url.yml +5 -5
- 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_by_taxonomy.rb +124 -0
- data/spec/lib/aylien_text_api/client_spec.rb +1 -0
- metadata +21 -2
@@ -12,7 +12,7 @@ http_interactions:
|
|
12
12
|
Accept:
|
13
13
|
- "*/*"
|
14
14
|
User-Agent:
|
15
|
-
- Aylien Text API Ruby Gem 0.
|
15
|
+
- Aylien Text API Ruby Gem 0.4.0
|
16
16
|
Content-Type:
|
17
17
|
- application/x-www-form-urlencoded
|
18
18
|
X-Aylien-Textapi-Application-Id:
|
@@ -27,7 +27,7 @@ http_interactions:
|
|
27
27
|
Server:
|
28
28
|
- openresty/1.7.7.2
|
29
29
|
Date:
|
30
|
-
- Thu,
|
30
|
+
- Thu, 17 Sep 2015 11:21:10 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
|
+
- '206274'
|
41
41
|
X-Ratelimit-Reset:
|
42
|
-
- '
|
42
|
+
- '1442534400'
|
43
43
|
body:
|
44
44
|
encoding: UTF-8
|
45
45
|
string: '{"text":"CCTV footage shows the moment a suicide car bomber detonates\n a
|
@@ -49,5 +49,5 @@ http_interactions:
|
|
49
49
|
for the attack saying it was in retaliation for\n Hezbollah''s military
|
50
50
|
support of president Bashar al-Assad''s forces in Syria","classes":[{"label":"president","score":0.024},{"label":"travel","score":0.0},{"label":"voyage","score":0.0}]}'
|
51
51
|
http_version:
|
52
|
-
recorded_at: Thu,
|
52
|
+
recorded_at: Thu, 17 Sep 2015 11:21:10 GMT
|
53
53
|
recorded_with: VCR 2.9.3
|
data/spec/fixtures/aylien_text_api/client/unsupervised_classify_with_unauthenticated_client.yml
CHANGED
@@ -12,7 +12,7 @@ http_interactions:
|
|
12
12
|
Accept:
|
13
13
|
- "*/*"
|
14
14
|
User-Agent:
|
15
|
-
- Aylien Text API Ruby Gem 0.
|
15
|
+
- Aylien Text API Ruby Gem 0.4.0
|
16
16
|
Content-Type:
|
17
17
|
- application/x-www-form-urlencoded
|
18
18
|
X-Aylien-Textapi-Application-Id:
|
@@ -27,7 +27,7 @@ http_interactions:
|
|
27
27
|
Server:
|
28
28
|
- openresty/1.7.7.2
|
29
29
|
Date:
|
30
|
-
- Thu,
|
30
|
+
- Thu, 17 Sep 2015 11:21:10 GMT
|
31
31
|
Content-Type:
|
32
32
|
- text/plain; charset=us-ascii
|
33
33
|
Transfer-Encoding:
|
@@ -38,5 +38,5 @@ http_interactions:
|
|
38
38
|
encoding: UTF-8
|
39
39
|
string: Authentication failed
|
40
40
|
http_version:
|
41
|
-
recorded_at: Thu,
|
41
|
+
recorded_at: Thu, 17 Sep 2015 11:21:10 GMT
|
42
42
|
recorded_with: VCR 2.9.3
|
@@ -12,7 +12,7 @@ http_interactions:
|
|
12
12
|
Accept:
|
13
13
|
- "*/*"
|
14
14
|
User-Agent:
|
15
|
-
- Aylien Text API Ruby Gem 0.
|
15
|
+
- Aylien Text API Ruby Gem 0.4.0
|
16
16
|
Content-Type:
|
17
17
|
- application/x-www-form-urlencoded
|
18
18
|
X-Aylien-Textapi-Application-Id:
|
@@ -27,7 +27,7 @@ http_interactions:
|
|
27
27
|
Server:
|
28
28
|
- openresty/1.7.7.2
|
29
29
|
Date:
|
30
|
-
- Thu,
|
30
|
+
- Thu, 17 Sep 2015 11:21:14 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
|
+
- '206273'
|
41
41
|
X-Ratelimit-Reset:
|
42
|
-
- '
|
42
|
+
- '1442534400'
|
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: Thu,
|
96
|
+
recorded_at: Thu, 17 Sep 2015 11:21:14 GMT
|
97
97
|
recorded_with: VCR 2.9.3
|
@@ -12,7 +12,7 @@ http_interactions:
|
|
12
12
|
Accept:
|
13
13
|
- "*/*"
|
14
14
|
User-Agent:
|
15
|
-
- Aylien Text API Ruby Gem 0.
|
15
|
+
- Aylien Text API Ruby Gem 0.4.0
|
16
16
|
Content-Type:
|
17
17
|
- application/x-www-form-urlencoded
|
18
18
|
X-Aylien-Textapi-Application-Id:
|
@@ -27,7 +27,7 @@ http_interactions:
|
|
27
27
|
Server:
|
28
28
|
- openresty/1.7.7.2
|
29
29
|
Date:
|
30
|
-
- Thu,
|
30
|
+
- Thu, 17 Sep 2015 11:21:08 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
|
+
- '206275'
|
41
41
|
X-Ratelimit-Reset:
|
42
|
-
- '
|
42
|
+
- '1442534400'
|
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: Thu,
|
56
|
+
recorded_at: Thu, 17 Sep 2015 11:21:08 GMT
|
57
57
|
recorded_with: VCR 2.9.3
|
@@ -12,7 +12,7 @@ http_interactions:
|
|
12
12
|
Accept:
|
13
13
|
- "*/*"
|
14
14
|
User-Agent:
|
15
|
-
- Aylien Text API Ruby Gem 0.
|
15
|
+
- Aylien Text API Ruby Gem 0.4.0
|
16
16
|
Content-Type:
|
17
17
|
- application/x-www-form-urlencoded
|
18
18
|
X-Aylien-Textapi-Application-Id:
|
@@ -27,7 +27,7 @@ http_interactions:
|
|
27
27
|
Server:
|
28
28
|
- openresty/1.7.7.2
|
29
29
|
Date:
|
30
|
-
- Thu,
|
30
|
+
- Thu, 17 Sep 2015 11:21:18 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
|
+
- '206272'
|
41
41
|
X-Ratelimit-Reset:
|
42
|
-
- '
|
42
|
+
- '1442534400'
|
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: Thu,
|
96
|
+
recorded_at: Thu, 17 Sep 2015 11:21:18 GMT
|
97
97
|
recorded_with: VCR 2.9.3
|
@@ -0,0 +1,124 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
describe "Classify by taxonomy endpoint" do
|
4
|
+
before do
|
5
|
+
@url = "http://techcrunch.com/2014/10/20/the-super-slim-kindle-voyage-is-a-great-travel-companion/"
|
6
|
+
@text = %q(CCTV footage shows the moment a suicide car bomber detonates
|
7
|
+
a device in Beirut on Tuesday. The incident took place in an area
|
8
|
+
of support for Hezbollah and left four people dead with many more wounded.
|
9
|
+
A group calling itself the al-Nusra Front in Lebanon has claimed
|
10
|
+
responsibility for the attack saying it was in retaliation for
|
11
|
+
Hezbollah's military support of president Bashar al-Assad's forces in Syria)
|
12
|
+
@taxonomy = "iab-qag"
|
13
|
+
@invalid_taxonomy = "random_string"
|
14
|
+
end
|
15
|
+
|
16
|
+
it "shouldn't be nil with valid url" do
|
17
|
+
VCR.use_cassette('classify_by_taxonomy_with_valid_url') do
|
18
|
+
result = @client.classify_by_taxonomy(url: @url, taxonomy: @taxonomy)
|
19
|
+
result.wont_be_nil
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
it "shouldn't be nil with text" do
|
24
|
+
VCR.use_cassette('classify_by_taxonomy_with_text') do
|
25
|
+
result = @client.classify_by_taxonomy(text: @text, taxonomy: @taxonomy)
|
26
|
+
result.wont_be_nil
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
it "shouldn't be nil with value as valid url" do
|
31
|
+
VCR.use_cassette('classify_by_taxonomy_with_value_as_valid_url') do
|
32
|
+
result = @client.classify_by_taxonomy(@url, taxonomy: @taxonomy)
|
33
|
+
result.wont_be_nil
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
it "shouldn't be nil with value as value" do
|
38
|
+
VCR.use_cassette('classify_by_taxonomy_with_value_as_text') do
|
39
|
+
result = @client.classify_by_taxonomy(@text, taxonomy: @taxonomy)
|
40
|
+
result.wont_be_nil
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
it "should be nil with invalid params" do
|
45
|
+
VCR.use_cassette('classify_with_invalid_params') do
|
46
|
+
result = @client.classify_by_taxonomy(wrong_param: @text, taxonomy: @taxonomy)
|
47
|
+
result.must_be_nil
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
it "should be nil with unauthenticated client" do
|
52
|
+
VCR.use_cassette('classify_by_taxonomy_with_unauthenticated_client') do
|
53
|
+
result = @unauthenticated_client
|
54
|
+
.classify_by_taxonomy(text: @text, taxonomy: @taxonomy)
|
55
|
+
result.must_be_nil
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
59
|
+
it "should raise Forbidden with unauthenticated client" do
|
60
|
+
VCR.use_cassette('classify_by_taxonomy_with_unauthenticated_client') do
|
61
|
+
proc {
|
62
|
+
@unauthenticated_client
|
63
|
+
.classify_by_taxonomy!(text: @text, taxonomy: @taxonomy)
|
64
|
+
}.must_raise AylienTextApi::Error::Forbidden
|
65
|
+
end
|
66
|
+
end
|
67
|
+
|
68
|
+
it "should be nil with invalid client" do
|
69
|
+
VCR.use_cassette('classify_by_taxonomy_with_invalid_client') do
|
70
|
+
result = @invalid_client
|
71
|
+
.classify_by_taxonomy(text: @text, taxonomy: @taxonomy)
|
72
|
+
result.must_be_nil
|
73
|
+
end
|
74
|
+
end
|
75
|
+
|
76
|
+
it "should raise Forbidden with invalid client" do
|
77
|
+
VCR.use_cassette('classify_by_taxonomy_with_invalid_client') do
|
78
|
+
proc {
|
79
|
+
@invalid_client.classify_by_taxonomy!(text: @text, taxonomy: @taxonomy)
|
80
|
+
}.must_raise AylienTextApi::Error::Forbidden
|
81
|
+
end
|
82
|
+
end
|
83
|
+
|
84
|
+
it "should raise BadRequest with invalid params" do
|
85
|
+
VCR.use_cassette('classify_by_taxonomy_with_invalid_params') do
|
86
|
+
proc {
|
87
|
+
@client.classify_by_taxonomy!(wrong_param: @text, taxonomy: @taxonomy)
|
88
|
+
}.must_raise AylienTextApi::Error::BadRequest
|
89
|
+
end
|
90
|
+
end
|
91
|
+
|
92
|
+
it "should raise InvalidInput with empty taxonomy" do
|
93
|
+
VCR.use_cassette('classify_by_taxonomy_with_empty_taxonomy') do
|
94
|
+
proc {
|
95
|
+
@client.classify_by_taxonomy(text: @text)
|
96
|
+
}.must_raise AylienTextApi::Error::InvalidInput
|
97
|
+
|
98
|
+
proc {
|
99
|
+
@client.classify_by_taxonomy!(text: @text)
|
100
|
+
}.must_raise AylienTextApi::Error::InvalidInput
|
101
|
+
|
102
|
+
proc {
|
103
|
+
@client.classify_by_taxonomy!(text: @text, taxonomy: '')
|
104
|
+
}.must_raise AylienTextApi::Error::InvalidInput
|
105
|
+
end
|
106
|
+
end
|
107
|
+
|
108
|
+
it "should be nil with invalid taxonomy" do
|
109
|
+
VCR.use_cassette('classify_by_taxonomy_with_invalid_taxonomy') do
|
110
|
+
result = @client
|
111
|
+
.classify_by_taxonomy(text: @text, taxonomy: @invalid_taxonomy)
|
112
|
+
result.must_be_nil
|
113
|
+
end
|
114
|
+
end
|
115
|
+
|
116
|
+
it "should raise BadRequest with invalid taxonomy" do
|
117
|
+
VCR.use_cassette('classify_by_taxonomy_with_invalid_taxonomy') do
|
118
|
+
proc {
|
119
|
+
@client
|
120
|
+
.classify_by_taxonomy!(text: @text, taxonomy: @invalid_taxonomy)
|
121
|
+
}.must_raise AylienTextApi::Error::NotFound
|
122
|
+
end
|
123
|
+
end
|
124
|
+
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.4.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: 2015-
|
12
|
+
date: 2015-09-17 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rake
|
@@ -91,6 +91,14 @@ files:
|
|
91
91
|
- lib/aylien_text_api/connection.rb
|
92
92
|
- lib/aylien_text_api/error.rb
|
93
93
|
- lib/aylien_text_api/version.rb
|
94
|
+
- spec/fixtures/aylien_text_api/client/classify_by_taxonomy_with_invalid_client.yml
|
95
|
+
- spec/fixtures/aylien_text_api/client/classify_by_taxonomy_with_invalid_params.yml
|
96
|
+
- spec/fixtures/aylien_text_api/client/classify_by_taxonomy_with_invalid_taxonomy.yml
|
97
|
+
- spec/fixtures/aylien_text_api/client/classify_by_taxonomy_with_text.yml
|
98
|
+
- spec/fixtures/aylien_text_api/client/classify_by_taxonomy_with_unauthenticated_client.yml
|
99
|
+
- spec/fixtures/aylien_text_api/client/classify_by_taxonomy_with_valid_url.yml
|
100
|
+
- spec/fixtures/aylien_text_api/client/classify_by_taxonomy_with_value_as_text.yml
|
101
|
+
- spec/fixtures/aylien_text_api/client/classify_by_taxonomy_with_value_as_valid_url.yml
|
94
102
|
- spec/fixtures/aylien_text_api/client/classify_with_invalid_client.yml
|
95
103
|
- spec/fixtures/aylien_text_api/client/classify_with_invalid_params.yml
|
96
104
|
- spec/fixtures/aylien_text_api/client/classify_with_text.yml
|
@@ -179,6 +187,7 @@ files:
|
|
179
187
|
- spec/fixtures/aylien_text_api/client/unsupervised_classify_with_value_as_text.yml
|
180
188
|
- spec/fixtures/aylien_text_api/client/unsupervised_classify_with_value_as_valid_url.yml
|
181
189
|
- spec/lib/aylien_text_api/classify.rb
|
190
|
+
- spec/lib/aylien_text_api/classify_by_taxonomy.rb
|
182
191
|
- spec/lib/aylien_text_api/client_spec.rb
|
183
192
|
- spec/lib/aylien_text_api/combined.rb
|
184
193
|
- spec/lib/aylien_text_api/concepts.rb
|
@@ -220,6 +229,14 @@ summary: AYLIEN Text Analysis API is a package of Natural Language Processing an
|
|
220
229
|
Machine Learning-powered tools for analyzing and extracting various kinds of information
|
221
230
|
from text and images.
|
222
231
|
test_files:
|
232
|
+
- spec/fixtures/aylien_text_api/client/classify_by_taxonomy_with_invalid_client.yml
|
233
|
+
- spec/fixtures/aylien_text_api/client/classify_by_taxonomy_with_invalid_params.yml
|
234
|
+
- spec/fixtures/aylien_text_api/client/classify_by_taxonomy_with_invalid_taxonomy.yml
|
235
|
+
- spec/fixtures/aylien_text_api/client/classify_by_taxonomy_with_text.yml
|
236
|
+
- spec/fixtures/aylien_text_api/client/classify_by_taxonomy_with_unauthenticated_client.yml
|
237
|
+
- spec/fixtures/aylien_text_api/client/classify_by_taxonomy_with_valid_url.yml
|
238
|
+
- spec/fixtures/aylien_text_api/client/classify_by_taxonomy_with_value_as_text.yml
|
239
|
+
- spec/fixtures/aylien_text_api/client/classify_by_taxonomy_with_value_as_valid_url.yml
|
223
240
|
- spec/fixtures/aylien_text_api/client/classify_with_invalid_client.yml
|
224
241
|
- spec/fixtures/aylien_text_api/client/classify_with_invalid_params.yml
|
225
242
|
- spec/fixtures/aylien_text_api/client/classify_with_text.yml
|
@@ -308,6 +325,7 @@ test_files:
|
|
308
325
|
- spec/fixtures/aylien_text_api/client/unsupervised_classify_with_value_as_text.yml
|
309
326
|
- spec/fixtures/aylien_text_api/client/unsupervised_classify_with_value_as_valid_url.yml
|
310
327
|
- spec/lib/aylien_text_api/classify.rb
|
328
|
+
- spec/lib/aylien_text_api/classify_by_taxonomy.rb
|
311
329
|
- spec/lib/aylien_text_api/client_spec.rb
|
312
330
|
- spec/lib/aylien_text_api/combined.rb
|
313
331
|
- spec/lib/aylien_text_api/concepts.rb
|
@@ -322,3 +340,4 @@ test_files:
|
|
322
340
|
- spec/lib/aylien_text_api/summarize.rb
|
323
341
|
- spec/lib/aylien_text_api/unsupervised_classify.rb
|
324
342
|
- spec/spec_helper.rb
|
343
|
+
has_rdoc:
|