intermine 1.04.00 → 1.05.00

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- !binary "U0hBMQ==":
3
- metadata.gz: 7acd7d68334244919bb203d2924ac0d83383f49e
4
- data.tar.gz: b7b72e0ed38c01cc710ce038848698ec152c5729
5
- !binary "U0hBNTEy":
6
- metadata.gz: 6a6ff85383c7cc8593ed654f3dc5319cf04f115e2fb7884581c7ceac21b9ca189e9e134ef2c2f2f5bd947fa49929fc52847569d535c4e79e671949e8853d2c83
7
- data.tar.gz: 1fdd048f8a47b4ed646b89f4791fda7e0731069f960207a39ea43ce3d478beeb0e13c45acec19cdd8569a3af7b698cb4ea6eb90bee4d2d7b5e06499d433a073b
2
+ SHA1:
3
+ metadata.gz: 0f7e79ba5ea58942e42fc031ee303e7ad2ec0faa
4
+ data.tar.gz: 54bb79ac11337ea032fac6d80d048eeee2bc3f9b
5
+ SHA512:
6
+ metadata.gz: fce9cae88153be341eb0aa1de6a8c031f9607856b2325322ee437b757f894963dfa8d6d4a3016b08f875af5906cb8c8ac02bdb30b64ef40113c65029afbc948b
7
+ data.tar.gz: be4e1a916016776010c7bbd7610db539b0e00fdf8bfc548b80ee9c1a52284a40c92eefc3e8ce461920324f4725aff9211b68a945a8c3da3b00be4a814a544429
@@ -0,0 +1,19 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ intermine (1.05.00)
5
+ json
6
+
7
+ GEM
8
+ remote: http://rubygems.org/
9
+ specs:
10
+ json (2.0.2)
11
+
12
+ PLATFORMS
13
+ ruby
14
+
15
+ DEPENDENCIES
16
+ intermine!
17
+
18
+ BUNDLED WITH
19
+ 1.13.1
@@ -75,5 +75,5 @@ Support is available on our development mailing list: dev@intermine.org
75
75
 
76
76
  == License
77
77
 
78
- This code is Open Source under the LGPL. Source code for all InterMine code
79
- can be checked out from svn://subversion.flymine.org/flymine
78
+ This code is Open Source under the LGPL. Source code for this gem
79
+ can be checked out from https://github.com/intermine/intermine-ws-ruby
@@ -93,6 +93,11 @@ module InterMine::Lists
93
93
  details.each {|k,v| instance_variable_set('@' + k, v)}
94
94
  @unmatched_identifiers = []
95
95
  @tags ||= []
96
+ @uri = URI.parse(@manager.service.root)
97
+ @http = Net::HTTP.new(@uri.host, @uri.port)
98
+ if @uri.scheme == 'https'
99
+ @http.use_ssl = true
100
+ end
96
101
  end
97
102
 
98
103
  # True if the list has no elements.
@@ -219,7 +224,9 @@ module InterMine::Lists
219
224
  return if (@name == new_name)
220
225
  uri = URI.parse(@manager.service.root + Service::LIST_RENAME_PATH)
221
226
  params = @manager.service.params.merge("oldname" => @name, "newname" => new_name)
222
- res = Net::HTTP.post_form(uri, params)
227
+ res = @http.start() do |http|
228
+ Net::HTTP.post_form(uri, params)
229
+ end
223
230
  @manager.process_list_creation_response(res)
224
231
  @name = new_name
225
232
  end
@@ -334,7 +341,9 @@ module InterMine::Lists
334
341
  s = @manager.service
335
342
  params = s.params.merge(ENRICHMENT_DEFAULTS).merge(opts).merge(:widget => widget, :list => @name)
336
343
  uri = URI.parse(s.root + Service::LIST_ENRICHMENT_PATH)
337
- res = Net::HTTP.post_form(uri, params)
344
+ res = @http.start() do |http|
345
+ Net::HTTP.post_form(uri, params)
346
+ end
338
347
  return case res
339
348
  when Net::HTTPSuccess
340
349
  JSON.parse(res.body)["results"].map {|row| SymbolAcceptingHash[row] }
@@ -392,7 +401,9 @@ module InterMine::Lists
392
401
  q = (list.is_a?(List)) ? list.list_query : list
393
402
  params = q.params.merge(@manager.service.params).merge("listName" => @name)
394
403
  uri = URI.parse(q.list_append_uri)
395
- res = Net::HTTP.post_form(uri, params)
404
+ res = @http.start() do |http|
405
+ Net::HTTP.post_form(uri, params)
406
+ end
396
407
  handle_response(res)
397
408
  end
398
409
 
@@ -420,7 +431,7 @@ module InterMine::Lists
420
431
  req.content_type = "text/plain"
421
432
  req.content_length = f.size
422
433
 
423
- res = Net::HTTP.start(uri.host, uri.port) do |http|
434
+ res = @http.start() do |http|
424
435
  http.request(req)
425
436
  end
426
437
  handle_response(res)
@@ -482,6 +493,11 @@ module InterMine::Lists
482
493
  @service = service
483
494
  @lists = {}
484
495
  @temporary_lists = []
496
+ @uri = URI.parse(@service.root)
497
+ @http = Net::HTTP.new(@uri.host, @uri.port)
498
+ if @uri.scheme == 'https'
499
+ @http.use_ssl = true
500
+ end
485
501
  do_at_exit(self)
486
502
  end
487
503
 
@@ -585,7 +601,7 @@ module InterMine::Lists
585
601
  uri = URI.parse(@service.root + Service::LISTS_PATH)
586
602
  params = {"name" => name}
587
603
  req = Net::HTTP::Delete.new(uri.path + "?" + params_to_query_string(params))
588
- res = Net::HTTP.start(uri.host, uri.port) do |http|
604
+ res = @http.start do |http|
589
605
  http.request(req)
590
606
  end
591
607
  check_response_for_error(res)
@@ -630,7 +646,9 @@ module InterMine::Lists
630
646
  uri = URI.parse(@service.root + Service::LIST_SUBTRACTION_PATH)
631
647
  params = @service.params.merge("name" => name, "description" => description, "references" => ref_names.join(';'),
632
648
  "subtract" => del_names.join(';'), "tags" => tags.join(';'))
633
- res = Net::HTTP.post_form(uri, params)
649
+ res = @http.start() do |http|
650
+ Net::HTTP.post_form(uri, params)
651
+ end
634
652
  return process_list_creation_response(res)
635
653
  end
636
654
 
@@ -654,7 +672,9 @@ module InterMine::Lists
654
672
  def add_tags(list, *tags)
655
673
  uri = URI.parse(@service.root + Service::LIST_TAG_PATH)
656
674
  params = @service.params.merge("name" => list.name, "tags" => tags.join(";"))
657
- res = Net::HTTP.post_form(uri, params)
675
+ res = @http.start() do |http|
676
+ Net::HTTP.post_form(uri, params)
677
+ end
658
678
  check_response_for_error(res)
659
679
  return JSON.parse(res.body)["tags"]
660
680
  end
@@ -671,7 +691,7 @@ module InterMine::Lists
671
691
  )
672
692
  req_path = uri.path + "?" + params_to_query_string(params)
673
693
  req = Net::HTTP::Delete.new(req_path)
674
- res = Net::HTTP.start(uri.host, uri.port) do |http|
694
+ res = @http.start() do |http|
675
695
  http.request(req)
676
696
  end
677
697
  check_response_for_error(res)
@@ -685,9 +705,9 @@ module InterMine::Lists
685
705
  "name" => list.name
686
706
  )
687
707
  req_path = uri.path + "?" + params_to_query_string(params)
688
- res = Net::HTTP.start(uri.host, uri.port) {|http|
689
- http.get(req_path)
690
- }
708
+ res = @http.start() do |http|
709
+ http.get(req_path)
710
+ end
691
711
  check_response_for_error(res)
692
712
  return JSON.parse(res.body)["tags"]
693
713
  end
@@ -747,7 +767,9 @@ module InterMine::Lists
747
767
  "name" => name, "lists" => list_names.join(";"),
748
768
  "description" => description, "tags" => tags.join(';')
749
769
  )
750
- res = Net::HTTP::post_form(uri, params)
770
+ res = @http.start() do |http|
771
+ Net::HTTP::post_form(uri, params)
772
+ end
751
773
  return process_list_creation_response(res)
752
774
  end
753
775
 
@@ -776,7 +798,9 @@ module InterMine::Lists
776
798
  }
777
799
  service_params = @service.params
778
800
  params = query.params.merge(list_params).merge(service_params)
779
- return Net::HTTP.post_form(URI.parse(uri), params)
801
+ @http.start() do |http|
802
+ return Net::HTTP.post_form(URI.parse(uri), params)
803
+ end
780
804
  end
781
805
 
782
806
  # Routine for creating a List in a webservice from a list of Ids.
@@ -805,7 +829,7 @@ module InterMine::Lists
805
829
  req.content_type = "text/plain"
806
830
  req.content_length = f.size
807
831
 
808
- res = Net::HTTP.start(uri.host, uri.port) do |http|
832
+ res = @http.start() do |http|
809
833
  http.request(req)
810
834
  end
811
835
  f.close
@@ -518,35 +518,12 @@ module Metadata
518
518
 
519
519
  klass = Module.new
520
520
  fd_names = @fields.values.map { |x| x.name }
521
- fds = @fields.values
522
521
  attr_names = @fields.values.select { |x| x.is_a?(AttributeDescriptor)}.map {|x| x.name}
523
522
  klass.class_eval do
524
523
  include *supers
525
524
  attr_reader *attr_names
526
525
  end
527
526
 
528
- klass.class_eval do
529
-
530
- define_method(:to_h) do
531
- ret = Hash.new
532
- fds.each do |fd|
533
- if fd.is_a?(AttributeDescriptor)
534
- ret.store(fd.name, send(fd.name))
535
- elsif fd.is_a?(CollectionDescriptor)
536
- ret.store(fd.name, send(fd.name).map {|v| v.to_h})
537
- else
538
- ret.store(fd.name, send(fd.name).to_h)
539
- end
540
- end
541
- ret.store("id", objectId)
542
- return ret
543
- end
544
-
545
- define_method(:to_json) do |*a|
546
- to_h.to_json(*a)
547
- end
548
- end
549
-
550
527
  @fields.values.each do |fd|
551
528
  if fd.is_a?(CollectionDescriptor)
552
529
  klass.class_eval do
@@ -233,12 +233,18 @@ module InterMine::Results
233
233
  @query = query
234
234
  @start = start
235
235
  @size = size
236
+ @http = Net::HTTP.new(@uri.host, @uri.port)
237
+ if @uri.scheme == 'https'
238
+ @http.use_ssl = true
239
+ end
236
240
  end
237
241
 
238
242
  # Run a request to get the size of the result set.
239
243
  def get_size
240
244
  query = params("jsoncount")
241
- res = Net::HTTP.post_form(@uri, query)
245
+ res = @http.start() do |http|
246
+ Net::HTTP.post_form(@uri, query)
247
+ end
242
248
  case res
243
249
  when Net::HTTPSuccess
244
250
  return check_result_set(res.body)["count"]
@@ -331,7 +337,7 @@ module InterMine::Results
331
337
  def each_line(data)
332
338
  req = Net::HTTP::Post.new(@uri.path)
333
339
  req.set_form_data(data)
334
- Net::HTTP.new(@uri.host, @uri.port).start {|http|
340
+ @http.start {|http|
335
341
  http.request(req) {|resp|
336
342
  holdover = ""
337
343
  resp.read_body {|chunk|
@@ -165,6 +165,9 @@ module InterMine
165
165
  @root_path = root_uri.path
166
166
 
167
167
  @http = Net::HTTP.new(root_uri.host, root_uri.port)
168
+ if root_uri.scheme == 'https'
169
+ @http.use_ssl = true
170
+ end
168
171
 
169
172
  v_path = @root + VERSION_PATH
170
173
  begin
@@ -3,7 +3,7 @@ module Intermine
3
3
  # Webservice Client Version number
4
4
  #
5
5
  # Changes:
6
- # 1.04.00 - Added to_h and to_json methods for result objects
6
+ # 1.05.00 - Add support for HTTPS
7
7
  # 1.03.00 - Add support for indexed sequence service
8
8
  # 1.02.00 - Allow the lazy fetching to be optional
9
9
  # 1.01.01 - Improved lazy reference fetching
@@ -22,5 +22,5 @@ module Intermine
22
22
  # 0.98.09 - Major changes to results - now with thorough-going Enumerable support
23
23
  # 0.98.08 - Added column summary support
24
24
  #
25
- VERSION = "1.04.00"
25
+ VERSION = "1.05.00"
26
26
  end
@@ -1,6 +1,5 @@
1
1
  require File.dirname(__FILE__) + "/test_helper.rb"
2
2
  require "intermine/model"
3
- require "json"
4
3
 
5
4
  require "test/unit"
6
5
 
@@ -221,58 +220,6 @@ class TestModel < Test::Unit::TestCase
221
220
 
222
221
  end
223
222
 
224
- def test_to_h
225
-
226
- manager = @model.make_new("Manager", {
227
- "name" => "David Brent",
228
- "seniority" => 42,
229
- "age" => 39,
230
- "fullTime" => true,
231
- "department" => {
232
- "name" => "Sales",
233
- "employees" => [
234
- { "name" => "Tom" },
235
- { "name" => "Dick" },
236
- { "name" => "Harry" }
237
- ]
238
- }
239
- })
240
-
241
- manager_h = manager.to_h
242
-
243
- assert_equal(manager_h["name"], "David Brent")
244
- assert_equal(manager_h["age"], 39)
245
- assert_equal(manager_h["department"]["name"], "Sales")
246
- assert_equal(manager_h["department"]["employees"][1]["name"], "Dick")
247
- assert_equal(manager_h["department"]["employees"].size, 3)
248
- end
249
-
250
- def test_to_json
251
-
252
- manager = @model.make_new("Manager", {
253
- "name" => "David Brent",
254
- "seniority" => 42,
255
- "age" => 39,
256
- "fullTime" => true,
257
- "department" => {
258
- "name" => "Sales",
259
- "employees" => [
260
- { "name" => "Tom" },
261
- { "name" => "Dick" },
262
- { "name" => "Harry" }
263
- ]
264
- }
265
- })
266
-
267
- manager_h = JSON[manager.to_h.to_json]
268
-
269
- assert_equal(manager_h["name"], "David Brent")
270
- assert_equal(manager_h["age"], 39)
271
- assert_equal(manager_h["department"]["name"], "Sales")
272
- assert_equal(manager_h["department"]["employees"][1]["name"], "Dick")
273
- assert_equal(manager_h["department"]["employees"].size, 3)
274
- end
275
-
276
223
  def test_inheritance
277
224
 
278
225
  manager = @model.make_new("Manager", { "name" => "David Brent" })
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: intermine
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.04.00
4
+ version: 1.05.00
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alex Kalderimis
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-07-08 00:00:00.000000000 Z
11
+ date: 2017-05-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: json
@@ -54,14 +54,21 @@ description: "= Webservice Client Library for InterMine Data-Warehouses\n\nThis
54
54
  details, see the accompanying documentation and the unit tests\nfor interface examples.
55
55
  Further documentation is available at www.intermine.org.\n\n== Support\n\nSupport
56
56
  is available on our development mailing list: dev@intermine.org\n\n== License\n\nThis
57
- code is Open Source under the LGPL. Source code for all InterMine code\ncan be checked
58
- out from svn://subversion.flymine.org/flymine\n"
57
+ code is Open Source under the LGPL. Source code for this gem\ncan be checked out
58
+ from https://github.com/intermine/intermine-ws-ruby\n"
59
59
  email:
60
60
  - dev@intermine.org
61
61
  executables: []
62
62
  extensions: []
63
63
  extra_rdoc_files: []
64
64
  files:
65
+ - Gemfile
66
+ - Gemfile.lock
67
+ - LICENCE
68
+ - MANIFEST
69
+ - README.rdoc
70
+ - Rakefile
71
+ - contact_header.rdoc
65
72
  - lib/intermine/lists.rb
66
73
  - lib/intermine/model.rb
67
74
  - lib/intermine/query.rb
@@ -87,12 +94,6 @@ files:
87
94
  - test/test_service.rb
88
95
  - test/test_sugar.rb
89
96
  - test/unit_tests.rb
90
- - MANIFEST
91
- - LICENCE
92
- - Rakefile
93
- - README.rdoc
94
- - Gemfile
95
- - contact_header.rdoc
96
97
  homepage: http://www.intermine.org
97
98
  licenses:
98
99
  - LGPL
@@ -118,7 +119,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
118
119
  version: '0'
119
120
  requirements: []
120
121
  rubyforge_project: intermine
121
- rubygems_version: 2.0.0.preview3.1
122
+ rubygems_version: 2.5.2
122
123
  signing_key:
123
124
  specification_version: 4
124
125
  summary: Webservice Client Library for InterMine Data-Warehouses