ruby-macrodroid 0.8.11 → 0.9.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 +4 -4
- checksums.yaml.gz.sig +0 -0
- data.tar.gz.sig +0 -0
- data/lib/ruby-macrodroid.rb +16 -330
- data/lib/ruby-macrodroid/actions.rb +199 -35
- data/lib/ruby-macrodroid/base.rb +21 -15
- data/lib/ruby-macrodroid/constraints.rb +1338 -0
- data/lib/ruby-macrodroid/macro.rb +528 -47
- data/lib/ruby-macrodroid/triggers.rb +46 -14
- metadata +11 -10
- metadata.gz.sig +0 -0
@@ -416,19 +416,39 @@ end
|
|
416
416
|
#
|
417
417
|
class WebHookTrigger < Trigger
|
418
418
|
|
419
|
-
def initialize(
|
419
|
+
def initialize(obj={})
|
420
|
+
|
421
|
+
h = if obj.is_a? Hash then
|
422
|
+
obj
|
423
|
+
elsif obj.is_a? Array
|
424
|
+
|
425
|
+
e, macro = obj
|
426
|
+
txt = e.text('item/description')
|
427
|
+
|
428
|
+
h2 = if txt then
|
429
|
+
{url: (txt || e.text)}
|
430
|
+
else
|
431
|
+
a = e.xpath('item/*')
|
432
|
+
a.map {|node| [node.name.to_sym, node.text.to_s]}.to_h
|
433
|
+
end
|
434
|
+
|
435
|
+
h2.merge(macro: macro)
|
436
|
+
end
|
437
|
+
|
438
|
+
if h[:url] then
|
439
|
+
h[:identifier] = h[:url]\
|
440
|
+
[/https:\/\/trigger.macrodroid.com\/(?:\w+\-){4}\w+\/([^$]+)/,1]
|
441
|
+
elsif h[:identifier].nil? or h[:identifier].empty? then
|
442
|
+
h[:identifier] = h[:macro].title.downcase.gsub(/ +/,'-')
|
443
|
+
end
|
420
444
|
|
421
445
|
options = {
|
422
446
|
identifier: ''
|
423
447
|
}
|
424
|
-
@deviceid = h[:macro].deviceid
|
425
|
-
|
426
|
-
|
427
|
-
if h[:identifier].nil? or h[:identifier].empty? then
|
428
|
-
h[:identifier] = h[:macro].title.downcase
|
429
|
-
end
|
430
448
|
|
431
|
-
|
449
|
+
@deviceid = h[:macro].deviceid
|
450
|
+
|
451
|
+
super(options.merge filter(options,h))
|
432
452
|
@list << 'identifier'
|
433
453
|
|
434
454
|
end
|
@@ -1379,8 +1399,21 @@ end
|
|
1379
1399
|
#
|
1380
1400
|
class ProximityTrigger < SensorsTrigger
|
1381
1401
|
|
1382
|
-
def initialize(
|
1402
|
+
def initialize(obj=nil)
|
1383
1403
|
|
1404
|
+
h = if obj.is_a? Hash then
|
1405
|
+
obj
|
1406
|
+
elsif obj.is_a? Array
|
1407
|
+
e, macro = obj
|
1408
|
+
txt = e.text('item/description')
|
1409
|
+
{option: (txt || e.text), macro: macro}
|
1410
|
+
end
|
1411
|
+
|
1412
|
+
options = {
|
1413
|
+
near: true,
|
1414
|
+
selected_option: 0
|
1415
|
+
}
|
1416
|
+
|
1384
1417
|
if h[:distance] then
|
1385
1418
|
|
1386
1419
|
case h[:distance].to_sym
|
@@ -1389,15 +1422,14 @@ class ProximityTrigger < SensorsTrigger
|
|
1389
1422
|
end
|
1390
1423
|
end
|
1391
1424
|
|
1392
|
-
options = {
|
1393
|
-
near: true,
|
1394
|
-
selected_option: 0
|
1395
|
-
}
|
1396
|
-
|
1397
1425
|
super(options.merge h)
|
1398
1426
|
|
1399
1427
|
end
|
1400
1428
|
|
1429
|
+
def match?(detail={}, model=nil)
|
1430
|
+
@h[:selected_option] == detail[:option].to_i
|
1431
|
+
end
|
1432
|
+
|
1401
1433
|
def to_s(colour: false)
|
1402
1434
|
|
1403
1435
|
distance = if @h[:near] then
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ruby-macrodroid
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.9.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- James Robertson
|
@@ -35,7 +35,7 @@ cert_chain:
|
|
35
35
|
NZ2kdBIUDnAM24e0/wXdVxg4HnsZbdymxyzMQ4P5pKYcpI6oisBxI37p/Xy+wAg3
|
36
36
|
SBHno3GEuuD8ZWj24IMJpfbp
|
37
37
|
-----END CERTIFICATE-----
|
38
|
-
date: 2020-
|
38
|
+
date: 2020-10-08 00:00:00.000000000 Z
|
39
39
|
dependencies:
|
40
40
|
- !ruby/object:Gem::Dependency
|
41
41
|
name: glw
|
@@ -81,22 +81,22 @@ dependencies:
|
|
81
81
|
name: rowx
|
82
82
|
requirement: !ruby/object:Gem::Requirement
|
83
83
|
requirements:
|
84
|
-
- - ">="
|
85
|
-
- !ruby/object:Gem::Version
|
86
|
-
version: 0.7.0
|
87
84
|
- - "~>"
|
88
85
|
- !ruby/object:Gem::Version
|
89
86
|
version: '0.7'
|
87
|
+
- - ">="
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: 0.7.3
|
90
90
|
type: :runtime
|
91
91
|
prerelease: false
|
92
92
|
version_requirements: !ruby/object:Gem::Requirement
|
93
93
|
requirements:
|
94
|
-
- - ">="
|
95
|
-
- !ruby/object:Gem::Version
|
96
|
-
version: 0.7.0
|
97
94
|
- - "~>"
|
98
95
|
- !ruby/object:Gem::Version
|
99
96
|
version: '0.7'
|
97
|
+
- - ">="
|
98
|
+
- !ruby/object:Gem::Version
|
99
|
+
version: 0.7.3
|
100
100
|
- !ruby/object:Gem::Dependency
|
101
101
|
name: subunit
|
102
102
|
requirement: !ruby/object:Gem::Requirement
|
@@ -146,7 +146,7 @@ dependencies:
|
|
146
146
|
version: '1.1'
|
147
147
|
- - ">="
|
148
148
|
- !ruby/object:Gem::Version
|
149
|
-
version: 1.1.
|
149
|
+
version: 1.1.3
|
150
150
|
type: :runtime
|
151
151
|
prerelease: false
|
152
152
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -156,7 +156,7 @@ dependencies:
|
|
156
156
|
version: '1.1'
|
157
157
|
- - ">="
|
158
158
|
- !ruby/object:Gem::Version
|
159
|
-
version: 1.1.
|
159
|
+
version: 1.1.3
|
160
160
|
- !ruby/object:Gem::Dependency
|
161
161
|
name: chronic_cron
|
162
162
|
requirement: !ruby/object:Gem::Requirement
|
@@ -186,6 +186,7 @@ files:
|
|
186
186
|
- lib/ruby-macrodroid.rb
|
187
187
|
- lib/ruby-macrodroid/actions.rb
|
188
188
|
- lib/ruby-macrodroid/base.rb
|
189
|
+
- lib/ruby-macrodroid/constraints.rb
|
189
190
|
- lib/ruby-macrodroid/macro.rb
|
190
191
|
- lib/ruby-macrodroid/triggers.rb
|
191
192
|
homepage: https://github.com/jrobertson/ruby-macrodroid
|
metadata.gz.sig
CHANGED
Binary file
|