blackstack_commons 0.0.20 → 0.0.24

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.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/lib/extend_time.rb +6 -1
  3. data/lib/functions.rb +14 -2
  4. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a6ab4c21a6f6cf0ff81035fa7f09d0be05c113d4
4
- data.tar.gz: 31141034849f46b3681e718d854d51b6bca10890
3
+ metadata.gz: 3af551bd870c5dbc4444fae14abb1d312f89111e
4
+ data.tar.gz: 25331c677282623de5dda429a0b6630b972a7086
5
5
  SHA512:
6
- metadata.gz: a455c47b52c54b8d52919b8850593e7e2acb90c5300cb0580fb1e40301357481ac5473bdba81d6a6b302001b5a9f585f277f9248651b4256b89a6277eee470a2
7
- data.tar.gz: 94893de40ffbc265b4a4246aa1d23a812ca7336ccea7aecc872ee172c1da97bcf84b4aad169360c9edf992b714b46d16c9d9d11deb87a6436ef8051a525a65c6
6
+ metadata.gz: 85044e3300958ab0e15bd317c427acad1bda635753ec04e6a1ea72565ace7c5006fe4a39371d495d5888f2dc9c56220fa1b372a21cd58d8a5fdbbee3786eacd0
7
+ data.tar.gz: db50cb526f6959e88c3839046e7fb4778070987cbf8cc08606d6fccbecfeaa71addfc7000a708210d95f361ab0a1e26fa245d00ac8d14a9dc0618b98be552a9a
data/lib/extend_time.rb CHANGED
@@ -1,6 +1,11 @@
1
1
  class Time
2
- # Converts a time object to an SQL friendy string
2
+ # Converts a time object to an SQL friendy string: YYYY-MM-DD HH:mm:ss
3
3
  def to_sql()
4
4
  BlackStack::DateTime::Encoding::datetime_to_sql(self)
5
5
  end
6
+
7
+ # Converts a time object to an API friendy string: YYYYMMDDHHmmss
8
+ def to_api()
9
+ BlackStack::Strings::DateTime::datetime_sql_to_api(self.to_sql)
10
+ end
6
11
  end # class DateTime
data/lib/functions.rb CHANGED
@@ -447,6 +447,18 @@ module BlackStack
447
447
  DEFAULT_SSL_VERIFY_MODE = OpenSSL::SSL::VERIFY_NONE
448
448
  SUCCESS = 'success'
449
449
 
450
+ class ApiCallException < StandardError
451
+ attr_accessor :description
452
+
453
+ def initialize(s)
454
+ self.description = s
455
+ end
456
+
457
+ def to_s
458
+ self.description
459
+ end
460
+ end
461
+
450
462
  # New call_get
451
463
  def self.call_get(url, params = {}, ssl_verify_mode=BlackStack::Netting::DEFAULT_SSL_VERIFY_MODE)
452
464
  uri = URI(url)
@@ -501,9 +513,9 @@ module BlackStack
501
513
  sError = "Status: #{parsed['status'].to_s}. Description: #{parsed['value'].to_s}."
502
514
  end
503
515
  rescue Errno::ECONNREFUSED => e
504
- sError = "Errno::ECONNREFUSED:" + e.to_s
516
+ sError = "Errno::ECONNREFUSED:" + e.to_console
505
517
  rescue => e2
506
- sError = "Exception:" + e2.to_s
518
+ sError = "Exception:" + e2.to_console
507
519
  end
508
520
  end # while
509
521
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: blackstack_commons
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.20
4
+ version: 0.0.24
5
5
  platform: ruby
6
6
  authors:
7
7
  - Leandro Daniel Sardi
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-12-07 00:00:00.000000000 Z
11
+ date: 2019-12-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: content_spinning