ruby-miradore 4.4.0 → 4.4.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: 6970f265b7922dee506ea4625614c650157fa9c1205d3e411e5e70811a0f626a
4
- data.tar.gz: 31aaa50424e7d70b8e3c58349bb3a9e0954ad27441a6f7cf2f8381f851e23d3a
3
+ metadata.gz: 7fa7bea04e363a3b0d7b478a83273c750f7e8b51d1accdc9bfc6f2e6a2363bed
4
+ data.tar.gz: 1ff8e591ee1e65adb8cb7e29e34be5a376ef179b0cebe699b5ea68c42d2125a9
5
5
  SHA512:
6
- metadata.gz: 20d16bf2aa88223b73c7964d6419407b505b7d39a1af4eca02670b06a0a893768ade53003e151453a4b1a05feaae16dbc3e9078957efeedc9dfc6d98fe215493
7
- data.tar.gz: 60d40d8faedfb94a2c8121edd0b2ec86865e17467e66736007a16e9ecaa08345d45f867aff2968e91cd3bd9509c7cf72147e219576ff21d77337e29e194eaf34
6
+ metadata.gz: fae95e829257c215c9c115cf292bca0a11b1adb64f7c84079d23912cc1115a0744bf1695eab937129595217e3b949b6752170dba8300e1fe3cb391a1fdb1cd0c
7
+ data.tar.gz: ae53294cb3b31b5c70db09e6545c946a36baa0476cb1e2a00a169c8acf04bc96353eefb7ba54462c4bbd28705dff349b7f07ff778143b13744a0beb63086dc4e
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- ruby-miradore (4.4.1)
4
+ ruby-miradore (4.4.2)
5
5
  activesupport (~> 7.0)
6
6
  builder (~> 3.1)
7
7
  crack (~> 0.4)
@@ -23,7 +23,7 @@ GEM
23
23
  public_suffix (>= 2.0.2, < 6.0)
24
24
  ast (2.4.2)
25
25
  builder (3.2.4)
26
- concurrent-ruby (1.2.0)
26
+ concurrent-ruby (1.2.2)
27
27
  crack (0.4.5)
28
28
  rexml
29
29
  diff-lcs (1.5.0)
@@ -36,10 +36,10 @@ GEM
36
36
  concurrent-ruby (~> 1.0)
37
37
  json (2.6.3)
38
38
  mini_mime (1.1.2)
39
- minitest (5.17.0)
39
+ minitest (5.18.0)
40
40
  multi_xml (0.6.0)
41
41
  parallel (1.22.1)
42
- parser (3.2.1.0)
42
+ parser (3.2.1.1)
43
43
  ast (~> 2.4.1)
44
44
  public_suffix (5.0.1)
45
45
  rainbow (3.1.1)
@@ -59,19 +59,19 @@ GEM
59
59
  diff-lcs (>= 1.2.0, < 2.0)
60
60
  rspec-support (~> 3.12.0)
61
61
  rspec-support (3.12.0)
62
- rubocop (1.45.1)
62
+ rubocop (1.48.0)
63
63
  json (~> 2.3)
64
64
  parallel (~> 1.10)
65
65
  parser (>= 3.2.0.0)
66
66
  rainbow (>= 2.2.2, < 4.0)
67
67
  regexp_parser (>= 1.8, < 3.0)
68
68
  rexml (>= 3.2.5, < 4.0)
69
- rubocop-ast (>= 1.24.1, < 2.0)
69
+ rubocop-ast (>= 1.26.0, < 2.0)
70
70
  ruby-progressbar (~> 1.7)
71
71
  unicode-display_width (>= 2.4.0, < 3.0)
72
- rubocop-ast (1.26.0)
72
+ rubocop-ast (1.27.0)
73
73
  parser (>= 3.2.1.0)
74
- ruby-progressbar (1.11.0)
74
+ ruby-progressbar (1.13.0)
75
75
  tzinfo (2.0.6)
76
76
  concurrent-ruby (~> 1.0)
77
77
  unicode-display_width (2.4.2)
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Ruby
4
4
  module Miradore
5
- VERSION = "4.4.0"
5
+ VERSION = '4.4.2'
6
6
  end
7
7
  end
data/lib/ruby/miradore.rb CHANGED
@@ -16,7 +16,18 @@ module Ruby
16
16
  v1: 'https://%<subdomain>s.online.miradore.com/API/%<item>s/%<id>s?auth=%<auth>s&select=*,%<attribute>s&filters=%<filter>s&options=%<options>s',
17
17
  v2: 'https://%<subdomain>s.online.miradore.com/API/v2/Device/%<id>s/%<method>s'
18
18
  }
19
+ mattr_accessor :select_attributes, default: '*'
19
20
  mattr_accessor :phone_types, default: %w[Android iOS WindowsPhone]
21
+ mattr_accessor :commands, default: {
22
+ mobile: {
23
+ lostmode: {
24
+ message: 'This device has been reported as lost and its location has been identified, please return before authorities arrive.',
25
+ phoneNumber: '',
26
+ footnote: 'Contact Support team to unlock.',
27
+ enableLocationTracking: true
28
+ }
29
+ }
30
+ }
20
31
 
21
32
  # Setup data from initializer
22
33
  def self.setup
@@ -71,7 +82,7 @@ module Ruby
71
82
  auth: args.fetch(:auth, @auth),
72
83
  id: args.fetch(:id, nil),
73
84
  item: self.class.to_s.split('::').last,
74
- attribute: args.fetch(:attribute, '*'),
85
+ attribute: args.fetch(:attribute, Miradore.select_attributes),
75
86
  filter: args.fetch(:filter, nil),
76
87
  options: args.fetch(:options, nil)&.to_query&.sub('&', ',')
77
88
  )
@@ -89,7 +100,7 @@ module Ruby
89
100
  end
90
101
  self.class.new(args.merge(res.values.first&.transform_keys(&:downcase)))
91
102
  rescue StandardError
92
- { error: "#{self.class.to_s.split("::").last}(s) not found", status: :not_found }
103
+ { error: "#{self.class.to_s.split('::').last}(s) not found", status: :not_found }
93
104
  end
94
105
 
95
106
  end
@@ -109,8 +120,8 @@ module Ruby
109
120
  end
110
121
 
111
122
  def lostmode(args = {})
112
- if args[0]
113
- http_method(args.merge(method: :post, id: id, action: __method__))
123
+ if args.fetch(:enable, false)
124
+ http_method(args.merge(method: :post, id: id, action: __method__, body: Miradore.commands[:mobile][:lostmode]))
114
125
  else
115
126
  http_method(args.merge(method: :delete, id: id, action: __method__))
116
127
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ruby-miradore
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.4.0
4
+ version: 4.4.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Eduard Garcia Castelló
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2023-02-21 00:00:00.000000000 Z
11
+ date: 2023-03-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport