ruby-macrodroid 0.7.9 → 0.7.10

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: 1a302b724cde397e0ef27e3461dad14fa0801158692951fdcf013fccfbc0348c
4
- data.tar.gz: b8a041e5185746e5bd2809e98d098cba2ff20534ddcb679f1c342397840a2976
3
+ metadata.gz: 3e6d2bb5ccf9f1caf0c56ba60c4791801dccc28a2be22bfbfc524db01dd553f5
4
+ data.tar.gz: 4d79491e900a308fcc3473ed6d7b96cdf6169e20c7c0c754c08c806cb52c6d34
5
5
  SHA512:
6
- metadata.gz: 5311bafd81b65b5a0371aab705d469bdab0ec5b920b40c4004e8e7758460b06f72f590c7c2f49d7cf9d21c8407debe682d81235b66d8d27224bd3a8786e75a22
7
- data.tar.gz: 27d2d926b5230f6f545d28e59db686edb82708f65d05128ed2fa9e2b3e59375ca14f00dcf72cd99bd8502d7aeb1534077ca9bf71e86e73ad10e62066d1b4dd57
6
+ metadata.gz: c671f4e0473e435f7c5c9f760627464b8bf760367485877d43680225f399c6e7a83d2ac95be8ac4960ce8451d301abe7044e70570f1a7344a3a2bcd7ab529746
7
+ data.tar.gz: 5cbfd7fee603949c495e4af3b315ffb45af15e8810c9ed226305627e47472df6a29c92ce2fed2f824d07d5dbb4b28372fcb420d97b4ea673f8c9a8458dc4ad21
Binary file
data.tar.gz.sig CHANGED
Binary file
@@ -411,12 +411,13 @@ class Macro
411
411
  using ColouredText
412
412
  using Params
413
413
 
414
- attr_reader :local_variables, :triggers, :actions, :constraints, :guid
414
+ attr_reader :local_variables, :triggers, :actions, :constraints,
415
+ :guid, :deviceid
415
416
  attr_accessor :title, :description
416
417
 
417
- def initialize(name=nil, geofences: geofences, debug: false)
418
+ def initialize(name=nil, geofences: geofences, deviceid: nil, debug: false)
418
419
 
419
- @title, @geofences, @debug = name, geofences, debug
420
+ @title, @geofences, @deviceid, @debug = name, geofences, deviceid, debug
420
421
 
421
422
  puts 'inside Macro#initialize' if @debug
422
423
 
@@ -826,10 +827,14 @@ class MacroDroid
826
827
  using Params
827
828
 
828
829
  attr_reader :macros, :geofences, :yaml
830
+ attr_accessor :deviceid
831
+
832
+ # note: The deviceid can only be found from an existing Webhook trigger,
833
+ # generated from MacroDroid itself.
829
834
 
830
- def initialize(obj=nil, debug: false)
835
+ def initialize(obj=nil, deviceid: nil, debug: false)
831
836
 
832
- @debug = debug
837
+ @deviceid, @debug = deviceid, debug
833
838
 
834
839
  @geofences = {}
835
840
 
@@ -1034,7 +1039,8 @@ class MacroDroid
1034
1039
  puts ('macro: ' + macro.inspect).debug if @debug
1035
1040
  # puts '@geofences: ' + @geofences.inspect if @debug
1036
1041
 
1037
- m = Macro.new(geofences: @geofences.map(&:last), debug: @debug )
1042
+ m = Macro.new(geofences: @geofences.map(&:last), deviceid: @deviceid,
1043
+ debug: @debug )
1038
1044
  m.import_h(macro)
1039
1045
  m
1040
1046
 
@@ -1055,7 +1061,8 @@ class MacroDroid
1055
1061
 
1056
1062
  @macros = doc.root.xpath('item').map do |node|
1057
1063
  puts ('geofences: ' + geofences.inspect).highlight if @debug
1058
- Macro.new(geofences: geofences.map(&:last), debug: @debug).import_xml(node)
1064
+ Macro.new(geofences: geofences.map(&:last), deviceid: @deviceid,
1065
+ debug: @debug).import_xml(node)
1059
1066
 
1060
1067
  end
1061
1068
 
@@ -1078,7 +1085,8 @@ class MacroDroid
1078
1085
 
1079
1086
  @macros = doc.root.xpath('macro').map do |node|
1080
1087
 
1081
- Macro.new(geofences: @geofences.map(&:last), debug: @debug).import_xml(node)
1088
+ Macro.new(geofences: @geofences.map(&:last), deviceid: @deviceid,
1089
+ debug: @debug).import_xml(node)
1082
1090
 
1083
1091
  end
1084
1092
  end
@@ -1256,26 +1264,7 @@ class Trigger < MacroObject
1256
1264
  end
1257
1265
 
1258
1266
 
1259
- # Category: Applications
1260
- #
1261
- class WebHookTrigger < Trigger
1262
-
1263
- def initialize(h={})
1264
-
1265
- options = {
1266
- identifier: ''
1267
- }
1268
-
1269
- super(options.merge h)
1270
-
1271
- end
1272
-
1273
- def to_s(colour: false)
1274
- 'WebHookTrigger ' + @h.inspect
1275
- end
1276
1267
 
1277
- alias to_summary to_s
1278
- end
1279
1268
 
1280
1269
  # Category: Applications
1281
1270
  #
@@ -1633,7 +1622,12 @@ class WebHookTrigger < Trigger
1633
1622
  end
1634
1623
 
1635
1624
  def to_s(colour: false)
1636
- 'WebHookTrigger ' + @h.inspect
1625
+
1626
+ url = "https://trigger.macrodroid.com/%s/%s" % \
1627
+ [@h[:macro].deviceid, @h[:identifier]]
1628
+ @s = 'WebHook (Url)' + "\n " + url
1629
+ super()
1630
+
1637
1631
  end
1638
1632
 
1639
1633
  alias to_summary to_s
@@ -2537,7 +2531,7 @@ class ProximityTrigger < SensorsTrigger
2537
2531
  selected_option: 0
2538
2532
  }
2539
2533
 
2540
- super(options.merge filter(options,h))
2534
+ super(options.merge h)
2541
2535
 
2542
2536
  end
2543
2537
 
@@ -2551,6 +2545,8 @@ class ProximityTrigger < SensorsTrigger
2551
2545
 
2552
2546
  "Proximity Sensor (%s)" % distance
2553
2547
  end
2548
+
2549
+ alias to_summary to_s
2554
2550
 
2555
2551
  end
2556
2552
 
@@ -2904,6 +2900,29 @@ class KillBackgroundAppAction < ApplicationAction
2904
2900
  alias to_summary to_s
2905
2901
  end
2906
2902
 
2903
+ # Category: Applications
2904
+ #
2905
+ class LaunchShortcutAction < ApplicationAction
2906
+
2907
+ def initialize(h={})
2908
+
2909
+ options = {
2910
+ :app_name=>"Amazon Alexa", :intent_encoded=>"", :name=>"Ask Alexa"
2911
+ }
2912
+
2913
+ super(options.merge h)
2914
+
2915
+ end
2916
+
2917
+ def to_s(colour: false)
2918
+ @s = "Launch Shortcut: " + @h[:app_name] + "\n " + @h[:name]
2919
+ super()
2920
+ end
2921
+
2922
+ alias to_summary to_s
2923
+
2924
+ end
2925
+
2907
2926
  # Category: Applications
2908
2927
  #
2909
2928
  class OpenWebPageAction < ApplicationAction
@@ -3218,7 +3237,7 @@ class SendIntentAction < ConnectivityAction
3218
3237
  end
3219
3238
 
3220
3239
  def to_s(colour: false)
3221
- 'SendIntentAction ' + @h.inspect
3240
+ 'Send Intent ' + "\n " + @h[:action]
3222
3241
  end
3223
3242
 
3224
3243
  alias to_summary to_s
@@ -4582,7 +4601,7 @@ class KeepAwakeAction < ScreenAction
4582
4601
  Subunit.new(units={minutes:60, hours:60}, seconds: scnds).strfunit("%x")
4583
4602
  end
4584
4603
 
4585
- 'Keep Device Awake ' + screen + ' ' + whenx
4604
+ "Keep Device Awake\n " + screen + ' - ' + whenx
4586
4605
 
4587
4606
  else
4588
4607
  'Disable Keep Awake'
@@ -4904,10 +4923,13 @@ class BluetoothConstraint < Constraint
4904
4923
 
4905
4924
  def to_s(colour: false)
4906
4925
  device = @h[:device_name] #== 'Any Device' ? 'Any' : @h[:device_name]
4907
- "Device Connected (%s)" % device
4926
+ "Device Connected\n %s" % device
4908
4927
  end
4909
4928
 
4910
- alias to_summary to_s
4929
+ def to_summary(colour: false)
4930
+ device = @h[:device_name] #== 'Any Device' ? 'Any' : @h[:device_name]
4931
+ "Device Connected (%s)" % device
4932
+ end
4911
4933
 
4912
4934
  end
4913
4935
 
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.7.9
4
+ version: 0.7.10
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-09-14 00:00:00.000000000 Z
38
+ date: 2020-09-15 00:00:00.000000000 Z
39
39
  dependencies:
40
40
  - !ruby/object:Gem::Dependency
41
41
  name: glw
metadata.gz.sig CHANGED
Binary file