meaning-cloud 0.1.4 → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +3 -3
- data/lib/meaning-cloud.rb +6 -2
- data/lib/meaning_cloud/topics.rb +2 -2
- data/spec/lib/meaning_cloud/topics_spec.rb +11 -3
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f4c7cd1a57ecabd34a3e663ef5b04e5fac50ba2b
|
4
|
+
data.tar.gz: ede56dd441254fd25815263be23da0583c83fe6f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e2337cda47725d6706c41cea78b2480cd3a86214dc4b096cb68477a9453c38dd300fa64fb47671a20e3cb191511e95123c9bc427c9661998e7cf916dee65cfea
|
7
|
+
data.tar.gz: a3fbc867fe633fffc73e2b81d9b6ee94468e8819ba28d6941f29c0ead339566ba7d10d597e9106d42116fe91fbdd6dafa2a1074e2cae452eddae5afa31010780
|
data/README.md
CHANGED
@@ -4,10 +4,10 @@ The Meaning Cloud Ruby API Wrapper
|
|
4
4
|
A Ruby API wrapper for [Meaning Cloud](https://www.meaningcloud.com/) [API's](https://www.meaningcloud.com/developer/getting-started)
|
5
5
|
|
6
6
|
[](http://badge.fury.io/rb/meaning-cloud)[](https://gemnasium.com/TailorBrands/meaning-cloud)
|
7
|
-
[](https://travis-ci.org/TailorBrands/meaning-cloud) [](https://codeclimate.com/github/TailorBrands/meaning-cloud) [](https://codeclimate.com/github/TailorBrands/meaning-cloud)
|
8
8
|
|
9
9
|
```rb
|
10
|
-
gem "meaning-cloud", "~> 0.
|
10
|
+
gem "meaning-cloud", "~> 1.0.0"
|
11
11
|
```
|
12
12
|
|
13
13
|
## Missing
|
@@ -34,7 +34,7 @@ end
|
|
34
34
|
```rb
|
35
35
|
result = MeaningCloud::Topics.extract_topics(txt: 'The most amazing text in the world') # Returns a hash of the parsed JSON result.
|
36
36
|
```
|
37
|
-
Source [source](https://www.meaningcloud.com/developer/topics-extraction/doc/
|
37
|
+
Source [source](https://www.meaningcloud.com/developer/topics-extraction/doc/2.0/examples)
|
38
38
|
|
39
39
|
## Disclaimer
|
40
40
|
|
data/lib/meaning-cloud.rb
CHANGED
@@ -4,7 +4,7 @@ require 'meaning_cloud/topics'
|
|
4
4
|
|
5
5
|
# Top level name space for the entire Gem.
|
6
6
|
module MeaningCloud
|
7
|
-
API_BASE =
|
7
|
+
API_BASE = "https://api.meaningcloud.com/topics-2.0"
|
8
8
|
|
9
9
|
def self.configuration
|
10
10
|
@configuration ||= Configuration.new
|
@@ -17,10 +17,14 @@ module MeaningCloud
|
|
17
17
|
|
18
18
|
# Main configuration class.
|
19
19
|
class Configuration
|
20
|
-
attr_accessor :key
|
20
|
+
attr_accessor :key,
|
21
|
+
:language,
|
22
|
+
:topic_types
|
21
23
|
|
22
24
|
def initialize
|
23
25
|
@key = nil
|
26
|
+
@language = :en
|
27
|
+
@topic_types = "ec"
|
24
28
|
end
|
25
29
|
end
|
26
30
|
end
|
data/lib/meaning_cloud/topics.rb
CHANGED
@@ -5,12 +5,20 @@ RSpec.describe MeaningCloud::Topics do
|
|
5
5
|
MeaningCloud.configuration.key = nil
|
6
6
|
end
|
7
7
|
|
8
|
-
it
|
8
|
+
it "has a default topic types configuration" do
|
9
|
+
expect(MeaningCloud.configuration.topic_types).not_to be_nil
|
10
|
+
end
|
11
|
+
|
12
|
+
it "has a default language configuration" do
|
13
|
+
expect(MeaningCloud.configuration.language).not_to be_nil
|
14
|
+
end
|
15
|
+
|
16
|
+
it "raises an error on empty key" do
|
9
17
|
MeaningCloud.configuration.key = nil
|
10
18
|
expect { MeaningCloud::Topics.extract_topics(txt: Faker::Company.bs) }.to raise_error(Exception)
|
11
19
|
end
|
12
20
|
|
13
|
-
it
|
21
|
+
it "sends a proper request" do
|
14
22
|
result = "{\"status\":{\"code\":\"0\",\"msg\":\"OK\",\"credits\":\"1\",\"remaining_credits\":\"39993\"},\"entity_list\":[],\"concept_list\":[]}"
|
15
23
|
key = SecureRandom.uuid
|
16
24
|
MeaningCloud.configuration.key = key
|
@@ -20,7 +28,7 @@ RSpec.describe MeaningCloud::Topics do
|
|
20
28
|
expect(RestClient).to receive(
|
21
29
|
:post
|
22
30
|
).with(
|
23
|
-
"https://api.meaningcloud.com/topics-
|
31
|
+
"https://api.meaningcloud.com/topics-2.0?of=json&key=#{key}&lang=en&tt=ec&uw=y&txt=#{txt.gsub(' ', '+')}", {}
|
24
32
|
).and_return(
|
25
33
|
result
|
26
34
|
)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: meaning-cloud
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 1.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nadav Shatz
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-12-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rest-client
|
@@ -120,7 +120,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
120
120
|
version: '0'
|
121
121
|
requirements: []
|
122
122
|
rubyforge_project:
|
123
|
-
rubygems_version: 2.4.5
|
123
|
+
rubygems_version: 2.4.5.1
|
124
124
|
signing_key:
|
125
125
|
specification_version: 4
|
126
126
|
summary: An API wrapper for Meaning Cloud API's
|