da_funk 0.5.1 → 0.5.3

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: 1b480b5631767e85d7cb2ccbbd975c1be1855810
4
- data.tar.gz: 7dc71b04d56979458cd23e44a27698028df6b890
3
+ metadata.gz: 431f3a163440020ee762a35bed3017636e4ecfe9
4
+ data.tar.gz: 8a950596de6fa69f4dc1ffb9ba927d9f353d3334
5
5
  SHA512:
6
- metadata.gz: 76c5eba2efcb502d26c7661dd90f8318005bce47d060a4dca15c8a84c46e83e476f1d259866cb512379a7e8a049798bd6d2a194398d88024235fe51300d45a58
7
- data.tar.gz: 37dc24ed9e61482dabd643ec97261d9f258682bdd53ab79f4e179dc8dabbb392d3870afe078cdda3814c71981d0c5a69b62d6b4a90de50508970d3e5d6aa9a62
6
+ metadata.gz: 5854ea72eaf73de652e1dc4c2b00e56a264ed8d6c01ff500b3aceeadc50bc45df6a5e88a978e361f08f078579ee4676ffc371ac46bf42d9896ef7240bf599473
7
+ data.tar.gz: efb79c4bbe6d47de7bb29d8e751e26f5540bec7069187883d2378f638cfa516caf95a609db66a9dbaaa6d45ed03206fd74ac81a839ac3bb2fc3c2c1cf547e979
data/Gemfile.lock CHANGED
@@ -7,7 +7,7 @@ GIT
7
7
  PATH
8
8
  remote: .
9
9
  specs:
10
- da_funk (0.5.1)
10
+ da_funk (0.5.3)
11
11
  bundler (~> 1.7)
12
12
  cloudwalk_handshake (~> 0.4)
13
13
  rake (~> 10.4)
@@ -16,7 +16,7 @@ PATH
16
16
  GEM
17
17
  remote: https://rubygems.org/
18
18
  specs:
19
- cloudwalk_handshake (0.4.12)
19
+ cloudwalk_handshake (0.5.0)
20
20
  rake (10.4.2)
21
21
  yard (0.8.7.6)
22
22
 
data/RELEASE_NOTES.md CHANGED
@@ -1,5 +1,15 @@
1
1
  # DaFunk
2
2
 
3
+ ### 0.5.3 - 2016-01-06 - Update cloudwalk_handshake
4
+ - Update cloudwlak_handshake to version 0.5.0.
5
+ - Support to execute an application as file.
6
+
7
+ ### 0.5.2 - 2016-01-05 - Update cloudwalk_handshake
8
+ - FileDb dot not check key value after sanitize to avoid problem on hash creation.
9
+ - Add sim_pim, sim_slot, sim_dual, phone, modem_speed, touchscreen, attach_gprs_timeout, attach_tries, tcp_recv_timeout, iso8583_send_tries, crypto_dukpt_slot and ctls to Setting.
10
+ - Add method model and versions to Device::System.
11
+ - Add support to brand, model and versions to DaFunk tests API.
12
+
3
13
  ### 0.5.1 - 2015-12-16 - Update cloudwalk_handshake
4
14
  - Update cloudwlak_handshake to version 0.4.12.
5
15
 
data/lib/da_funk/test.rb CHANGED
@@ -23,7 +23,8 @@ module DaFunk
23
23
 
24
24
  class Test
25
25
  class << self
26
- attr_accessor :root_path, :libs, :tests, :logical_number, :serial, :name
26
+ attr_accessor :root_path, :libs, :tests, :logical_number, :serial, :name,
27
+ :brand, :model, :battery
27
28
  include DaFunk::MRuby
28
29
  end
29
30
 
@@ -44,6 +45,9 @@ module DaFunk
44
45
  @serial ||= "1111111111"
45
46
  @logical_number ||= "00001"
46
47
  @name ||= "main"
48
+ @brand ||= "test"
49
+ @model ||= "test"
50
+ @battery ||= "100"
47
51
  if self.cruby?
48
52
  @libs ||= FileList[File.join(root_path, 'lib/**/*.rb')]
49
53
  @tests ||= FileList[File.join(root_path, 'test/**/*test.rb')]
@@ -77,6 +77,10 @@ class Device
77
77
  adapter.disconnect
78
78
  end
79
79
 
80
+ def self.sim_id
81
+ adapter.sim_id
82
+ end
83
+
80
84
  # Check signal value
81
85
  #
82
86
  # @return [Fixnum] Signal value between 0 and 5.
@@ -12,10 +12,12 @@ class Device
12
12
  # @param json [String] Parameters to confifure new aplication.
13
13
  # @return [Object] From the new runtime instance.
14
14
  def self.execute(app, json = nil)
15
- zip = "./#{app}.zip"
16
- Device::Display.clear
17
- raise File::FileError, zip unless File.exists?(zip)
18
- raise "Problem to unzip #{zip}" unless Zip.uncompress(zip, app)
15
+ unless app.include?(".")
16
+ zip = "./#{app}.zip"
17
+ Device::Display.clear
18
+ raise File::FileError, zip unless File.exists?(zip)
19
+ raise "Problem to unzip #{zip}" unless Zip.uncompress(zip, app)
20
+ end
19
21
  return mrb_eval "Context.start('#{app}', '#{Device.adapter}', '#{json}')"
20
22
  end
21
23
  end
@@ -14,6 +14,9 @@ class Device
14
14
  "user" => "",
15
15
  "password" => "", #WIFI
16
16
  "apn" => "",
17
+ "sim_pim" => "",
18
+ "sim_slot" => "0",
19
+ "sim_dual" => "0",
17
20
  "authentication" => "", #WIFI
18
21
  "essid" => "", #WIFI
19
22
  "bssid" => "", #WIFI
@@ -26,17 +29,25 @@ class Device
26
29
  "dns1" => "",
27
30
  "dns2" => "",
28
31
  "subnet" => "",
32
+ "phone" => "",
33
+ "modem_speed" => "",
29
34
  "logical_number" => "",
30
35
  "network_configured" => "",
36
+ "touchscreen" => "",
31
37
  "environment" => "",
38
+ "attach_gprs_timeout" => "",
39
+ "attach_tries" => "",
32
40
  "notification_socket_timeout" => "", # Period to create fiber
33
41
  "notification_timeout" => "", # Time to wait message to read
34
42
  "notification_interval" => "", # Check interval
35
43
  "notification_stream_timeout" => "", # Time to wait stream message to read
36
44
  "cw_switch_version" => "",
37
45
  "cw_pos_timezone" => "",
38
- "uclreceivetimeout" => "0",
46
+ "tcp_recv_timeout" => "0",
39
47
  "iso8583_recv_tries" => "0",
48
+ "iso8583_send_tries" => "0",
49
+ "crypto_dukpt_slot" => "",
50
+ "ctls" => "",
40
51
  "company_name" => ""
41
52
  }
42
53
 
data/lib/device/system.rb CHANGED
@@ -61,6 +61,14 @@ class Device
61
61
  def self.model
62
62
  adapter.model
63
63
  end
64
+
65
+ def self.brand
66
+ adapter.brand
67
+ end
68
+
69
+ def self.versions
70
+ adapter.versions
71
+ end
64
72
  end
65
73
  end
66
74
 
@@ -1,6 +1,6 @@
1
1
 
2
2
  class Device
3
- API_VERSION="0.5.1"
3
+ API_VERSION="0.5.3"
4
4
 
5
5
  def self.api_version
6
6
  Device::API_VERSION
data/lib/file_db.rb CHANGED
@@ -21,8 +21,8 @@ class FileDb
21
21
  text.split("\n").compact.each do |line|
22
22
  key_value = line.split("=")
23
23
  key, value = sanitize(key_value[0]), sanitize(key_value[1])
24
- if key_value[1] && (@hash[key].nil? || @hash[key].empty?)
25
- @hash[key] = value
24
+ if @hash[key].nil? || @hash[key].empty?
25
+ @hash[key] = value.to_s
26
26
  end
27
27
  end
28
28
  end
@@ -36,8 +36,10 @@ class FileDb
36
36
  end
37
37
 
38
38
  def []=(key, value)
39
+ value = value.to_s
40
+ old = @hash[key]
39
41
  ret = @hash[key] = value
40
- save
42
+ save if old != value
41
43
  ret
42
44
  end
43
45
 
data/lib/zip.rb CHANGED
@@ -13,13 +13,12 @@ module Zip
13
13
  # TODO Refactor file check
14
14
  if Dir.exist?(dir)
15
15
  files = Dir.entries(dir)
16
- if (files.size > 2)
17
- files[2..-1].each do |file|
18
- if File.file?("#{dir}/#{file}")
19
- File.delete("#{dir}/#{file}")
20
- else
21
- Dir.delete("#{dir}/#{file}")
22
- end
16
+ files.each do |file|
17
+ next if (file == ".." || file == ".")
18
+ if File.file?("#{dir}/#{file}")
19
+ File.delete("#{dir}/#{file}")
20
+ else
21
+ Dir.delete("#{dir}/#{file}")
23
22
  end
24
23
  end
25
24
  Dir.delete(dir)
@@ -5,17 +5,17 @@ class NotificationTest < DaFunk::Test.case
5
5
  end
6
6
 
7
7
  def test_interval_last_check_blank
8
- assert @notification.valid_interval?
8
+ assert @notification.valid_check_interval?
9
9
  end
10
10
 
11
11
  def test_interval_expired
12
12
  @notification.instance_eval { @last_check = (Time.now - 11) }
13
- assert @notification.valid_interval?
13
+ assert @notification.valid_check_interval?
14
14
  end
15
15
 
16
16
  def test_interval_not_expired
17
17
  @notification.instance_eval { @last_check = Time.now }
18
- assert_equal false, @notification.valid_interval?
18
+ assert_equal false, @notification.valid_check_interval?
19
19
  end
20
20
  end
21
21
 
@@ -8,9 +8,7 @@ class CommandLinePlatform
8
8
  IO = ::IO
9
9
 
10
10
  def self.setup
11
- Device::System.klass = DaFunk::Test.name
12
- Device::Setting.logical_number = DaFunk::Test.logical_number
13
- CommandLinePlatform::System.serial = DaFunk::Test.serial
11
+ set_system_values
14
12
  CommandLinePlatform::Display.standard_output = STDOUT
15
13
  Screen.setup(21, 20)
16
14
  begin
@@ -21,6 +19,15 @@ class CommandLinePlatform
21
19
  end
22
20
  end
23
21
 
22
+ def self.set_system_values
23
+ Device::System.klass = DaFunk::Test.name
24
+ Device::Setting.logical_number = DaFunk::Test.logical_number
25
+ CommandLinePlatform::System.serial = DaFunk::Test.serial
26
+ CommandLinePlatform::System.brand = DaFunk::Test.brand
27
+ CommandLinePlatform::System.model = DaFunk::Test.model
28
+ CommandLinePlatform::System.battery = DaFunk::Test.battery
29
+ end
30
+
24
31
  class IO
25
32
  def self.get_string(min, max, option = nil)
26
33
  str = ""
@@ -67,16 +74,33 @@ class CommandLinePlatform
67
74
  def self.connected?
68
75
  1
69
76
  end
77
+
78
+ def self.signal
79
+ "0"
80
+ end
81
+
82
+ def self.sim_id
83
+ ""
84
+ end
70
85
  end
71
86
 
72
87
  class System
73
88
  class << self
74
- attr_accessor :serial
89
+ attr_accessor :serial, :brand, :model, :battery, :battery
75
90
  end
76
91
 
77
92
  def self.restart
78
93
  puts "Restart terminal!"
79
94
  end
95
+
96
+ def self.versions
97
+ {
98
+ "OS" => Device.version,
99
+ "SDK" => Device.api_version,
100
+ "EMV" => "0.0.1",
101
+ "Pinpad" => "0.0.1"
102
+ }
103
+ end
80
104
  end
81
105
 
82
106
  def self.version
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: 0.5.1
4
+ version: 0.5.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Thiago Scalone
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-12-16 00:00:00.000000000 Z
11
+ date: 2016-01-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake