dji_mqtt_connect 0.1.25.1 → 0.1.25.2

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
  SHA256:
3
- metadata.gz: 641f953b267980d632c395423af50f45b219cc14908f186a5ca43bd6208177f0
4
- data.tar.gz: e9eddfd13a0671236148ed29f233dbbb543eba76ab5c1257c4b000c93936890e
3
+ metadata.gz: f5ebb4aa93615a5f9bf4b1fd5e4940124097e5e39be3da6689811cdd901279e4
4
+ data.tar.gz: d01e12d6cffd21964e6d1b0318a788d9bb97c096c84349847020ee04743fc2d1
5
5
  SHA512:
6
- metadata.gz: 73d4491a720405a71d983068ae6f509e5983713a962dfe32fab9d6a8b7ab4740431f3d3806154da7937193440c77835176a0a621ec702188bea59313ea313511
7
- data.tar.gz: 67bfb358102f7622252433cb488afc31b080957710ba96aaafae865e0d696c8a7befd2ad22bacfaa2edbf7d50b3e4814bf989a5a4bb4c1cf2a01337734068b95
6
+ metadata.gz: f57cb155efddf6819381c5d23694f8fc620efdfdc4d565eb38ab373207745f7cf18fc646005738e1ff19a14e48e68f7d064496729f10decfa20c3dcf82901e87
7
+ data.tar.gz: f9acf914b4d687195233b267b22b6ef341988e19bb2f50bdfca62b8289cfae0ed3f1705ddbf16bf3d44213d611f2a34a96c553110220e9aa1402260c44dbadea
data/.rubocop/rspec.yml CHANGED
@@ -1,4 +1,6 @@
1
1
  require:
2
+ - rubocop-capybara
3
+ - rubocop-factory_bot
2
4
  - rubocop-rspec
3
5
 
4
6
  # Disable all cops by default,
data/Gemfile CHANGED
@@ -14,7 +14,8 @@ gem "rspec", "~> 3.0"
14
14
  gem "rubocop", "~> 1.21"
15
15
 
16
16
  gem "rubocop-rake"
17
-
17
+ gem "rubocop-capybara"
18
+ gem "rubocop-factory_bot"
18
19
  gem "rubocop-rspec"
19
20
 
20
21
  gem "simplecov", require: false
data/Gemfile.lock CHANGED
@@ -1,53 +1,59 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- dji_mqtt_connect (0.1.25.1)
4
+ dji_mqtt_connect (0.1.25.2)
5
5
  activesupport (>= 6.0, <= 8)
6
- dry-struct (~> 1.6)
6
+ dry-struct (~> 1.7)
7
7
  dry-transformer (~> 1.0)
8
+ json (~> 2.10)
8
9
  mqtt (~> 0.6.0)
9
10
  wisper (~> 2.0)
10
11
 
11
12
  GEM
12
13
  remote: https://rubygems.org/
13
14
  specs:
14
- activejob (7.1.3.2)
15
- activesupport (= 7.1.3.2)
15
+ activejob (7.2.2.1)
16
+ activesupport (= 7.2.2.1)
16
17
  globalid (>= 0.3.6)
17
- activesupport (7.1.3.2)
18
+ activesupport (7.2.2.1)
18
19
  base64
20
+ benchmark (>= 0.3)
19
21
  bigdecimal
20
- concurrent-ruby (~> 1.0, >= 1.0.2)
22
+ concurrent-ruby (~> 1.0, >= 1.3.1)
21
23
  connection_pool (>= 2.2.5)
22
24
  drb
23
25
  i18n (>= 1.6, < 2)
26
+ logger (>= 1.4.2)
24
27
  minitest (>= 5.1)
25
- mutex_m
26
- tzinfo (~> 2.0)
28
+ securerandom (>= 0.3)
29
+ tzinfo (~> 2.0, >= 2.0.5)
27
30
  ast (2.4.2)
28
31
  base64 (0.2.0)
29
- bigdecimal (3.1.7)
30
- concurrent-ruby (1.2.3)
31
- connection_pool (2.4.1)
32
+ benchmark (0.4.0)
33
+ bigdecimal (3.1.9)
34
+ concurrent-ruby (1.3.5)
35
+ connection_pool (2.5.0)
32
36
  diff-lcs (1.5.1)
33
- docile (1.4.0)
37
+ docile (1.4.1)
34
38
  drb (2.2.1)
35
- dry-core (1.0.1)
39
+ dry-core (1.1.0)
36
40
  concurrent-ruby (~> 1.0)
41
+ logger
37
42
  zeitwerk (~> 2.6)
38
- dry-inflector (1.0.0)
39
- dry-logic (1.5.0)
43
+ dry-inflector (1.2.0)
44
+ dry-logic (1.6.0)
45
+ bigdecimal
40
46
  concurrent-ruby (~> 1.0)
41
- dry-core (~> 1.0, < 2)
47
+ dry-core (~> 1.1)
42
48
  zeitwerk (~> 2.6)
43
- dry-struct (1.6.0)
44
- dry-core (~> 1.0, < 2)
45
- dry-types (>= 1.7, < 2)
49
+ dry-struct (1.7.1)
50
+ dry-core (~> 1.1)
51
+ dry-types (~> 1.8, >= 1.8.2)
46
52
  ice_nine (~> 0.11)
47
53
  zeitwerk (~> 2.6)
48
54
  dry-transformer (1.0.1)
49
55
  zeitwerk (~> 2.6)
50
- dry-types (1.7.2)
56
+ dry-types (1.8.2)
51
57
  bigdecimal (~> 3.0)
52
58
  concurrent-ruby (~> 1.0)
53
59
  dry-core (~> 1.0)
@@ -56,91 +62,87 @@ GEM
56
62
  zeitwerk (~> 2.6)
57
63
  globalid (1.2.1)
58
64
  activesupport (>= 6.1)
59
- i18n (1.14.4)
65
+ i18n (1.14.7)
60
66
  concurrent-ruby (~> 1.0)
61
67
  ice_nine (0.11.2)
62
- json (2.7.2)
63
- language_server-protocol (3.17.0.3)
68
+ json (2.10.1)
69
+ language_server-protocol (3.17.0.4)
64
70
  lint_roller (1.1.0)
65
- minitest (5.22.3)
71
+ logger (1.6.5)
72
+ minitest (5.25.4)
66
73
  mqtt (0.6.0)
67
- mutex_m (0.2.0)
68
- parallel (1.24.0)
69
- parser (3.3.0.5)
74
+ parallel (1.26.3)
75
+ parser (3.3.7.1)
70
76
  ast (~> 2.4.1)
71
77
  racc
72
- racc (1.7.3)
78
+ racc (1.8.1)
73
79
  rainbow (3.1.1)
74
80
  rake (13.2.1)
75
- regexp_parser (2.9.0)
76
- rexml (3.2.6)
81
+ regexp_parser (2.10.0)
77
82
  rspec (3.13.0)
78
83
  rspec-core (~> 3.13.0)
79
84
  rspec-expectations (~> 3.13.0)
80
85
  rspec-mocks (~> 3.13.0)
81
- rspec-core (3.13.0)
86
+ rspec-core (3.13.3)
82
87
  rspec-support (~> 3.13.0)
83
- rspec-expectations (3.13.0)
88
+ rspec-expectations (3.13.3)
84
89
  diff-lcs (>= 1.2.0, < 2.0)
85
90
  rspec-support (~> 3.13.0)
86
- rspec-mocks (3.13.0)
91
+ rspec-mocks (3.13.2)
87
92
  diff-lcs (>= 1.2.0, < 2.0)
88
93
  rspec-support (~> 3.13.0)
89
- rspec-support (3.13.1)
90
- rubocop (1.62.1)
94
+ rspec-support (3.13.2)
95
+ rubocop (1.71.2)
91
96
  json (~> 2.3)
92
97
  language_server-protocol (>= 3.17.0)
93
98
  parallel (~> 1.10)
94
99
  parser (>= 3.3.0.2)
95
100
  rainbow (>= 2.2.2, < 4.0)
96
- regexp_parser (>= 1.8, < 3.0)
97
- rexml (>= 3.2.5, < 4.0)
98
- rubocop-ast (>= 1.31.1, < 2.0)
101
+ regexp_parser (>= 2.9.3, < 3.0)
102
+ rubocop-ast (>= 1.38.0, < 2.0)
99
103
  ruby-progressbar (~> 1.7)
100
- unicode-display_width (>= 2.4.0, < 3.0)
101
- rubocop-ast (1.31.2)
102
- parser (>= 3.3.0.4)
104
+ unicode-display_width (>= 2.4.0, < 4.0)
105
+ rubocop-ast (1.38.0)
106
+ parser (>= 3.3.1.0)
103
107
  rubocop-capybara (2.20.0)
104
108
  rubocop (~> 1.41)
105
109
  rubocop-factory_bot (2.25.1)
106
110
  rubocop (~> 1.41)
107
- rubocop-performance (1.20.2)
111
+ rubocop-performance (1.23.1)
108
112
  rubocop (>= 1.48.1, < 2.0)
109
- rubocop-ast (>= 1.30.0, < 2.0)
113
+ rubocop-ast (>= 1.31.1, < 2.0)
110
114
  rubocop-rake (0.6.0)
111
115
  rubocop (~> 1.0)
112
- rubocop-rspec (2.29.1)
113
- rubocop (~> 1.40)
114
- rubocop-capybara (~> 2.17)
115
- rubocop-factory_bot (~> 2.22)
116
- rubocop-rspec_rails (~> 2.28)
117
- rubocop-rspec_rails (2.28.2)
118
- rubocop (~> 1.40)
116
+ rubocop-rspec (3.4.0)
117
+ rubocop (~> 1.61)
119
118
  ruby-progressbar (1.13.0)
119
+ securerandom (0.4.1)
120
120
  simplecov (0.22.0)
121
121
  docile (~> 1.1)
122
122
  simplecov-html (~> 0.11)
123
123
  simplecov_json_formatter (~> 0.1)
124
- simplecov-html (0.12.3)
124
+ simplecov-html (0.13.1)
125
125
  simplecov_json_formatter (0.1.4)
126
- standard (1.35.1)
126
+ standard (1.45.0)
127
127
  language_server-protocol (~> 3.17.0.2)
128
128
  lint_roller (~> 1.0)
129
- rubocop (~> 1.62.0)
129
+ rubocop (~> 1.71.0)
130
130
  standard-custom (~> 1.0.0)
131
- standard-performance (~> 1.3)
131
+ standard-performance (~> 1.6)
132
132
  standard-custom (1.0.2)
133
133
  lint_roller (~> 1.0)
134
134
  rubocop (~> 1.50)
135
- standard-performance (1.3.1)
135
+ standard-performance (1.6.0)
136
136
  lint_roller (~> 1.1)
137
- rubocop-performance (~> 1.20.2)
137
+ rubocop-performance (~> 1.23.0)
138
138
  tzinfo (2.0.6)
139
139
  concurrent-ruby (~> 1.0)
140
- unicode-display_width (2.5.0)
140
+ unicode-display_width (3.1.4)
141
+ unicode-emoji (~> 4.0, >= 4.0.4)
142
+ unicode-emoji (4.0.4)
141
143
  wisper (2.0.1)
142
144
  wisper-rspec (1.1.0)
143
- zeitwerk (2.6.13)
145
+ zeitwerk (2.7.1)
144
146
 
145
147
  PLATFORMS
146
148
  arm64-darwin-22
@@ -154,6 +156,8 @@ DEPENDENCIES
154
156
  rake (~> 13.0)
155
157
  rspec (~> 3.0)
156
158
  rubocop (~> 1.21)
159
+ rubocop-capybara
160
+ rubocop-factory_bot
157
161
  rubocop-rake
158
162
  rubocop-rspec
159
163
  simplecov
@@ -33,8 +33,10 @@ Gem::Specification.new do |spec|
33
33
  # Use Active Support for inflection and logging
34
34
  spec.add_dependency "activesupport", ">= 6.0", "<= 8"
35
35
 
36
+ spec.add_dependency "json", "~> 2.10"
37
+
36
38
  # Use Dry-rb for valid POROs
37
- spec.add_dependency "dry-struct", "~> 1.6"
39
+ spec.add_dependency "dry-struct", "~> 1.7"
38
40
  spec.add_dependency "dry-transformer", "~> 1.0"
39
41
 
40
42
  # Use MQTT as a client for receiving/sending messages
@@ -20,9 +20,9 @@ module DjiMqttConnect
20
20
  attribute :ext do
21
21
  attribute :flight_id, Types::FlightID
22
22
 
23
- attribute :drone_model_key, Types::String
23
+ attribute :drone_model_key, Types::String | Types::Nil
24
24
 
25
- attribute :payload_model_key, Types::String
25
+ attribute :payload_model_key, Types::String | Types::Nil
26
26
 
27
27
  # {"0":"No","1":"Yes"}
28
28
  attribute :is_original, Types::Bool
@@ -12,7 +12,7 @@ module DjiMqttConnect
12
12
  attribute :organization_id, Types::String | Types::Nil
13
13
  attribute :device_callsign, Types::String | Types::Nil
14
14
  attribute :sn, Types::SerialNumber | Types::Nil
15
- attribute :device_model_key, Types::String
15
+ attribute :device_model_key, Types::String | Types::Nil
16
16
  attribute :device_nonce, Types::String | Types::Nil
17
17
  attribute :device_secret, Types::String | Types::Nil
18
18
 
@@ -97,7 +97,7 @@ module DjiMqttConnect
97
97
  end
98
98
 
99
99
  attribute? :cameras, Types::Array do
100
- attribute :camera_mode, Types::Integer
100
+ attribute? :camera_mode, Types::Integer
101
101
  attribute :liveview_world_region do
102
102
  attribute :bottom, Types::JSON::Decimal
103
103
  attribute :left, Types::JSON::Decimal
@@ -105,34 +105,34 @@ module DjiMqttConnect
105
105
  attribute :top, Types::JSON::Decimal
106
106
  end
107
107
  attribute :payload_index, Types::String
108
- attribute :photo_state, Types::Integer
109
- attribute :record_time, Types::Integer
110
- attribute :recording_state, Types::Integer
111
- attribute :remain_photo_num, Types::Integer
112
- attribute :remain_record_duration, Types::Integer
113
- attribute :wide_calibrate_farthest_focus_value, Types::Integer
114
- attribute :wide_calibrate_nearest_focus_value, Types::Integer
115
- attribute :wide_exposure_mode, Types::Integer
116
- attribute :wide_exposure_value, Types::Integer
117
- attribute :wide_focus_mode, Types::Integer
118
- attribute :wide_focus_state, Types::Integer
119
- attribute :wide_focus_value, Types::Integer
120
- attribute :wide_iso, Types::Integer
121
- attribute :wide_max_focus_value, Types::Integer
122
- attribute :wide_min_focus_value, Types::Integer
123
- attribute :wide_shutter_speed, Types::Integer
124
- attribute :zoom_calibrate_farthest_focus_value, Types::Integer
125
- attribute :zoom_calibrate_nearest_focus_value, Types::Integer
126
- attribute :zoom_exposure_mode, Types::Integer
127
- attribute :zoom_exposure_value, Types::Integer
128
- attribute :zoom_factor, Types::JSON::Decimal
129
- attribute :zoom_focus_mode, Types::Integer
130
- attribute :zoom_focus_state, Types::Integer
131
- attribute :zoom_focus_value, Types::Integer
132
- attribute :zoom_iso, Types::Integer
133
- attribute :zoom_max_focus_value, Types::Integer
134
- attribute :zoom_min_focus_value, Types::Integer
135
- attribute :zoom_shutter_speed, Types::Integer
108
+ attribute? :photo_state, Types::Integer
109
+ attribute? :record_time, Types::Integer
110
+ attribute? :recording_state, Types::Integer
111
+ attribute? :remain_photo_num, Types::Integer
112
+ attribute? :remain_record_duration, Types::Integer
113
+ attribute? :wide_calibrate_farthest_focus_value, Types::Integer
114
+ attribute? :wide_calibrate_nearest_focus_value, Types::Integer
115
+ attribute? :wide_exposure_mode, Types::Integer
116
+ attribute? :wide_exposure_value, Types::Integer
117
+ attribute? :wide_focus_mode, Types::Integer
118
+ attribute? :wide_focus_state, Types::Integer
119
+ attribute? :wide_focus_value, Types::Integer
120
+ attribute? :wide_iso, Types::Integer
121
+ attribute? :wide_max_focus_value, Types::Integer
122
+ attribute? :wide_min_focus_value, Types::Integer
123
+ attribute? :wide_shutter_speed, Types::Integer
124
+ attribute? :zoom_calibrate_farthest_focus_value, Types::Integer
125
+ attribute? :zoom_calibrate_nearest_focus_value, Types::Integer
126
+ attribute? :zoom_exposure_mode, Types::Integer
127
+ attribute? :zoom_exposure_value, Types::Integer
128
+ attribute? :zoom_factor, Types::JSON::Decimal
129
+ attribute? :zoom_focus_mode, Types::Integer
130
+ attribute? :zoom_focus_state, Types::Integer
131
+ attribute? :zoom_focus_value, Types::Integer
132
+ attribute? :zoom_iso, Types::Integer
133
+ attribute? :zoom_max_focus_value, Types::Integer
134
+ attribute? :zoom_min_focus_value, Types::Integer
135
+ attribute? :zoom_shutter_speed, Types::Integer
136
136
  end
137
137
 
138
138
  # Not all messages will have a live_capacity attribute
@@ -175,10 +175,10 @@ module DjiMqttConnect
175
175
  end
176
176
 
177
177
  attribute? :payloads, Types::Array do
178
- attribute :control_source, Types::String
179
- attribute? :firmware_version, Types::String
178
+ attribute :control_source, Types::String | Types::Nil
179
+ attribute? :firmware_version, Types::String | Types::Nil
180
180
  attribute :payload_index, Types::String
181
- attribute? :sn, Types::SerialNumber
181
+ attribute? :sn, Types::SerialNumber | Types::Nil
182
182
  end
183
183
 
184
184
  attribute? :rtcm_info do
@@ -209,7 +209,7 @@ module DjiMqttConnect
209
209
  attribute? :commander_flight_height, Types::Integer
210
210
  attribute? :commander_flight_mode, Types::Integer
211
211
  attribute? :commander_mode_lost_action, Types::Integer
212
- attribute? :control_source, Types::String
212
+ attribute? :control_source, Types::String | Types::Nil
213
213
  attribute? :current_commander_flight_mode, Types::Integer
214
214
  attribute? :current_rth_mode, Types::Integer
215
215
  attribute? :flysafe_database_version, Types::String
@@ -28,6 +28,8 @@ module DjiMqttConnect
28
28
  def build_message(message_class, transformed_message)
29
29
  message_class.new transformed_message
30
30
  rescue Dry::Struct::Error => e
31
+ e = find_deepest_dry_struct_error(e, e)
32
+
31
33
  # Get the source of the error and the error message (without the source)
32
34
  source = e.message.include?(".new] ") ? e.message.split(".new] ").first.sub(/\A\[/, "") : message_class.name
33
35
  error_message = e.message.split(".new] ").last
@@ -39,6 +41,7 @@ module DjiMqttConnect
39
41
  # e.cause.message: nil (NilClass) has invalid type for :_data violates constraints (type?(Hash, nil) failed)
40
42
  cause_key = e.cause.key.to_s.sub("_data", "data")
41
43
  cause_message = "#{e.cause.value.inspect} (#{e.cause.value.class.name}) is invalid type for :#{cause_key}"
44
+
42
45
  # cause_message: nil (NilClass) is invalid type for :data
43
46
  raise ParseError.new(e, "Unexpected #{source} payload (#{cause_message})")
44
47
  else
@@ -46,6 +49,16 @@ module DjiMqttConnect
46
49
  end
47
50
  end
48
51
 
52
+ def find_deepest_dry_struct_error(error, deepest)
53
+ if error.is_a?(Dry::Struct::Error)
54
+ find_deepest_dry_struct_error(error.cause, error)
55
+ elsif error.respond_to?(:cause) && error.cause
56
+ find_deepest_dry_struct_error(error.cause, deepest)
57
+ else
58
+ deepest
59
+ end
60
+ end
61
+
49
62
  def message_class_from_message_method(message_method, generic_class)
50
63
  return generic_class if message_method.blank?
51
64
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module DjiMqttConnect
4
- VERSION = "0.1.25.1"
4
+ VERSION = "0.1.25.2"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dji_mqtt_connect
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.25.1
4
+ version: 0.1.25.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sphere Drones
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2024-10-08 00:00:00.000000000 Z
11
+ date: 2025-02-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -30,20 +30,34 @@ dependencies:
30
30
  - - "<="
31
31
  - !ruby/object:Gem::Version
32
32
  version: '8'
33
+ - !ruby/object:Gem::Dependency
34
+ name: json
35
+ requirement: !ruby/object:Gem::Requirement
36
+ requirements:
37
+ - - "~>"
38
+ - !ruby/object:Gem::Version
39
+ version: '2.10'
40
+ type: :runtime
41
+ prerelease: false
42
+ version_requirements: !ruby/object:Gem::Requirement
43
+ requirements:
44
+ - - "~>"
45
+ - !ruby/object:Gem::Version
46
+ version: '2.10'
33
47
  - !ruby/object:Gem::Dependency
34
48
  name: dry-struct
35
49
  requirement: !ruby/object:Gem::Requirement
36
50
  requirements:
37
51
  - - "~>"
38
52
  - !ruby/object:Gem::Version
39
- version: '1.6'
53
+ version: '1.7'
40
54
  type: :runtime
41
55
  prerelease: false
42
56
  version_requirements: !ruby/object:Gem::Requirement
43
57
  requirements:
44
58
  - - "~>"
45
59
  - !ruby/object:Gem::Version
46
- version: '1.6'
60
+ version: '1.7'
47
61
  - !ruby/object:Gem::Dependency
48
62
  name: dry-transformer
49
63
  requirement: !ruby/object:Gem::Requirement