ibm_watson 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -4,61 +4,63 @@ require("json")
4
4
  require_relative("./../test_helper.rb")
5
5
  require("minitest/hooks/test")
6
6
 
7
- # Integration tests for the Visual Recognition V3 Service
8
- class VisualRecognitionV3Test < Minitest::Test
9
- include Minitest::Hooks
10
- attr_accessor :service, :classifier_id
11
- def before_all
12
- @service = IBMWatson::VisualRecognitionV3.new(
13
- iam_api_key: ENV["VISUAL_RECOGNITION_IAM_APIKEY"],
14
- version: "2018-03-19",
15
- url: ENV["VISUAL_RECOGNITION_IAM_URL"]
16
- )
17
- @classifier_id = "doxnotxdeletexsdksxintegration_718351350"
18
- @service.add_default_headers(
19
- headers: {
20
- "X-Watson-Learning-Opt-Out" => "1",
21
- "X-Watson-Test" => "1"
22
- }
23
- )
24
- end
7
+ unless ENV["VISUAL_RECOGNITION_IAM_APIKEY"].nil? || ENV["VISUAL_RECOGNITION_IAM_URL"].nil?
8
+ # Integration tests for the Visual Recognition V3 Service
9
+ class VisualRecognitionV3Test < Minitest::Test
10
+ include Minitest::Hooks
11
+ attr_accessor :service, :classifier_id
12
+ def before_all
13
+ @service = IBMWatson::VisualRecognitionV3.new(
14
+ iam_api_key: ENV["VISUAL_RECOGNITION_IAM_APIKEY"],
15
+ version: "2018-03-19",
16
+ url: ENV["VISUAL_RECOGNITION_IAM_URL"]
17
+ )
18
+ @classifier_id = "doxnotxdeletexsdksxintegration_718351350"
19
+ @service.add_default_headers(
20
+ headers: {
21
+ "X-Watson-Learning-Opt-Out" => "1",
22
+ "X-Watson-Test" => "1"
23
+ }
24
+ )
25
+ end
25
26
 
26
- def test_classify
27
- image_file = File.open(Dir.getwd + "/resources/dog.jpg")
28
- dog_results = @service.classify(
29
- images_file: image_file,
30
- threshold: "0.1",
31
- classifier_ids: "default"
32
- ).result
33
- refute(dog_results.nil?)
34
- end
27
+ def test_classify
28
+ image_file = File.open(Dir.getwd + "/resources/dog.jpg")
29
+ dog_results = @service.classify(
30
+ images_file: image_file,
31
+ threshold: "0.1",
32
+ classifier_ids: "default"
33
+ ).result
34
+ refute(dog_results.nil?)
35
+ end
35
36
 
36
- def test_detect_faces
37
- output = @service.detect_faces(
38
- url: "https://www.ibm.com/ibm/ginni/images/ginni_bio_780x981_v4_03162016.jpg"
39
- ).result
40
- refute(output.nil?)
41
- end
37
+ def test_detect_faces
38
+ output = @service.detect_faces(
39
+ url: "https://www.ibm.com/ibm/ginni/images/ginni_bio_780x981_v4_03162016.jpg"
40
+ ).result
41
+ refute(output.nil?)
42
+ end
42
43
 
43
- def test_custom_classifier
44
- skip "Time Consuming"
45
- cars = File.open(Dir.getwd + "/resources/cars.zip")
46
- trucks = File.open(Dir.getwd + "/resources/trucks.zip")
47
- classifier = @service.create_classifier(
48
- name: "CarsVsTrucks",
49
- classname_positive_examples: cars,
50
- negative_examples: trucks
51
- ).result
52
- refute(classifier.nil?)
44
+ def test_custom_classifier
45
+ skip "Time Consuming"
46
+ cars = File.open(Dir.getwd + "/resources/cars.zip")
47
+ trucks = File.open(Dir.getwd + "/resources/trucks.zip")
48
+ classifier = @service.create_classifier(
49
+ name: "CarsVsTrucks",
50
+ classname_positive_examples: cars,
51
+ negative_examples: trucks
52
+ ).result
53
+ refute(classifier.nil?)
53
54
 
54
- classifier_id = classifier["classifier_id"]
55
- output = @service.get_classifier(
56
- classifier_id: classifier_id
57
- ).result
58
- refute(output.nil?)
55
+ classifier_id = classifier["classifier_id"]
56
+ output = @service.get_classifier(
57
+ classifier_id: classifier_id
58
+ ).result
59
+ refute(output.nil?)
59
60
 
60
- @service.delete_classifier(
61
- classifier_id: classifier_id
62
- )
61
+ @service.delete_classifier(
62
+ classifier_id: classifier_id
63
+ )
64
+ end
63
65
  end
64
66
  end
data/test/test_helper.rb CHANGED
@@ -12,7 +12,6 @@ if ENV["COVERAGE"]
12
12
  File.basename(src_file.filename) == "version.rb"
13
13
  end
14
14
 
15
- add_group "lib", "/lib/"
16
15
  command_name "Minitest"
17
16
  end
18
17
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ibm_watson
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Max Nussbaum
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-07-06 00:00:00.000000000 Z
11
+ date: 2018-07-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: concurrent-ruby
@@ -66,20 +66,6 @@ dependencies:
66
66
  - - "~>"
67
67
  - !ruby/object:Gem::Version
68
68
  version: '3.3'
69
- - !ruby/object:Gem::Dependency
70
- name: json
71
- requirement: !ruby/object:Gem::Requirement
72
- requirements:
73
- - - "~>"
74
- - !ruby/object:Gem::Version
75
- version: '2.1'
76
- type: :runtime
77
- prerelease: false
78
- version_requirements: !ruby/object:Gem::Requirement
79
- requirements:
80
- - - "~>"
81
- - !ruby/object:Gem::Version
82
- version: '2.1'
83
69
  - !ruby/object:Gem::Dependency
84
70
  name: bundler
85
71
  requirement: !ruby/object:Gem::Requirement
@@ -287,7 +273,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
287
273
  requirements:
288
274
  - - ">="
289
275
  - !ruby/object:Gem::Version
290
- version: '0'
276
+ version: '2.3'
291
277
  required_rubygems_version: !ruby/object:Gem::Requirement
292
278
  requirements:
293
279
  - - ">="
@@ -298,5 +284,5 @@ rubyforge_project:
298
284
  rubygems_version: 2.7.7
299
285
  signing_key:
300
286
  specification_version: 4
301
- summary: Client library to use the IBM Watson Services
287
+ summary: Official client library to use the IBM Watson Services
302
288
  test_files: []