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.
Files changed (107) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile.lock +1 -1
  3. data/lib/aylien_text_api/client.rb +71 -30
  4. data/lib/aylien_text_api/connection.rb +7 -0
  5. data/lib/aylien_text_api/version.rb +1 -1
  6. data/spec/fixtures/aylien_text_api/client/classify_by_taxonomy_with_invalid_client.yml +3 -3
  7. data/spec/fixtures/aylien_text_api/client/classify_by_taxonomy_with_invalid_params.yml +5 -5
  8. data/spec/fixtures/aylien_text_api/client/classify_by_taxonomy_with_invalid_taxonomy.yml +5 -5
  9. data/spec/fixtures/aylien_text_api/client/classify_by_taxonomy_with_text.yml +5 -5
  10. data/spec/fixtures/aylien_text_api/client/classify_by_taxonomy_with_unauthenticated_client.yml +3 -3
  11. data/spec/fixtures/aylien_text_api/client/classify_by_taxonomy_with_valid_url.yml +5 -5
  12. data/spec/fixtures/aylien_text_api/client/classify_by_taxonomy_with_value_as_text.yml +5 -5
  13. data/spec/fixtures/aylien_text_api/client/classify_by_taxonomy_with_value_as_valid_url.yml +5 -5
  14. data/spec/fixtures/aylien_text_api/client/classify_with_invalid_client.yml +3 -3
  15. data/spec/fixtures/aylien_text_api/client/classify_with_invalid_params.yml +6 -6
  16. data/spec/fixtures/aylien_text_api/client/classify_with_text.yml +5 -5
  17. data/spec/fixtures/aylien_text_api/client/classify_with_unauthenticated_client.yml +3 -3
  18. data/spec/fixtures/aylien_text_api/client/classify_with_valid_url.yml +5 -5
  19. data/spec/fixtures/aylien_text_api/client/classify_with_value_as_text.yml +5 -5
  20. data/spec/fixtures/aylien_text_api/client/classify_with_value_as_valid_url.yml +5 -5
  21. data/spec/fixtures/aylien_text_api/client/combined_with_invalid_client.yml +3 -3
  22. data/spec/fixtures/aylien_text_api/client/combined_with_invalid_params.yml +5 -5
  23. data/spec/fixtures/aylien_text_api/client/combined_with_text.yml +6 -6
  24. data/spec/fixtures/aylien_text_api/client/combined_with_unauthenticated_client.yml +3 -3
  25. data/spec/fixtures/aylien_text_api/client/combined_with_valid_url.yml +6 -6
  26. data/spec/fixtures/aylien_text_api/client/combined_with_value_as_text.yml +6 -6
  27. data/spec/fixtures/aylien_text_api/client/combined_with_value_as_valid_url.yml +77 -77
  28. data/spec/fixtures/aylien_text_api/client/concepts_with_invalid_client.yml +3 -3
  29. data/spec/fixtures/aylien_text_api/client/concepts_with_invalid_params.yml +5 -5
  30. data/spec/fixtures/aylien_text_api/client/concepts_with_text.yml +5 -5
  31. data/spec/fixtures/aylien_text_api/client/concepts_with_unauthenticated_client.yml +3 -3
  32. data/spec/fixtures/aylien_text_api/client/concepts_with_valid_url.yml +5 -5
  33. data/spec/fixtures/aylien_text_api/client/concepts_with_value_as_text.yml +5 -5
  34. data/spec/fixtures/aylien_text_api/client/concepts_with_value_as_valid_url.yml +5 -5
  35. data/spec/fixtures/aylien_text_api/client/entities_with_invalid_client.yml +3 -3
  36. data/spec/fixtures/aylien_text_api/client/entities_with_invalid_params.yml +5 -5
  37. data/spec/fixtures/aylien_text_api/client/entities_with_text.yml +5 -5
  38. data/spec/fixtures/aylien_text_api/client/entities_with_unauthenticated_client.yml +3 -3
  39. data/spec/fixtures/aylien_text_api/client/entities_with_valid_url.yml +5 -5
  40. data/spec/fixtures/aylien_text_api/client/entities_with_value_as_text.yml +5 -5
  41. data/spec/fixtures/aylien_text_api/client/entities_with_value_as_valid_url.yml +5 -5
  42. data/spec/fixtures/aylien_text_api/client/extract_with_invalid_client.yml +3 -3
  43. data/spec/fixtures/aylien_text_api/client/extract_with_invalid_params.yml +6 -6
  44. data/spec/fixtures/aylien_text_api/client/extract_with_unauthenticated_client.yml +3 -3
  45. data/spec/fixtures/aylien_text_api/client/extract_with_valid_url.yml +5 -5
  46. data/spec/fixtures/aylien_text_api/client/extract_with_value_as_text.yml +5 -5
  47. data/spec/fixtures/aylien_text_api/client/extract_with_value_as_valid_url.yml +5 -5
  48. data/spec/fixtures/aylien_text_api/client/hashtags_with_invalid_client.yml +3 -3
  49. data/spec/fixtures/aylien_text_api/client/hashtags_with_invalid_params.yml +5 -5
  50. data/spec/fixtures/aylien_text_api/client/hashtags_with_text.yml +5 -5
  51. data/spec/fixtures/aylien_text_api/client/hashtags_with_unauthenticated_client.yml +3 -3
  52. data/spec/fixtures/aylien_text_api/client/hashtags_with_valid_url.yml +5 -5
  53. data/spec/fixtures/aylien_text_api/client/hashtags_with_value_as_text.yml +5 -5
  54. data/spec/fixtures/aylien_text_api/client/hashtags_with_value_as_valid_url.yml +5 -5
  55. data/spec/fixtures/aylien_text_api/client/image_tags_with_invalid_client.yml +3 -3
  56. data/spec/fixtures/aylien_text_api/client/image_tags_with_invalid_params.yml +6 -6
  57. data/spec/fixtures/aylien_text_api/client/image_tags_with_unauthenticated_client.yml +3 -3
  58. data/spec/fixtures/aylien_text_api/client/image_tags_with_valid_url.yml +8 -8
  59. data/spec/fixtures/aylien_text_api/client/image_tags_with_value_as_text.yml +5 -5
  60. data/spec/fixtures/aylien_text_api/client/image_tags_with_value_as_valid_url.yml +8 -8
  61. data/spec/fixtures/aylien_text_api/client/language_with_invalid_client.yml +3 -3
  62. data/spec/fixtures/aylien_text_api/client/language_with_invalid_params.yml +5 -5
  63. data/spec/fixtures/aylien_text_api/client/language_with_unauthenticated_client.yml +3 -3
  64. data/spec/fixtures/aylien_text_api/client/language_with_valid_text.yml +6 -6
  65. data/spec/fixtures/aylien_text_api/client/language_with_valid_url.yml +6 -6
  66. data/spec/fixtures/aylien_text_api/client/language_with_value_as_text.yml +6 -6
  67. data/spec/fixtures/aylien_text_api/client/language_with_value_as_valid_url.yml +6 -6
  68. data/spec/fixtures/aylien_text_api/client/microformats_with_invalid_client.yml +3 -3
  69. data/spec/fixtures/aylien_text_api/client/microformats_with_invalid_params.yml +5 -5
  70. data/spec/fixtures/aylien_text_api/client/microformats_with_unauthenticated_client.yml +3 -3
  71. data/spec/fixtures/aylien_text_api/client/microformats_with_valid_url.yml +6 -6
  72. data/spec/fixtures/aylien_text_api/client/microformats_with_value_as_valid_url.yml +6 -6
  73. data/spec/fixtures/aylien_text_api/client/rate_limits.yml +53 -0
  74. data/spec/fixtures/aylien_text_api/client/rate_limits_with_invalid_client.yml +38 -0
  75. data/spec/fixtures/aylien_text_api/client/rate_limits_with_unauthenticated_client.yml +42 -0
  76. data/spec/fixtures/aylien_text_api/client/related_with_invalid_client.yml +3 -3
  77. data/spec/fixtures/aylien_text_api/client/related_with_invalid_params.yml +5 -5
  78. data/spec/fixtures/aylien_text_api/client/related_with_phrase.yml +5 -5
  79. data/spec/fixtures/aylien_text_api/client/related_with_unauthenticated_client.yml +3 -3
  80. data/spec/fixtures/aylien_text_api/client/related_with_value_as_phrase.yml +5 -5
  81. data/spec/fixtures/aylien_text_api/client/related_with_value_as_valid_url.yml +5 -5
  82. data/spec/fixtures/aylien_text_api/client/sentiment_with_invalid_client.yml +3 -3
  83. data/spec/fixtures/aylien_text_api/client/sentiment_with_invalid_params.yml +5 -5
  84. data/spec/fixtures/aylien_text_api/client/sentiment_with_text.yml +7 -7
  85. data/spec/fixtures/aylien_text_api/client/sentiment_with_unauthenticated_client.yml +3 -3
  86. data/spec/fixtures/aylien_text_api/client/sentiment_with_valid_url.yml +6 -6
  87. data/spec/fixtures/aylien_text_api/client/sentiment_with_value_as_text.yml +7 -7
  88. data/spec/fixtures/aylien_text_api/client/sentiment_with_value_as_valid_url.yml +6 -6
  89. data/spec/fixtures/aylien_text_api/client/summarize_with_invalid_client.yml +3 -3
  90. data/spec/fixtures/aylien_text_api/client/summarize_with_invalid_params.yml +5 -5
  91. data/spec/fixtures/aylien_text_api/client/summarize_with_title_and_text.yml +5 -5
  92. data/spec/fixtures/aylien_text_api/client/summarize_with_unauthenticated_client.yml +3 -3
  93. data/spec/fixtures/aylien_text_api/client/summarize_with_valid_url.yml +5 -5
  94. data/spec/fixtures/aylien_text_api/client/summarize_with_value_as_text_and_title.yml +5 -5
  95. data/spec/fixtures/aylien_text_api/client/summarize_with_value_as_text_and_without_title.yml +5 -5
  96. data/spec/fixtures/aylien_text_api/client/summarize_with_value_as_valid_url.yml +5 -5
  97. data/spec/fixtures/aylien_text_api/client/unsupervised_classify_with_invalid_client.yml +3 -3
  98. data/spec/fixtures/aylien_text_api/client/unsupervised_classify_with_invalid_params.yml +5 -5
  99. data/spec/fixtures/aylien_text_api/client/unsupervised_classify_with_text.yml +5 -5
  100. data/spec/fixtures/aylien_text_api/client/unsupervised_classify_with_unauthenticated_client.yml +3 -3
  101. data/spec/fixtures/aylien_text_api/client/unsupervised_classify_with_valid_url.yml +5 -5
  102. data/spec/fixtures/aylien_text_api/client/unsupervised_classify_with_value_as_text.yml +5 -5
  103. data/spec/fixtures/aylien_text_api/client/unsupervised_classify_with_value_as_valid_url.yml +5 -5
  104. data/spec/lib/aylien_text_api/classify.rb +1 -1
  105. data/spec/lib/aylien_text_api/client_spec.rb +1 -0
  106. data/spec/lib/aylien_text_api/rate_limits.rb +26 -0
  107. metadata +11 -3
@@ -25,9 +25,9 @@ http_interactions:
25
25
  message: OK
26
26
  headers:
27
27
  Server:
28
- - openresty/1.7.7.2
28
+ - openresty/1.9.3.2
29
29
  Date:
30
- - Thu, 17 Sep 2015 11:21:14 GMT
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
- - '206273'
40
+ - '206388'
41
41
  X-Ratelimit-Reset:
42
- - '1442534400'
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: Thu, 17 Sep 2015 11:21:14 GMT
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.7.7.2
28
+ - openresty/1.9.3.2
29
29
  Date:
30
- - Thu, 17 Sep 2015 11:21:08 GMT
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
- - '206275'
40
+ - '206387'
41
41
  X-Ratelimit-Reset:
42
- - '1442534400'
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: Thu, 17 Sep 2015 11:21:08 GMT
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.7.7.2
28
+ - openresty/1.9.3.2
29
29
  Date:
30
- - Thu, 17 Sep 2015 11:21:18 GMT
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
- - '206272'
40
+ - '206383'
41
41
  X-Ratelimit-Reset:
42
- - '1442534400'
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: Thu, 17 Sep 2015 11:21:18 GMT
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
- @client.classify!(wrong_param: @text)
82
+ @invalid_client.classify!(wrong_param: @text)
83
83
  }.must_raise AylienTextApi::Error::BadRequest
84
84
  end
85
85
  end
@@ -33,4 +33,5 @@ describe AylienTextApi::Client do
33
33
  require_relative './combined'
34
34
  require_relative './image_tags'
35
35
  require_relative './classify_by_taxonomy'
36
+ require_relative './rate_limits'
36
37
  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.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: 2015-09-17 00:00:00.000000000 Z
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.4.8
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