ruby-macrodroid 0.8.8 → 0.9.0

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.
@@ -58,9 +58,9 @@ class Trigger < MacroObject
58
58
  @s ||= "#<%s %s>" % [self.class, h.inspect]
59
59
  operator = @h[:is_or_condition] ? 'OR' : 'AND'
60
60
  constraints = @constraints.map \
61
- {|x| x.to_summary(colour: colour, indent: 1)}.join(" %s " % operator)
61
+ {|x| 'c: ' + x.to_summary(colour: colour, indent: 1)}.join(" %s " % operator)
62
62
 
63
- @constraints.any? ? @s + "\n " + constraints : @s
63
+ @constraints.any? ? @s + "\n" + constraints : @s
64
64
 
65
65
  end
66
66
 
@@ -416,20 +416,41 @@ end
416
416
  #
417
417
  class WebHookTrigger < Trigger
418
418
 
419
- def initialize(h={})
419
+ def initialize(obj={})
420
+
421
+ h = if obj.is_a? Hash then
422
+ obj
423
+ elsif obj.is_a? Array
424
+ e, macro = obj
425
+ txt = e.text('item/description')
426
+ {url: (txt || e.text), macro: macro}
427
+ end
428
+
429
+ if h[:url] then
430
+ h[:identifier] = h[:url][/https:\/\/trigger.macrodroid.com\/(?:\w+\-){4}\w+\/([^$]+)/,1]
431
+ end
432
+
420
433
 
421
434
  options = {
422
435
  identifier: ''
423
436
  }
437
+
438
+ @deviceid = h[:macro].deviceid
424
439
 
425
- super(options.merge h)
440
+
441
+ if h[:identifier].nil? or h[:identifier].empty? then
442
+ h[:identifier] = h[:macro].title.downcase.gsub(/ +/,'-')
443
+ end
444
+
445
+ super(options.merge filter(options,h))
446
+ @list << 'identifier'
426
447
 
427
448
  end
428
449
 
429
450
  def to_s(colour: false)
430
451
 
431
452
  url = "https://trigger.macrodroid.com/%s/%s" % \
432
- [@h[:macro].deviceid, @h[:identifier]]
453
+ [@deviceid, @h[:identifier]]
433
454
  @s = 'WebHook (Url)' + "\n " + url
434
455
  super()
435
456
 
@@ -1152,7 +1173,7 @@ class NotificationTrigger < DeviceEventsTrigger
1152
1173
 
1153
1174
  def to_s(colour: false)
1154
1175
  s = (@h[:package_name_list] + @h[:application_name_list]).uniq.join(', ')
1155
- 'Notification Received ' + "\n Any Content (%s)" % s
1176
+ 'Notification Received ' + "\n Any Content (%s)" % s
1156
1177
  end
1157
1178
 
1158
1179
  alias to_summary to_s
@@ -1427,6 +1448,10 @@ class ShakeDeviceTrigger < SensorsTrigger
1427
1448
  def to_s(colour: false)
1428
1449
  'Shake Device'
1429
1450
  end
1451
+
1452
+ def to_summary(colour: false)
1453
+ 'Shake Device'
1454
+ end
1430
1455
 
1431
1456
  end
1432
1457
 
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.8.8
4
+ version: 0.9.0
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-21 00:00:00.000000000 Z
38
+ date: 2020-10-02 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.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.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,8 @@ 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
190
+ - lib/ruby-macrodroid/macro.rb
189
191
  - lib/ruby-macrodroid/triggers.rb
190
192
  homepage: https://github.com/jrobertson/ruby-macrodroid
191
193
  licenses:
metadata.gz.sig CHANGED
Binary file