conclas 0.1.1 → 0.1.2

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: 7751fc99f5429f11198d9d8523ba0573c5c90deb
4
- data.tar.gz: 8a6aaa2290a3d95c9c06274d072a1720dde9ce12
3
+ metadata.gz: 009584ff7f819cad91e763d23bbb28519f43d133
4
+ data.tar.gz: 455b198f1d81051b3400bb59bacacab3967d0662
5
5
  SHA512:
6
- metadata.gz: 29e34752937802828779c34d7ff9ef650f40c817c8f19efef4bc44bafc8427ab152420d1640e831e36eb591024147b3f8f2c815412d318909d7beb789477bcf7
7
- data.tar.gz: 330251a347d13682e988e285cc974b84a3500e027110932a5302b865fb03ae35105f7c6376cb050a59408536c1d5c552fc6d3fb6054d55b624cfb002c1a8c6f4
6
+ metadata.gz: 619a58c78713868ae8bf37e86f6ab5019b92234b15a1d33d8187f3fde322c09af544b59cb514cc93cae9900b67aca68b0be5e5543a147e46a3220e694101c37f
7
+ data.tar.gz: 4e6afe5088a84ef3bc3f970cdcec43b4b44ee929aa01e0aea9927075e842481db6e342ab483948c85e9b0461f92b690929086e8c5b30f6a314af1bde30163ae0
data/conclas-0.1.1.gem ADDED
Binary file
data/lib/conclas/api.rb CHANGED
@@ -28,7 +28,6 @@ module ConClas
28
28
  @use_ssl = use_ssl
29
29
  @status_code = nil
30
30
  @headers = nil
31
- @response = nil
32
31
  @req = nil
33
32
  end
34
33
 
@@ -41,10 +40,6 @@ module ConClas
41
40
  @headers
42
41
  end
43
42
 
44
- def response
45
- @response
46
- end
47
-
48
43
  #private methods
49
44
  def make_request(url, data)
50
45
  headers = {"Content-Type" => "application/json",
@@ -76,7 +71,6 @@ module ConClas
76
71
  def populate_properties
77
72
  @status_code = @req.code
78
73
  @headers = @req.header.to_hash.inspect
79
- @response = JSON.parse(@req.body, :quirks_mode => true)
80
74
  end
81
75
 
82
76
  def check_api_args_method(contents, start_from_category=nil, callback=nil)
@@ -113,6 +107,7 @@ module ConClas
113
107
  json_body_request = Utils::JsonMaker.new(hashe_data).get_json
114
108
  url = BASE_URL + METHODS[:direct]
115
109
  make_request(url, json_body_request)
110
+ JSON.parse(@req.body, :quirks_mode => true)
116
111
  end
117
112
 
118
113
  def indirect_classify(contents, callback)
@@ -124,6 +119,7 @@ module ConClas
124
119
  json_body_request = Utils::JsonMaker.new(hashe_data).get_json
125
120
  url = BASE_URL + METHODS[:indirect]
126
121
  make_request(url, json_body_request)
122
+ JSON.parse(@req.body, :quirks_mode => true)
127
123
  end
128
124
  end
129
125
  end
@@ -1,3 +1,3 @@
1
1
  module ConClas
2
- VERSION = "0.1.1"
2
+ VERSION = "0.1.2"
3
3
  end
@@ -17,9 +17,8 @@ class TestConClas < Test::Unit::TestCase
17
17
  "url" => "http://techcrunch.com/2016/05/23/we-need-more-driverless-car-accidents/"
18
18
  }
19
19
  ]
20
- test_result = [{"language"=>"en", "categories"=>[["Law & Government", 0.007575757575757573]]}]
21
- api.direct_classify(contents)
22
- assert_equal(test_result, api.response["results"])
20
+ response = api.direct_classify(contents)
21
+ assert_equal(true, response.has_key?('results'))
23
22
  end
24
23
 
25
24
  def test_indirect_classify
@@ -29,7 +28,7 @@ class TestConClas < Test::Unit::TestCase
29
28
  "url" => "http://techcrunch.com/2016/05/23/we-need-more-driverless-car-accidents/"
30
29
  }
31
30
  ]
32
- api.indirect_classify(contents, "http://www.mysite.com/callback")
33
- assert_equal(true, api.response.key?("ids"))
31
+ response = api.indirect_classify(contents, "http://www.mysite.com/callback")
32
+ assert_equal(true, response.has_key?('ids'))
34
33
  end
35
34
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: conclas
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - ConClas
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-06-29 00:00:00.000000000 Z
11
+ date: 2016-07-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -69,6 +69,7 @@ files:
69
69
  - Rakefile
70
70
  - bin/console
71
71
  - bin/setup
72
+ - conclas-0.1.1.gem
72
73
  - conclas.gemspec
73
74
  - lib/conclas.rb
74
75
  - lib/conclas/api.rb
@@ -79,7 +80,6 @@ files:
79
80
  - lib/conclas/utils/json_maker.rb
80
81
  - lib/conclas/utils/string_helper.rb
81
82
  - lib/conclas/version.rb
82
- - test.rb
83
83
  - tests/test_conclas.rb
84
84
  homepage: http://rubygems.org/gems/conclas
85
85
  licenses:
data/test.rb DELETED
@@ -1,6 +0,0 @@
1
- # coding: utf-8
2
- lib = File.expand_path('../lib', __FILE__)
3
- $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
- require 'conclas'
5
-
6
- puts ConClas::VERSION