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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 6cadb7d38b3e6be6536b7a23f0cea841a48e7cb4
4
- data.tar.gz: b5b4d8a6c2a44fb98ba5f30498d51907b10084bc
3
+ metadata.gz: f4c7cd1a57ecabd34a3e663ef5b04e5fac50ba2b
4
+ data.tar.gz: ede56dd441254fd25815263be23da0583c83fe6f
5
5
  SHA512:
6
- metadata.gz: 6e4311e04125993df7c6ed545bc60f8a80b1decafb6cf502f4aacab3e0f3227c87fc28520d65194f53fcab14177b85b02d01653200e5b99482a8cd511e120621
7
- data.tar.gz: 0b4b11dd9567d5a467165995dda1492bcad4f84f156286e24ee1bdac58d50ebfc70357d9b459a58831a933c66c51ab6998af7e5beee837794482b37be1b8ffa0
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
  [![Gem Version](https://badge.fury.io/rb/meaning-cloud.svg)](http://badge.fury.io/rb/meaning-cloud)[![Dependency Status](https://gemnasium.com/TailorBrands/meaning-cloud.svg)](https://gemnasium.com/TailorBrands/meaning-cloud)
7
- [![Circle CI](https://circleci.com/gh/TailorBrands/meaning-cloud/tree/master.svg?style=svg)](https://circleci.com/gh/TailorBrands/meaning-cloud/tree/master) [![Code Climate](https://codeclimate.com/github/TailorBrands/meaning-cloud/badges/gpa.svg)](https://codeclimate.com/github/TailorBrands/meaning-cloud) [![Test Coverage](https://codeclimate.com/github/TailorBrands/meaning-cloud/badges/coverage.svg)](https://codeclimate.com/github/TailorBrands/meaning-cloud)
7
+ [![Build Status](https://travis-ci.org/TailorBrands/meaning-cloud.svg)](https://travis-ci.org/TailorBrands/meaning-cloud) [![Code Climate](https://codeclimate.com/github/TailorBrands/meaning-cloud/badges/gpa.svg)](https://codeclimate.com/github/TailorBrands/meaning-cloud) [![Test Coverage](https://codeclimate.com/github/TailorBrands/meaning-cloud/badges/coverage.svg)](https://codeclimate.com/github/TailorBrands/meaning-cloud)
8
8
 
9
9
  ```rb
10
- gem "meaning-cloud", "~> 0.1.3"
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/1.2/examples)
37
+ Source [source](https://www.meaningcloud.com/developer/topics-extraction/doc/2.0/examples)
38
38
 
39
39
  ## Disclaimer
40
40
 
@@ -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 = 'https://api.meaningcloud.com/topics-1.2.php'
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
@@ -9,8 +9,8 @@ module MeaningCloud
9
9
  options = {
10
10
  of: :json,
11
11
  key: MeaningCloud.configuration.key,
12
- lang: :en,
13
- tt: 'ec',
12
+ lang: MeaningCloud.configuration.language,
13
+ tt: MeaningCloud.configuration.topic_types,
14
14
  uw: 'y'
15
15
  }.merge(options)
16
16
 
@@ -5,12 +5,20 @@ RSpec.describe MeaningCloud::Topics do
5
5
  MeaningCloud.configuration.key = nil
6
6
  end
7
7
 
8
- it 'raises an error on empty key' do
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 'sends a proper request' do
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-1.2.php?of=json&key=#{key}&lang=en&tt=ec&uw=y&txt=#{txt.gsub(' ', '+')}", {}
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.1.4
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-06-03 00:00:00.000000000 Z
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