aylien_text_api 0.7.0 → 0.8.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (35) hide show
  1. checksums.yaml +5 -5
  2. data/.gitignore +3 -0
  3. data/README.md +12 -10
  4. data/aylien_text_api.gemspec +3 -3
  5. data/lib/aylien_text_api/client.rb +30 -93
  6. data/lib/aylien_text_api/configuration.rb +2 -4
  7. data/lib/aylien_text_api/version.rb +1 -1
  8. data/spec/fixtures/aylien_text_api/client/{microformats_with_invalid_client.yml → elsa_with_invalid_client.yml} +10 -8
  9. data/spec/fixtures/aylien_text_api/client/{related_with_invalid_params.yml → elsa_with_invalid_params.yml} +15 -24
  10. data/spec/fixtures/aylien_text_api/client/elsa_with_text.yml +98 -0
  11. data/spec/fixtures/aylien_text_api/client/{related_with_unauthenticated_client.yml → elsa_with_unauthenticated_client.yml} +10 -8
  12. data/spec/fixtures/aylien_text_api/client/elsa_with_valid_url.yml +47 -0
  13. data/spec/fixtures/aylien_text_api/client/elsa_with_value_as_text.yml +92 -0
  14. data/spec/fixtures/aylien_text_api/client/elsa_with_value_as_valid_url.yml +53 -0
  15. data/spec/lib/aylien_text_api/client_spec.rb +1 -3
  16. data/spec/lib/aylien_text_api/elsa.rb +81 -0
  17. metadata +14 -152
  18. data/spec/fixtures/aylien_text_api/client/microformats_with_invalid_params.yml +0 -62
  19. data/spec/fixtures/aylien_text_api/client/microformats_with_unauthenticated_client.yml +0 -42
  20. data/spec/fixtures/aylien_text_api/client/microformats_with_valid_url.yml +0 -84
  21. data/spec/fixtures/aylien_text_api/client/microformats_with_value_as_valid_url.yml +0 -84
  22. data/spec/fixtures/aylien_text_api/client/related_with_invalid_client.yml +0 -38
  23. data/spec/fixtures/aylien_text_api/client/related_with_phrase.yml +0 -112
  24. data/spec/fixtures/aylien_text_api/client/related_with_value_as_phrase.yml +0 -112
  25. data/spec/fixtures/aylien_text_api/client/related_with_value_as_valid_url.yml +0 -62
  26. data/spec/fixtures/aylien_text_api/client/unsupervised_classify_with_invalid_client.yml +0 -38
  27. data/spec/fixtures/aylien_text_api/client/unsupervised_classify_with_invalid_params.yml +0 -57
  28. data/spec/fixtures/aylien_text_api/client/unsupervised_classify_with_text.yml +0 -53
  29. data/spec/fixtures/aylien_text_api/client/unsupervised_classify_with_unauthenticated_client.yml +0 -42
  30. data/spec/fixtures/aylien_text_api/client/unsupervised_classify_with_valid_url.yml +0 -97
  31. data/spec/fixtures/aylien_text_api/client/unsupervised_classify_with_value_as_text.yml +0 -57
  32. data/spec/fixtures/aylien_text_api/client/unsupervised_classify_with_value_as_valid_url.yml +0 -97
  33. data/spec/lib/aylien_text_api/microformats.rb +0 -66
  34. data/spec/lib/aylien_text_api/related.rb +0 -80
  35. data/spec/lib/aylien_text_api/unsupervised_classify.rb +0 -87
@@ -1,62 +0,0 @@
1
- ---
2
- http_interactions:
3
- - request:
4
- method: post
5
- uri: https://api.aylien.com/api/v1/microformats
6
- body:
7
- encoding: US-ASCII
8
- string: wrong_param=http%3A%2F%2Fcodepen.io%2Fanon%2Fpen%2FZYaKbz.html
9
- headers:
10
- Accept-Encoding:
11
- - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
12
- Accept:
13
- - "*/*"
14
- User-Agent:
15
- - Aylien Text API Ruby Gem 0.6.0
16
- Content-Type:
17
- - application/x-www-form-urlencoded
18
- X-Aylien-Textapi-Application-Id:
19
- - "<PASSWORD>"
20
- X-Aylien-Textapi-Application-Key:
21
- - "<PASSWORD>"
22
- response:
23
- status:
24
- code: 400
25
- message: Bad Request
26
- headers:
27
- Server:
28
- - openresty/1.9.3.2
29
- Date:
30
- - Thu, 28 Apr 2016 10:36:04 GMT
31
- Content-Type:
32
- - application/json;charset=UTF-8
33
- Content-Length:
34
- - '345'
35
- Connection:
36
- - keep-alive
37
- X-Ratelimit-Limit:
38
- - '207000'
39
- X-Ratelimit-Remaining:
40
- - '174160'
41
- X-Ratelimit-Reset:
42
- - '1461888000'
43
- body:
44
- encoding: UTF-8
45
- string: |-
46
- {
47
- "error": "requirement failed: Form field 'url' Required",
48
- "errors": [{
49
- "reason": "required",
50
- "message": "Form field 'url' Required",
51
- "locationType": "parameter",
52
- "location": "url"
53
- }, {
54
- "reason": "required",
55
- "message": "Query parameter 'url' Required",
56
- "locationType": "parameter",
57
- "location": "url"
58
- }]
59
- }
60
- http_version:
61
- recorded_at: Thu, 28 Apr 2016 10:36:04 GMT
62
- recorded_with: VCR 2.9.3
@@ -1,42 +0,0 @@
1
- ---
2
- http_interactions:
3
- - request:
4
- method: post
5
- uri: https://api.aylien.com/api/v1/microformats
6
- body:
7
- encoding: US-ASCII
8
- string: url=http%3A%2F%2Fcodepen.io%2Fanon%2Fpen%2FZYaKbz.html
9
- headers:
10
- Accept-Encoding:
11
- - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
12
- Accept:
13
- - "*/*"
14
- User-Agent:
15
- - Aylien Text API Ruby Gem 0.6.0
16
- Content-Type:
17
- - application/x-www-form-urlencoded
18
- X-Aylien-Textapi-Application-Id:
19
- - random_string
20
- X-Aylien-Textapi-Application-Key:
21
- - random_string
22
- response:
23
- status:
24
- code: 403
25
- message: Forbidden
26
- headers:
27
- Server:
28
- - openresty/1.9.3.2
29
- Date:
30
- - Thu, 28 Apr 2016 10:36:08 GMT
31
- Content-Type:
32
- - text/plain; charset=us-ascii
33
- Transfer-Encoding:
34
- - chunked
35
- Connection:
36
- - keep-alive
37
- body:
38
- encoding: UTF-8
39
- string: Authentication failed
40
- http_version:
41
- recorded_at: Thu, 28 Apr 2016 10:36:08 GMT
42
- recorded_with: VCR 2.9.3
@@ -1,84 +0,0 @@
1
- ---
2
- http_interactions:
3
- - request:
4
- method: post
5
- uri: https://api.aylien.com/api/v1/microformats
6
- body:
7
- encoding: US-ASCII
8
- string: url=http%3A%2F%2Fcodepen.io%2Fanon%2Fpen%2FZYaKbz.html
9
- headers:
10
- Accept-Encoding:
11
- - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
12
- Accept:
13
- - "*/*"
14
- User-Agent:
15
- - Aylien Text API Ruby Gem 0.6.0
16
- Content-Type:
17
- - application/x-www-form-urlencoded
18
- X-Aylien-Textapi-Application-Id:
19
- - "<PASSWORD>"
20
- X-Aylien-Textapi-Application-Key:
21
- - "<PASSWORD>"
22
- response:
23
- status:
24
- code: 200
25
- message: OK
26
- headers:
27
- Server:
28
- - openresty/1.9.3.2
29
- Date:
30
- - Thu, 28 Apr 2016 10:36:06 GMT
31
- Content-Type:
32
- - application/json;charset=UTF-8
33
- Content-Length:
34
- - '1105'
35
- Connection:
36
- - keep-alive
37
- X-Ratelimit-Limit:
38
- - '207000'
39
- X-Ratelimit-Remaining:
40
- - '174159'
41
- X-Ratelimit-Reset:
42
- - '1461888000'
43
- body:
44
- encoding: UTF-8
45
- string: |-
46
- {
47
- "hCards": [{
48
- "birthday": "1951-05-26",
49
- "organization": "Sally Ride Science",
50
- "telephoneNumber": "+1.818.555.1212",
51
- "location": {
52
- "id": "9f15e27ff48eb28c57f49fb177a1ed0af78f93ab",
53
- "latitude": "37.386013",
54
- "longitude": "-122.082932"
55
- },
56
- "photo": "http://example.com/sk.jpg",
57
- "email": "sally@example.com",
58
- "url": "http://flickr.com/people/tantek/",
59
- "fullName": "Sally Ride",
60
- "structuredName": {
61
- "familyName": "van der Harten",
62
- "givenName": "Sally",
63
- "honorificSuffix": "Ph.D.",
64
- "id": "5cf453849c3bfddae9195ff531ec1505dd902add",
65
- "additionalName": "K.",
66
- "honorificPrefix": "Dr."
67
- },
68
- "logo": "http://www.abc.com/pub/logos/abccorp.jpg",
69
- "id": "7d021199b0d826eef60cd31279037270e38715cd",
70
- "note": "1st American woman in space.",
71
- "address": {
72
- "streetAddress": "123 Main st.",
73
- "countryName": "U.S.A",
74
- "postalCode": "91316",
75
- "id": "00cc73c1f9773a66613b04f11ce57317eecf636b",
76
- "region": "California",
77
- "locality": "Los Angeles"
78
- },
79
- "category": "physicist"
80
- }]
81
- }
82
- http_version:
83
- recorded_at: Thu, 28 Apr 2016 10:36:06 GMT
84
- recorded_with: VCR 2.9.3
@@ -1,84 +0,0 @@
1
- ---
2
- http_interactions:
3
- - request:
4
- method: post
5
- uri: https://api.aylien.com/api/v1/microformats
6
- body:
7
- encoding: US-ASCII
8
- string: url=http%3A%2F%2Fcodepen.io%2Fanon%2Fpen%2FZYaKbz.html
9
- headers:
10
- Accept-Encoding:
11
- - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
12
- Accept:
13
- - "*/*"
14
- User-Agent:
15
- - Aylien Text API Ruby Gem 0.6.0
16
- Content-Type:
17
- - application/x-www-form-urlencoded
18
- X-Aylien-Textapi-Application-Id:
19
- - "<PASSWORD>"
20
- X-Aylien-Textapi-Application-Key:
21
- - "<PASSWORD>"
22
- response:
23
- status:
24
- code: 200
25
- message: OK
26
- headers:
27
- Server:
28
- - openresty/1.9.3.2
29
- Date:
30
- - Thu, 28 Apr 2016 10:36:07 GMT
31
- Content-Type:
32
- - application/json;charset=UTF-8
33
- Content-Length:
34
- - '1105'
35
- Connection:
36
- - keep-alive
37
- X-Ratelimit-Limit:
38
- - '207000'
39
- X-Ratelimit-Remaining:
40
- - '174158'
41
- X-Ratelimit-Reset:
42
- - '1461888000'
43
- body:
44
- encoding: UTF-8
45
- string: |-
46
- {
47
- "hCards": [{
48
- "birthday": "1951-05-26",
49
- "organization": "Sally Ride Science",
50
- "telephoneNumber": "+1.818.555.1212",
51
- "location": {
52
- "id": "9f15e27ff48eb28c57f49fb177a1ed0af78f93ab",
53
- "latitude": "37.386013",
54
- "longitude": "-122.082932"
55
- },
56
- "photo": "http://example.com/sk.jpg",
57
- "email": "sally@example.com",
58
- "url": "http://flickr.com/people/tantek/",
59
- "fullName": "Sally Ride",
60
- "structuredName": {
61
- "familyName": "van der Harten",
62
- "givenName": "Sally",
63
- "honorificSuffix": "Ph.D.",
64
- "id": "425eb5874a2913967fe1ea304e7d1899e41f43aa",
65
- "additionalName": "K.",
66
- "honorificPrefix": "Dr."
67
- },
68
- "logo": "http://www.abc.com/pub/logos/abccorp.jpg",
69
- "id": "7d021199b0d826eef60cd31279037270e38715cd",
70
- "note": "1st American woman in space.",
71
- "address": {
72
- "streetAddress": "123 Main st.",
73
- "countryName": "U.S.A",
74
- "postalCode": "91316",
75
- "id": "00cc73c1f9773a66613b04f11ce57317eecf636b",
76
- "region": "California",
77
- "locality": "Los Angeles"
78
- },
79
- "category": "physicist"
80
- }]
81
- }
82
- http_version:
83
- recorded_at: Thu, 28 Apr 2016 10:36:07 GMT
84
- recorded_with: VCR 2.9.3
@@ -1,38 +0,0 @@
1
- ---
2
- http_interactions:
3
- - request:
4
- method: post
5
- uri: https://api.aylien.com/api/v1/related
6
- body:
7
- encoding: US-ASCII
8
- string: phrase=android
9
- headers:
10
- Accept-Encoding:
11
- - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
12
- Accept:
13
- - "*/*"
14
- User-Agent:
15
- - Aylien Text API Ruby Gem 0.6.0
16
- Content-Type:
17
- - application/x-www-form-urlencoded
18
- response:
19
- status:
20
- code: 403
21
- message: Forbidden
22
- headers:
23
- Server:
24
- - openresty/1.9.3.2
25
- Date:
26
- - Thu, 28 Apr 2016 10:44:41 GMT
27
- Content-Type:
28
- - text/plain; charset=us-ascii
29
- Transfer-Encoding:
30
- - chunked
31
- Connection:
32
- - keep-alive
33
- body:
34
- encoding: UTF-8
35
- string: Authentication parameters missing
36
- http_version:
37
- recorded_at: Thu, 28 Apr 2016 10:44:41 GMT
38
- recorded_with: VCR 2.9.3
@@ -1,112 +0,0 @@
1
- ---
2
- http_interactions:
3
- - request:
4
- method: post
5
- uri: https://api.aylien.com/api/v1/related
6
- body:
7
- encoding: US-ASCII
8
- string: phrase=android
9
- headers:
10
- Accept-Encoding:
11
- - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
12
- Accept:
13
- - "*/*"
14
- User-Agent:
15
- - Aylien Text API Ruby Gem 0.6.0
16
- Content-Type:
17
- - application/x-www-form-urlencoded
18
- X-Aylien-Textapi-Application-Id:
19
- - "<PASSWORD>"
20
- X-Aylien-Textapi-Application-Key:
21
- - "<PASSWORD>"
22
- response:
23
- status:
24
- code: 200
25
- message: OK
26
- headers:
27
- Server:
28
- - openresty/1.9.3.2
29
- Date:
30
- - Thu, 28 Apr 2016 10:44:44 GMT
31
- Content-Type:
32
- - application/json;charset=UTF-8
33
- Content-Length:
34
- - '1470'
35
- Connection:
36
- - keep-alive
37
- X-Ratelimit-Limit:
38
- - '207000'
39
- X-Ratelimit-Remaining:
40
- - '173637'
41
- X-Ratelimit-Reset:
42
- - '1461888000'
43
- body:
44
- encoding: UTF-8
45
- string: |-
46
- {
47
- "phrase": "android",
48
- "related": [{
49
- "phrase": "android version",
50
- "distance": 0.3989213705062866
51
- }, {
52
- "phrase": "ios",
53
- "distance": 0.41522765159606934
54
- }, {
55
- "phrase": "android devices",
56
- "distance": 0.423676073551178
57
- }, {
58
- "phrase": "android lollipop",
59
- "distance": 0.4261924624443054
60
- }, {
61
- "phrase": "iphone",
62
- "distance": 0.42704862356185913
63
- }, {
64
- "phrase": "android os",
65
- "distance": 0.42750751972198486
66
- }, {
67
- "phrase": "froyo",
68
- "distance": 0.4317677617073059
69
- }, {
70
- "phrase": "smartphone",
71
- "distance": 0.4510107636451721
72
- }, {
73
- "phrase": "android platform",
74
- "distance": 0.45518678426742554
75
- }, {
76
- "phrase": "ios platforms",
77
- "distance": 0.45898914337158203
78
- }, {
79
- "phrase": "touchwiz ui",
80
- "distance": 0.4686887264251709
81
- }, {
82
- "phrase": "ios devices",
83
- "distance": 0.47086143493652344
84
- }, {
85
- "phrase": "ice cream sandwich",
86
- "distance": 0.4727413058280945
87
- }, {
88
- "phrase": "android device",
89
- "distance": 0.4732778072357178
90
- }, {
91
- "phrase": "apple ios",
92
- "distance": 0.47654372453689575
93
- }, {
94
- "phrase": "windows phone",
95
- "distance": 0.47724878787994385
96
- }, {
97
- "phrase": "ios version",
98
- "distance": 0.47820836305618286
99
- }, {
100
- "phrase": "app",
101
- "distance": 0.4802556037902832
102
- }, {
103
- "phrase": "custom roms",
104
- "distance": 0.4839458465576172
105
- }, {
106
- "phrase": "android apps",
107
- "distance": 0.4847920536994934
108
- }]
109
- }
110
- http_version:
111
- recorded_at: Thu, 28 Apr 2016 10:44:44 GMT
112
- recorded_with: VCR 2.9.3
@@ -1,112 +0,0 @@
1
- ---
2
- http_interactions:
3
- - request:
4
- method: post
5
- uri: https://api.aylien.com/api/v1/related
6
- body:
7
- encoding: US-ASCII
8
- string: phrase=android
9
- headers:
10
- Accept-Encoding:
11
- - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
12
- Accept:
13
- - "*/*"
14
- User-Agent:
15
- - Aylien Text API Ruby Gem 0.6.0
16
- Content-Type:
17
- - application/x-www-form-urlencoded
18
- X-Aylien-Textapi-Application-Id:
19
- - "<PASSWORD>"
20
- X-Aylien-Textapi-Application-Key:
21
- - "<PASSWORD>"
22
- response:
23
- status:
24
- code: 200
25
- message: OK
26
- headers:
27
- Server:
28
- - openresty/1.9.3.2
29
- Date:
30
- - Thu, 28 Apr 2016 10:44:45 GMT
31
- Content-Type:
32
- - application/json;charset=UTF-8
33
- Content-Length:
34
- - '1470'
35
- Connection:
36
- - keep-alive
37
- X-Ratelimit-Limit:
38
- - '207000'
39
- X-Ratelimit-Remaining:
40
- - '173636'
41
- X-Ratelimit-Reset:
42
- - '1461888000'
43
- body:
44
- encoding: UTF-8
45
- string: |-
46
- {
47
- "phrase": "android",
48
- "related": [{
49
- "phrase": "android version",
50
- "distance": 0.3989213705062866
51
- }, {
52
- "phrase": "ios",
53
- "distance": 0.41522765159606934
54
- }, {
55
- "phrase": "android devices",
56
- "distance": 0.423676073551178
57
- }, {
58
- "phrase": "android lollipop",
59
- "distance": 0.4261924624443054
60
- }, {
61
- "phrase": "iphone",
62
- "distance": 0.42704862356185913
63
- }, {
64
- "phrase": "android os",
65
- "distance": 0.42750751972198486
66
- }, {
67
- "phrase": "froyo",
68
- "distance": 0.4317677617073059
69
- }, {
70
- "phrase": "smartphone",
71
- "distance": 0.4510107636451721
72
- }, {
73
- "phrase": "android platform",
74
- "distance": 0.45518678426742554
75
- }, {
76
- "phrase": "ios platforms",
77
- "distance": 0.45898914337158203
78
- }, {
79
- "phrase": "touchwiz ui",
80
- "distance": 0.4686887264251709
81
- }, {
82
- "phrase": "ios devices",
83
- "distance": 0.47086143493652344
84
- }, {
85
- "phrase": "ice cream sandwich",
86
- "distance": 0.4727413058280945
87
- }, {
88
- "phrase": "android device",
89
- "distance": 0.4732778072357178
90
- }, {
91
- "phrase": "apple ios",
92
- "distance": 0.47654372453689575
93
- }, {
94
- "phrase": "windows phone",
95
- "distance": 0.47724878787994385
96
- }, {
97
- "phrase": "ios version",
98
- "distance": 0.47820836305618286
99
- }, {
100
- "phrase": "app",
101
- "distance": 0.4802556037902832
102
- }, {
103
- "phrase": "custom roms",
104
- "distance": 0.4839458465576172
105
- }, {
106
- "phrase": "android apps",
107
- "distance": 0.4847920536994934
108
- }]
109
- }
110
- http_version:
111
- recorded_at: Thu, 28 Apr 2016 10:44:45 GMT
112
- recorded_with: VCR 2.9.3