quelink-mg 0.3.0 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/quelink-mg/at/base.rb +11 -1
- data/pkg/quelink-mg.gem +0 -0
- data/quelink-mg.gemspec +1 -1
- data/spec/quelink_mg/at/gtcfg_spec.rb +10 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 156a74e9c90ed12d937afba89ed165d4c79f655b81158352aca3138962aeab2c
|
4
|
+
data.tar.gz: 5a3ec61486354ecfd8c359a8cc651b1c94f73eceba33164dedab67abc27ede56
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 873fca115ba479772b24a1f9cafce41112528c8fe5847a190e67a77cfb10e73b6aa4a0e14049178bb5b811be8e9e38d6d43defa0dd41cdb9d5f0313be2202b56
|
7
|
+
data.tar.gz: 15fb64bf910ce1ac9178535af37818f9c2482877db381df655b7412046189d28bb927cde60d8ac7f5839bc4514b2e068ef1532740766886dddbf9baf19d98bad
|
data/lib/quelink-mg/at/base.rb
CHANGED
@@ -19,13 +19,23 @@ module QuelinkMg
|
|
19
19
|
private
|
20
20
|
|
21
21
|
def verify_params(acceptable_values, error)
|
22
|
+
required_values.each do |rv|
|
23
|
+
raise_error(rv, error) if @params.fetch(rv, nil).nil?
|
24
|
+
end
|
25
|
+
|
22
26
|
acceptable_values.each do |k, v|
|
23
|
-
|
27
|
+
value = @params.fetch(k, nil)
|
28
|
+
|
29
|
+
next if value.blank? || v.include?(value)
|
24
30
|
|
25
31
|
raise_error(k, error)
|
26
32
|
end
|
27
33
|
end
|
28
34
|
|
35
|
+
def required_values
|
36
|
+
%i[password serial_number]
|
37
|
+
end
|
38
|
+
|
29
39
|
def raise_error(type, error)
|
30
40
|
raise error, "Wrong #{type}: #{@params}"
|
31
41
|
end
|
data/pkg/quelink-mg.gem
CHANGED
Binary file
|
data/quelink-mg.gemspec
CHANGED
@@ -34,6 +34,16 @@ RSpec.describe QuelinkMg::At::Gtcfg do
|
|
34
34
|
'300,2,0,20491231235959,0,0000,0,10,,,FFFF$'
|
35
35
|
end
|
36
36
|
|
37
|
+
it 'creates message if some params available' do
|
38
|
+
params =
|
39
|
+
{
|
40
|
+
password: 'gl310m',
|
41
|
+
gps_on_need: 1,
|
42
|
+
serial_number: 'FFFF'
|
43
|
+
}
|
44
|
+
expect(described_class.new(params:).message).to eq 'AT+GTCFG=gl310m,,,,,1,,,,,,,,,,,,,,,,,,,FFFF$'
|
45
|
+
end
|
46
|
+
|
37
47
|
it 'raises error on missing params' do
|
38
48
|
expect { described_class.new(params: {}).message }.to raise_error(InvalidATGTCFGException)
|
39
49
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: quelink-mg
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Stanislaw Zawadzki
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-
|
11
|
+
date: 2023-12-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|