quelink-mg 0.2.1 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 3ea5c2cf43ce12b5862a854e1cec5cc7149fa196f70cc6de57390d8ba4e4ef0b
4
- data.tar.gz: ced81a168e9b4c4db172bcb205b16a1e4c981cb03ea3a565149b1524487c1c88
3
+ metadata.gz: 0a0af54e62d43bd9f96b5c7484e1d7ba16baf9ff80d059df46f2115c2881d16f
4
+ data.tar.gz: 893631f6758dbbecad9d30105a4b1dc31a39a1b110a7ca964ced515150badba1
5
5
  SHA512:
6
- metadata.gz: c27447f6092dcf66651a7cb7154fe85c8d491ee8945a111dad3f950ec4077f3d231425d468af84ab501ef525dad525b0a55726ec48158909c608a75a986ea4d9
7
- data.tar.gz: 1772f49c7e43a6e2d47eafb541428f88bb1611dc0e7f5782a76d1957a57fff7067daad797d1d5ed9cb99643c250047570c5ae90b1d62ce6007fcd4ec48ba1f78
6
+ metadata.gz: b18949ccbd99be47bce8d7d09c425d5a455992e747cb4f86745ef2291e4d3c6c09c944dcc8f260e654fa9d68df4d2e73b9bca63eecc37d02700e8c19be5dc3e7
7
+ data.tar.gz: 0abbc95935c06ea5de36e285f3b3bb8edae223672d593c336009affdebfb6199929c7d1a655b40a7650a2a0fdcaf8d76ae7116d85372f006049c9ce0f9f6a8ce
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- quelink-mg (0.2.0)
4
+ quelink-mg (0.3.0)
5
5
  activesupport (~> 7.0)
6
6
 
7
7
  GEM
@@ -0,0 +1,9 @@
1
+ # frozen_string_literal: true
2
+
3
+ module QuelinkMg
4
+ module Buff
5
+ class Base < ::QuelinkMg::Resp::Base
6
+ QUELINK_DATE_FORMAT = '%Y%m%d%H%M%S'
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,15 @@
1
+ # frozen_string_literal: true
2
+
3
+ module QuelinkMg
4
+ module Buff
5
+ class Gtfri < Base
6
+ GTFRI_RESP_KEYS = %w[protocol_version unique_id device_name report_id report_type number
7
+ gps_accuracy speed azimuth elevation longitude latitude gps_utc_time
8
+ mcc mnc lac cell_id odo_mileage battery_percentage send_time count_number].freeze
9
+
10
+ def hash
11
+ unify_keys(GTFRI_RESP_KEYS.zip(@response.split(',')).to_h)
12
+ end
13
+ end
14
+ end
15
+ end
data/lib/quelink_mg.rb CHANGED
@@ -34,6 +34,9 @@ require File.expand_path('quelink-mg/ack/gtrto.rb', __dir__)
34
34
  require File.expand_path('quelink-mg/ack/gtsri.rb', __dir__)
35
35
  require File.expand_path('quelink-mg/ack/gtudf.rb', __dir__)
36
36
 
37
+ require File.expand_path('quelink-mg/buff/base.rb', __dir__)
38
+ require File.expand_path('quelink-mg/buff/gtfri.rb', __dir__)
39
+
37
40
  require File.expand_path('quelink-mg/configuration.rb', __dir__)
38
41
 
39
42
  module QuelinkMg
data/pkg/quelink-mg.gem CHANGED
Binary file
data/quelink-mg.gemspec CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = 'quelink-mg'
5
- s.version = '0.2.1'
5
+ s.version = '0.3.0'
6
6
  s.summary = 'Quelink devices command reader and writer'
7
7
  s.description = 'Quelink devices command reader and writer'
8
8
  s.authors = ['Stanislaw Zawadzki']
@@ -0,0 +1,22 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'spec_helper'
4
+
5
+ RSpec.describe QuelinkMg::Buff::Gtfri do
6
+ it 'parses valid response' do
7
+ response = 'C30204,860201061504521,,0,0,1,1,0.0,0,96.2,21.012847,52.200338,20230813061232,\\
8
+ 0260,0003,E31F,0447020D,,34,20230813061231,3E94'
9
+
10
+ parsed_response = described_class.new(response:).hash
11
+ expect(parsed_response).not_to eq({})
12
+ expect(parsed_response['send_time']).to eq Time.use_zone('UTC') { Time.zone.parse('20230813061231') }.in_time_zone
13
+ expect(parsed_response['gps_utc_time']).to eq Time.use_zone('UTC') {
14
+ Time.zone.parse('20230813061232')
15
+ }.in_time_zone
16
+ expect(parsed_response['longitude']).to eq 21.012847
17
+ expect(parsed_response['latitude']).to eq 52.200338
18
+ expect(parsed_response['unique_id']).to eq 860_201_061_504_521
19
+ expect(parsed_response['battery_percentage']).to eq 34
20
+ expect(parsed_response['device_name']).to eq ''
21
+ end
22
+ 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.2.1
4
+ version: 0.3.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-09-10 00:00:00.000000000 Z
11
+ date: 2023-11-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -109,6 +109,8 @@ files:
109
109
  - lib/quelink-mg/at/gtrto.rb
110
110
  - lib/quelink-mg/at/gtsri.rb
111
111
  - lib/quelink-mg/at/gtudf.rb
112
+ - lib/quelink-mg/buff/base.rb
113
+ - lib/quelink-mg/buff/gtfri.rb
112
114
  - lib/quelink-mg/configuration.rb
113
115
  - lib/quelink-mg/resp/base.rb
114
116
  - lib/quelink-mg/resp/gtfri.rb
@@ -136,6 +138,7 @@ files:
136
138
  - spec/quelink_mg/at/gtrto_spec.rb
137
139
  - spec/quelink_mg/at/gtsri_spec.rb
138
140
  - spec/quelink_mg/at/gtudf_spec.rb
141
+ - spec/quelink_mg/buff/gtfri_spec.rb
139
142
  - spec/quelink_mg/resp/gtfri_spec.rb
140
143
  - spec/quelink_mg/resp/gtgsv_spec.rb
141
144
  - spec/quelink_mg/resp/gtinf_spec.rb