da_funk 1.10.0 → 1.11.0

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: 07b9ea6556472bc92fa259d401df635c5aff47d0
4
- data.tar.gz: d891623b931366e85ffcb3de87c34bd0ce2c2dc6
3
+ metadata.gz: f02750035385ab13f575b3238e23e0d6c52c36ea
4
+ data.tar.gz: 7004539dee0f72e9f42b7d5fb961362287c400ff
5
5
  SHA512:
6
- metadata.gz: 54ddb2aff41234bfb11af9267e20ba7bc3982ae7f7bbf7f37cbe4b7fa91e32298ef6489ccec6ac4b079b9b1ffab1b33920ecedb80479fdb305afce1db2d8bf15
7
- data.tar.gz: 283903005f42037e3881bc8b4e35e26006e4aeecc30543ca47a3a96d2b995da875bd6152ad8c28ebf6bdebd3f685e6b2a3e48cc063e248872c390d76e23669e9
6
+ metadata.gz: 639c17f6027557cfc9a9b28a843437dc02da6f27eacb748c3704ed0295d77878712993e79234f888abb11782f49e8b8c4cde7ad8315f1095f98082777a4b19e3
7
+ data.tar.gz: a0a95c27abefbea7f1a22145e83e0ef8eb72ac7243b416511ee18ee95b3f025ac9060b9677e88065e2a3d734c35e2992753053d1412967fad1b8eb71cfa7dd7f
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- da_funk (1.10.0)
4
+ da_funk (1.11.0)
5
5
  archive-zip (~> 0.5)
6
6
  bundler
7
7
  cloudwalk_handshake
@@ -15,7 +15,7 @@ GEM
15
15
  archive-zip (0.11.0)
16
16
  io-like (~> 0.3.0)
17
17
  ast (2.4.0)
18
- cloudwalk (1.5.0)
18
+ cloudwalk (1.9.1)
19
19
  bundler
20
20
  rake
21
21
  cloudwalk_handshake (0.12.0)
@@ -25,22 +25,22 @@ GEM
25
25
  funky-tlv (0.2.3)
26
26
  io-like (0.3.0)
27
27
  parallel (1.12.1)
28
- parser (2.4.0.2)
29
- ast (~> 2.3)
30
- posxml_parser (2.3.1)
28
+ parser (2.5.1.0)
29
+ ast (~> 2.4.0)
30
+ posxml_parser (2.3.3)
31
31
  funky-emv (~> 0.3)
32
32
  powerpack (0.1.1)
33
33
  rainbow (3.0.0)
34
- rake (12.3.0)
35
- rubocop (0.52.1)
34
+ rake (12.3.1)
35
+ rubocop (0.56.0)
36
36
  parallel (~> 1.10)
37
- parser (>= 2.4.0.2, < 3.0)
37
+ parser (>= 2.5)
38
38
  powerpack (~> 0.1)
39
39
  rainbow (>= 2.2.2, < 4.0)
40
40
  ruby-progressbar (~> 1.7)
41
41
  unicode-display_width (~> 1.0, >= 1.0.1)
42
42
  ruby-progressbar (1.9.0)
43
- unicode-display_width (1.3.0)
43
+ unicode-display_width (1.3.2)
44
44
  yard (0.9.12)
45
45
 
46
46
  PLATFORMS
data/RELEASE_NOTES.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # DaFunk
2
2
 
3
+ ### 1.11.0 - 2018-05-18
4
+
5
+ - Bug fix String.integer? when string starts with “0”.
6
+ - Increase getc timeout to 10 seconds when communication error.
7
+ - ISO8583 convert bitmap from binary to hex and hex to binary.
8
+
3
9
  ### 1.10.0 - 2018-03-22
4
10
 
5
11
  - Change Notification format removing repeated values.
@@ -35,7 +35,7 @@ module DaFunk
35
35
  else
36
36
  Device::Setting.network_configured = 0 if DaFunk::ParamsDat.file["connection_management"] == "0"
37
37
  print_attach(:attach_fail, options.merge(:args => [Device::Network.code.to_s]))
38
- getc(4000)
38
+ getc(10000)
39
39
  return false
40
40
  end
41
41
  else
@@ -1,4 +1,4 @@
1
1
  module DaFunk
2
- VERSION="1.10.0"
2
+ VERSION="1.11.0"
3
3
  end
4
4
 
data/lib/ext/string.rb CHANGED
@@ -13,7 +13,7 @@ class String
13
13
  def integer?
14
14
  !! Integer(self)
15
15
  rescue ArgumentError => e
16
- if e.message[-19..-1] == "too big for integer"
16
+ if e.message[-19..-1] == "too big for integer" || (self[0] == "0" && !self.match(/[a-zA-Z]/))
17
17
  begin
18
18
  self.to_f
19
19
  return true
@@ -59,7 +59,21 @@ module ISO8583
59
59
 
60
60
  # Generate the bytes representing this bitmap.
61
61
  def to_bytes
62
- self.to_s.to_i(2).to_s(16).upcase
62
+ # Convert binary to hex, by slicing the binary in 4 bytes chuncks
63
+ bitmap_hex = ""
64
+ str = ""
65
+ self.to_s.chars.reverse.each_with_index do |ch, i|
66
+ str << ch
67
+ next if i == 0
68
+ if (i+1) % 4 == 0
69
+ bitmap_hex << str.reverse.to_i(2).to_s(16)
70
+ str = ""
71
+ end
72
+ end
73
+ unless str.empty?
74
+ bitmap_hex << str.reverse.to_i(2).to_s(16)
75
+ end
76
+ bitmap_hex.reverse.upcase
63
77
  end
64
78
  alias_method :to_b, :to_bytes
65
79
 
@@ -85,9 +99,15 @@ module ISO8583
85
99
 
86
100
  private
87
101
 
102
+ def convert_hex_to_binary(str)
103
+ str.chars.reverse.inject("") do |string, ch|
104
+ string + ch.to_i(16).to_s(2).rjust(4, "0").reverse
105
+ end.reverse
106
+ end
107
+
88
108
  def initialize_from_message(message)
89
109
  bmp = if hex_bitmap?
90
- rjust(message[0..15].to_i(16).to_s(2), 64, '0')
110
+ rjust(convert_hex_to_binary(message[0..15]), 64, '0')
91
111
  else
92
112
  message.unpack("B64")[0]
93
113
  end
data/out/da_funk.mrb CHANGED
Binary file
@@ -32,6 +32,10 @@ class StringTest < DaFunk::Test.case
32
32
  assert_false "0A179759".integer?
33
33
  end
34
34
 
35
+ def test_interger_check_true_0517030931
36
+ assert "0517030931".integer?
37
+ end
38
+
35
39
  def test_interger_check_false_empty
36
40
  assert_false "".integer?
37
41
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: da_funk
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.10.0
4
+ version: 1.11.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Thiago Scalone
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-03-22 00:00:00.000000000 Z
11
+ date: 2018-05-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake