blackstack_commons 0.0.9 → 0.0.10

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/functions.rb +15 -13
  3. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 306d7981b5b6606fafd307ad47be95e1844fbf33
4
- data.tar.gz: 4a3deb41ff9a6795fa751237dea25faab67fe943
3
+ metadata.gz: 70a80ef69b1f559548bf1b9a5200bef942849a59
4
+ data.tar.gz: 912b1b9564750ad842219ea1caff941269dd1779
5
5
  SHA512:
6
- metadata.gz: 60141ed8ff1c79e0aac51e60c63e1f9de89be0aaeda55b4c0ffeb0ebb830b4563cd4655158debdb5621fed52187f8952d48cc4b168b64494622b3518eb1326c1
7
- data.tar.gz: c50bf7b15bfaebe58b29109b06fa593c66bc8baa795d627935b444a4338fff5a817e5f5ebbb8ff9f730f80f419a8cf821c54ead8fbf145353648b276d3bc2f53
6
+ metadata.gz: 5f6d50eef3b92f6d230ec2bcf0465d645da6eecf5783aff358a55a17a444414a44ccf5907efad0971859ecb0128f7083fc6c870703df3de0369def02da9d7982
7
+ data.tar.gz: d99124b3868f30b715032814496eb542f11ef625dc761a3db21542dc35a1a6f1e4695621c036abb2156dae328c99d6983bb84ca216d2726fa9c20bab50218724
@@ -448,7 +448,8 @@ module BlackStack
448
448
  SUCCESS = 'success'
449
449
 
450
450
  # New call_get
451
- def self.call_get(uri, params = {}, ssl_verify_mode=BlackStack::Netting::DEFAULT_SSL_VERIFY_MODE)
451
+ def self.call_get(url, params = {}, ssl_verify_mode=BlackStack::Netting::DEFAULT_SSL_VERIFY_MODE)
452
+ uri = URI(url)
452
453
  uri.query = URI.encode_www_form(params)
453
454
  Net::HTTP.start(uri.host, uri.port, :use_ssl => uri.scheme == 'https', :verify_mode => ssl_verify_mode) do |http|
454
455
  req = Net::HTTP::Get.new uri
@@ -463,19 +464,20 @@ module BlackStack
463
464
  end
464
465
 
465
466
  # New call_post
466
- def self.call_post(uri, params = {}, ssl_verify_mode=BlackStack::Netting::DEFAULT_SSL_VERIFY_MODE)
467
- Net::HTTP.start(uri.host, uri.port, :use_ssl => uri.scheme == 'https', :verify_mode => ssl_verify_mode) do |http|
468
- req = Net::HTTP::Post.new(uri)
469
- req['Content-Type'] = 'application/json'
470
- req.set_form_data(params)
471
- res = http.request req
472
- case res
473
- when Net::HTTPSuccess then res
474
- when Net::HTTPRedirection then BlackStack::Netting::call_post(URI(res['location']), params)
475
- else
476
- res.error!
477
- end
467
+ def self.call_post(url, params = {}, ssl_verify_mode=BlackStack::Netting::DEFAULT_SSL_VERIFY_MODE)
468
+ uri = URI(url)
469
+ Net::HTTP.start(uri.host, uri.port, :use_ssl => uri.scheme == 'https', :verify_mode => ssl_verify_mode) do |http|
470
+ req = Net::HTTP::Post.new(uri)
471
+ req['Content-Type'] = 'application/json'
472
+ req.set_form_data(params)
473
+ res = http.request req
474
+ case res
475
+ when Net::HTTPSuccess then res
476
+ when Net::HTTPRedirection then BlackStack::Netting::call_post(URI(res['location']), params)
477
+ else
478
+ res.error!
478
479
  end
480
+ end
479
481
  end
480
482
 
481
483
  #
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: blackstack_commons
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.9
4
+ version: 0.0.10
5
5
  platform: ruby
6
6
  authors:
7
7
  - Leandro Daniel Sardi