aylien_text_api 0.2.0 → 0.3.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 +4 -1
- data/README.md +1 -1
- data/aylien_text_api.gemspec +2 -2
- data/lib/aylien_text_api/client.rb +41 -12
- data/lib/aylien_text_api/configuration.rb +2 -1
- data/lib/aylien_text_api/connection.rb +2 -2
- data/lib/aylien_text_api/version.rb +1 -1
- 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 +18 -9
- data/spec/fixtures/aylien_text_api/client/classify_with_text.yml +7 -7
- data/spec/fixtures/aylien_text_api/client/classify_with_unauthenticated_client.yml +5 -5
- data/spec/fixtures/aylien_text_api/client/classify_with_valid_url.yml +7 -7
- data/spec/fixtures/aylien_text_api/client/classify_with_value_as_text.yml +7 -7
- data/spec/fixtures/aylien_text_api/client/classify_with_value_as_valid_url.yml +7 -7
- data/spec/fixtures/aylien_text_api/client/combined_with_invalid_client.yml +38 -0
- data/spec/fixtures/aylien_text_api/client/combined_with_invalid_params.yml +57 -0
- data/spec/fixtures/aylien_text_api/client/combined_with_text.yml +70 -0
- data/spec/fixtures/aylien_text_api/client/combined_with_unauthenticated_client.yml +42 -0
- data/spec/fixtures/aylien_text_api/client/combined_with_valid_url.yml +315 -0
- data/spec/fixtures/aylien_text_api/client/combined_with_value_as_text.yml +70 -0
- data/spec/fixtures/aylien_text_api/client/combined_with_value_as_valid_url.yml +315 -0
- 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 +18 -9
- data/spec/fixtures/aylien_text_api/client/concepts_with_text.yml +42 -13
- data/spec/fixtures/aylien_text_api/client/concepts_with_unauthenticated_client.yml +5 -5
- data/spec/fixtures/aylien_text_api/client/concepts_with_valid_url.yml +89 -100
- data/spec/fixtures/aylien_text_api/client/concepts_with_value_as_text.yml +42 -13
- data/spec/fixtures/aylien_text_api/client/concepts_with_value_as_valid_url.yml +89 -100
- 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 +9 -9
- data/spec/fixtures/aylien_text_api/client/entities_with_text.yml +19 -12
- data/spec/fixtures/aylien_text_api/client/entities_with_unauthenticated_client.yml +5 -5
- data/spec/fixtures/aylien_text_api/client/entities_with_valid_url.yml +459 -456
- data/spec/fixtures/aylien_text_api/client/entities_with_value_as_text.yml +19 -12
- data/spec/fixtures/aylien_text_api/client/entities_with_value_as_valid_url.yml +459 -456
- 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 +19 -10
- data/spec/fixtures/aylien_text_api/client/extract_with_unauthenticated_client.yml +5 -5
- data/spec/fixtures/aylien_text_api/client/extract_with_valid_url.yml +7 -7
- data/spec/fixtures/aylien_text_api/client/extract_with_value_as_text.yml +18 -9
- data/spec/fixtures/aylien_text_api/client/extract_with_value_as_valid_url.yml +7 -7
- 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 +18 -9
- data/spec/fixtures/aylien_text_api/client/hashtags_with_text.yml +10 -11
- data/spec/fixtures/aylien_text_api/client/hashtags_with_unauthenticated_client.yml +5 -5
- data/spec/fixtures/aylien_text_api/client/hashtags_with_valid_url.yml +12 -12
- data/spec/fixtures/aylien_text_api/client/hashtags_with_value_as_text.yml +10 -11
- data/spec/fixtures/aylien_text_api/client/hashtags_with_value_as_valid_url.yml +12 -12
- 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 +7 -7
- data/spec/fixtures/aylien_text_api/client/image_tags_with_unauthenticated_client.yml +5 -5
- data/spec/fixtures/aylien_text_api/client/image_tags_with_valid_url.yml +10 -9
- data/spec/fixtures/aylien_text_api/client/image_tags_with_value_as_text.yml +7 -7
- data/spec/fixtures/aylien_text_api/client/image_tags_with_value_as_valid_url.yml +10 -9
- 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 +18 -9
- data/spec/fixtures/aylien_text_api/client/language_with_unauthenticated_client.yml +5 -5
- data/spec/fixtures/aylien_text_api/client/language_with_valid_text.yml +9 -9
- data/spec/fixtures/aylien_text_api/client/language_with_valid_url.yml +8 -8
- data/spec/fixtures/aylien_text_api/client/language_with_value_as_text.yml +8 -8
- data/spec/fixtures/aylien_text_api/client/language_with_value_as_valid_url.yml +8 -8
- 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 +7 -7
- data/spec/fixtures/aylien_text_api/client/microformats_with_unauthenticated_client.yml +5 -5
- data/spec/fixtures/aylien_text_api/client/microformats_with_valid_url.yml +8 -8
- data/spec/fixtures/aylien_text_api/client/microformats_with_value_as_valid_url.yml +8 -8
- 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 +24 -10
- data/spec/fixtures/aylien_text_api/client/related_with_phrase.yml +47 -47
- data/spec/fixtures/aylien_text_api/client/related_with_unauthenticated_client.yml +5 -5
- data/spec/fixtures/aylien_text_api/client/related_with_value_as_phrase.yml +47 -47
- data/spec/fixtures/aylien_text_api/client/related_with_value_as_valid_url.yml +23 -9
- 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 +18 -9
- data/spec/fixtures/aylien_text_api/client/sentiment_with_text.yml +8 -8
- data/spec/fixtures/aylien_text_api/client/sentiment_with_unauthenticated_client.yml +5 -5
- data/spec/fixtures/aylien_text_api/client/sentiment_with_valid_url.yml +8 -8
- data/spec/fixtures/aylien_text_api/client/sentiment_with_value_as_text.yml +8 -8
- data/spec/fixtures/aylien_text_api/client/sentiment_with_value_as_valid_url.yml +8 -8
- 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 +23 -10
- data/spec/fixtures/aylien_text_api/client/summarize_with_title_and_text.yml +7 -7
- data/spec/fixtures/aylien_text_api/client/summarize_with_unauthenticated_client.yml +5 -5
- data/spec/fixtures/aylien_text_api/client/summarize_with_valid_url.yml +7 -7
- data/spec/fixtures/aylien_text_api/client/summarize_with_value_as_text_and_title.yml +7 -7
- data/spec/fixtures/aylien_text_api/client/summarize_with_value_as_text_and_without_title.yml +18 -10
- data/spec/fixtures/aylien_text_api/client/summarize_with_value_as_valid_url.yml +7 -7
- 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 +7 -7
- data/spec/fixtures/aylien_text_api/client/unsupervised_classify_with_text.yml +7 -7
- data/spec/fixtures/aylien_text_api/client/unsupervised_classify_with_unauthenticated_client.yml +5 -5
- data/spec/fixtures/aylien_text_api/client/unsupervised_classify_with_valid_url.yml +7 -7
- data/spec/fixtures/aylien_text_api/client/unsupervised_classify_with_value_as_text.yml +7 -7
- data/spec/fixtures/aylien_text_api/client/unsupervised_classify_with_value_as_valid_url.yml +7 -7
- data/spec/lib/aylien_text_api/client_spec.rb +1 -0
- data/spec/lib/aylien_text_api/combined.rb +88 -0
- metadata +25 -9
data/spec/fixtures/aylien_text_api/client/summarize_with_value_as_text_and_without_title.yml
CHANGED
@@ -12,12 +12,12 @@ 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.3.0
|
16
16
|
Content-Type:
|
17
17
|
- application/x-www-form-urlencoded
|
18
|
-
|
18
|
+
X-Aylien-Textapi-Application-Id:
|
19
19
|
- "<PASSWORD>"
|
20
|
-
|
20
|
+
X-Aylien-Textapi-Application-Key:
|
21
21
|
- "<PASSWORD>"
|
22
22
|
response:
|
23
23
|
status:
|
@@ -27,23 +27,31 @@ http_interactions:
|
|
27
27
|
Server:
|
28
28
|
- openresty/1.7.7.2
|
29
29
|
Date:
|
30
|
-
-
|
30
|
+
- Thu, 06 Aug 2015 16:59:55 GMT
|
31
31
|
Content-Type:
|
32
32
|
- application/json;charset=UTF-8
|
33
33
|
Content-Length:
|
34
|
-
- '
|
34
|
+
- '292'
|
35
35
|
Connection:
|
36
36
|
- keep-alive
|
37
37
|
X-Ratelimit-Limit:
|
38
38
|
- '207000'
|
39
39
|
X-Ratelimit-Remaining:
|
40
|
-
- '
|
40
|
+
- '206069'
|
41
41
|
X-Ratelimit-Reset:
|
42
|
-
- '
|
42
|
+
- '1438905600'
|
43
43
|
body:
|
44
44
|
encoding: UTF-8
|
45
|
-
string:
|
46
|
-
|
45
|
+
string: |-
|
46
|
+
{
|
47
|
+
"error": "requirement failed: if you are not providing an url, both text and title are required.",
|
48
|
+
"errors": [{
|
49
|
+
"reason": "required",
|
50
|
+
"message": "if you are not providing an url, both text and title are required.",
|
51
|
+
"locationType": "parameter",
|
52
|
+
"location": "title"
|
53
|
+
}]
|
54
|
+
}
|
47
55
|
http_version:
|
48
|
-
recorded_at:
|
56
|
+
recorded_at: Thu, 06 Aug 2015 16:59:55 GMT
|
49
57
|
recorded_with: VCR 2.9.3
|
@@ -12,12 +12,12 @@ 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.3.0
|
16
16
|
Content-Type:
|
17
17
|
- application/x-www-form-urlencoded
|
18
|
-
|
18
|
+
X-Aylien-Textapi-Application-Id:
|
19
19
|
- "<PASSWORD>"
|
20
|
-
|
20
|
+
X-Aylien-Textapi-Application-Key:
|
21
21
|
- "<PASSWORD>"
|
22
22
|
response:
|
23
23
|
status:
|
@@ -27,7 +27,7 @@ http_interactions:
|
|
27
27
|
Server:
|
28
28
|
- openresty/1.7.7.2
|
29
29
|
Date:
|
30
|
-
-
|
30
|
+
- Thu, 06 Aug 2015 17:00:03 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
|
+
- '206068'
|
41
41
|
X-Ratelimit-Reset:
|
42
|
-
- '
|
42
|
+
- '1438905600'
|
43
43
|
body:
|
44
44
|
encoding: ASCII-8BIT
|
45
45
|
string: !binary |-
|
@@ -88,5 +88,5 @@ http_interactions:
|
|
88
88
|
bGwgd2VsbCwgaGUgaXMgYSBnb29kIGZpbmlzaGVyLCBoZSBjYW4gcHJlc3Mg
|
89
89
|
YW5kIHJlY292ZXIgdGhlIGJhbGwuIl0KfQ==
|
90
90
|
http_version:
|
91
|
-
recorded_at:
|
91
|
+
recorded_at: Thu, 06 Aug 2015 17:00:03 GMT
|
92
92
|
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.3.0
|
16
16
|
Content-Type:
|
17
17
|
- application/x-www-form-urlencoded
|
18
18
|
response:
|
@@ -23,7 +23,7 @@ http_interactions:
|
|
23
23
|
Server:
|
24
24
|
- openresty/1.7.7.2
|
25
25
|
Date:
|
26
|
-
-
|
26
|
+
- Thu, 06 Aug 2015 17:00:03 GMT
|
27
27
|
Content-Type:
|
28
28
|
- text/plain; charset=us-ascii
|
29
29
|
Transfer-Encoding:
|
@@ -34,5 +34,5 @@ http_interactions:
|
|
34
34
|
encoding: UTF-8
|
35
35
|
string: Authentication parameters missing
|
36
36
|
http_version:
|
37
|
-
recorded_at:
|
37
|
+
recorded_at: Thu, 06 Aug 2015 17:00:04 GMT
|
38
38
|
recorded_with: VCR 2.9.3
|
@@ -12,12 +12,12 @@ 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.3.0
|
16
16
|
Content-Type:
|
17
17
|
- application/x-www-form-urlencoded
|
18
|
-
|
18
|
+
X-Aylien-Textapi-Application-Id:
|
19
19
|
- "<PASSWORD>"
|
20
|
-
|
20
|
+
X-Aylien-Textapi-Application-Key:
|
21
21
|
- "<PASSWORD>"
|
22
22
|
response:
|
23
23
|
status:
|
@@ -27,7 +27,7 @@ http_interactions:
|
|
27
27
|
Server:
|
28
28
|
- openresty/1.7.7.2
|
29
29
|
Date:
|
30
|
-
-
|
30
|
+
- Thu, 06 Aug 2015 17:00: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
|
+
- '206065'
|
41
41
|
X-Ratelimit-Reset:
|
42
|
-
- '
|
42
|
+
- '1438905600'
|
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: Thu, 06 Aug 2015 17:00:10 GMT
|
57
57
|
recorded_with: VCR 2.9.3
|
@@ -12,12 +12,12 @@ 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.3.0
|
16
16
|
Content-Type:
|
17
17
|
- application/x-www-form-urlencoded
|
18
|
-
|
18
|
+
X-Aylien-Textapi-Application-Id:
|
19
19
|
- "<PASSWORD>"
|
20
|
-
|
20
|
+
X-Aylien-Textapi-Application-Key:
|
21
21
|
- "<PASSWORD>"
|
22
22
|
response:
|
23
23
|
status:
|
@@ -27,7 +27,7 @@ http_interactions:
|
|
27
27
|
Server:
|
28
28
|
- openresty/1.7.7.2
|
29
29
|
Date:
|
30
|
-
-
|
30
|
+
- Thu, 06 Aug 2015 17:00:12 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
|
+
- '206064'
|
41
41
|
X-Ratelimit-Reset:
|
42
|
-
- '
|
42
|
+
- '1438905600'
|
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:
|
52
|
+
recorded_at: Thu, 06 Aug 2015 17:00:12 GMT
|
53
53
|
recorded_with: VCR 2.9.3
|
data/spec/fixtures/aylien_text_api/client/unsupervised_classify_with_unauthenticated_client.yml
CHANGED
@@ -12,12 +12,12 @@ 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.3.0
|
16
16
|
Content-Type:
|
17
17
|
- application/x-www-form-urlencoded
|
18
|
-
|
18
|
+
X-Aylien-Textapi-Application-Id:
|
19
19
|
- random_string
|
20
|
-
|
20
|
+
X-Aylien-Textapi-Application-Key:
|
21
21
|
- random_string
|
22
22
|
response:
|
23
23
|
status:
|
@@ -27,7 +27,7 @@ http_interactions:
|
|
27
27
|
Server:
|
28
28
|
- openresty/1.7.7.2
|
29
29
|
Date:
|
30
|
-
-
|
30
|
+
- Thu, 06 Aug 2015 17:00: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:
|
41
|
+
recorded_at: Thu, 06 Aug 2015 17:00:10 GMT
|
42
42
|
recorded_with: VCR 2.9.3
|
@@ -12,12 +12,12 @@ 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.3.0
|
16
16
|
Content-Type:
|
17
17
|
- application/x-www-form-urlencoded
|
18
|
-
|
18
|
+
X-Aylien-Textapi-Application-Id:
|
19
19
|
- "<PASSWORD>"
|
20
|
-
|
20
|
+
X-Aylien-Textapi-Application-Key:
|
21
21
|
- "<PASSWORD>"
|
22
22
|
response:
|
23
23
|
status:
|
@@ -27,7 +27,7 @@ http_interactions:
|
|
27
27
|
Server:
|
28
28
|
- openresty/1.7.7.2
|
29
29
|
Date:
|
30
|
-
-
|
30
|
+
- Thu, 06 Aug 2015 17:00:09 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
|
+
- '206066'
|
41
41
|
X-Ratelimit-Reset:
|
42
|
-
- '
|
42
|
+
- '1438905600'
|
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: Thu, 06 Aug 2015 17:00:09 GMT
|
97
97
|
recorded_with: VCR 2.9.3
|
@@ -12,12 +12,12 @@ 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.3.0
|
16
16
|
Content-Type:
|
17
17
|
- application/x-www-form-urlencoded
|
18
|
-
|
18
|
+
X-Aylien-Textapi-Application-Id:
|
19
19
|
- "<PASSWORD>"
|
20
|
-
|
20
|
+
X-Aylien-Textapi-Application-Key:
|
21
21
|
- "<PASSWORD>"
|
22
22
|
response:
|
23
23
|
status:
|
@@ -27,7 +27,7 @@ http_interactions:
|
|
27
27
|
Server:
|
28
28
|
- openresty/1.7.7.2
|
29
29
|
Date:
|
30
|
-
-
|
30
|
+
- Thu, 06 Aug 2015 17:00:03 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
|
+
- '206067'
|
41
41
|
X-Ratelimit-Reset:
|
42
|
-
- '
|
42
|
+
- '1438905600'
|
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: Thu, 06 Aug 2015 17:00:03 GMT
|
57
57
|
recorded_with: VCR 2.9.3
|
@@ -12,12 +12,12 @@ 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.3.0
|
16
16
|
Content-Type:
|
17
17
|
- application/x-www-form-urlencoded
|
18
|
-
|
18
|
+
X-Aylien-Textapi-Application-Id:
|
19
19
|
- "<PASSWORD>"
|
20
|
-
|
20
|
+
X-Aylien-Textapi-Application-Key:
|
21
21
|
- "<PASSWORD>"
|
22
22
|
response:
|
23
23
|
status:
|
@@ -27,7 +27,7 @@ http_interactions:
|
|
27
27
|
Server:
|
28
28
|
- openresty/1.7.7.2
|
29
29
|
Date:
|
30
|
-
-
|
30
|
+
- Thu, 06 Aug 2015 17:00:16 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
|
+
- '206063'
|
41
41
|
X-Ratelimit-Reset:
|
42
|
-
- '
|
42
|
+
- '1438905600'
|
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: Thu, 06 Aug 2015 17:00:16 GMT
|
97
97
|
recorded_with: VCR 2.9.3
|
@@ -0,0 +1,88 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
describe "Combined 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
|
+
@endpoints = ['extract', 'concepts', 'entities', 'summarize',
|
13
|
+
'classify', 'hashtags', 'language']
|
14
|
+
end
|
15
|
+
|
16
|
+
it "shouldn't be nil with valid url" do
|
17
|
+
VCR.use_cassette('combined_with_valid_url') do
|
18
|
+
result = @client.combined(url: @url, endpoint: @endpoints)
|
19
|
+
result.wont_be_nil
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
it "shouldn't be nil with text" do
|
24
|
+
VCR.use_cassette('combined_with_text') do
|
25
|
+
result = @client.combined(text: @text, endpoint: @endpoints)
|
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('combined_with_value_as_valid_url') do
|
32
|
+
result = @client.combined(@url, endpoint: @endpoints)
|
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('combined_with_value_as_text') do
|
39
|
+
result = @client.combined(@text, endpoint: @endpoints)
|
40
|
+
result.wont_be_nil
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
it "should be nil with invalid params" do
|
45
|
+
VCR.use_cassette('combined_with_invalid_params') do
|
46
|
+
result = @client.combined(wrong_param: @text, endpoint: @endpoints)
|
47
|
+
result.must_be_nil
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
it "should be nil with unauthenticated client" do
|
52
|
+
VCR.use_cassette('combined_with_unauthenticated_client') do
|
53
|
+
result = @unauthenticated_client.combined(text: @text, endpoint: @endpoints)
|
54
|
+
result.must_be_nil
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
58
|
+
it "should raise Forbidden with unauthenticated client" do
|
59
|
+
VCR.use_cassette('combined_with_unauthenticated_client') do
|
60
|
+
proc {
|
61
|
+
@unauthenticated_client.combined!(text: @text, endpoint: @endpoints)
|
62
|
+
}.must_raise AylienTextApi::Error::Forbidden
|
63
|
+
end
|
64
|
+
end
|
65
|
+
|
66
|
+
it "should be nil with invalid client" do
|
67
|
+
VCR.use_cassette('combined_with_invalid_client') do
|
68
|
+
result = @invalid_client.combined(text: @text, endpoint: @endpoints)
|
69
|
+
result.must_be_nil
|
70
|
+
end
|
71
|
+
end
|
72
|
+
|
73
|
+
it "should raise Forbidden with invalid client" do
|
74
|
+
VCR.use_cassette('combined_with_invalid_client') do
|
75
|
+
proc {
|
76
|
+
@invalid_client.combined!(text: @text, endpoint: @endpoints)
|
77
|
+
}.must_raise AylienTextApi::Error::Forbidden
|
78
|
+
end
|
79
|
+
end
|
80
|
+
|
81
|
+
it "should raise BadRequest with invalid params" do
|
82
|
+
VCR.use_cassette('combined_with_invalid_params') do
|
83
|
+
proc {
|
84
|
+
@client.combined!(wrong_param: @text, endpoint: @endpoints)
|
85
|
+
}.must_raise AylienTextApi::Error::BadRequest
|
86
|
+
end
|
87
|
+
end
|
88
|
+
end
|