samsung_wam_api 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 8d0db0989cee9505f365c64e2522a3d777faed46
4
- data.tar.gz: 8ebdf3e92ac1634d1ebfe951b0d25e65a3843f4e
3
+ metadata.gz: f3269513202ccfba0aa2025e25909dae3158ec51
4
+ data.tar.gz: 9ed6472b653022bdc287be6eb7db136b2e2309ce
5
5
  SHA512:
6
- metadata.gz: 90fa9295a67cd104b804acf08f55f612fd8761577b91496b485f3bc5b8f9b8a9be96d7df942cea8c67a9806a09a3baa7349b2cbf92e1ba16af48e818349b966b
7
- data.tar.gz: b968b0ced5f438eaab1df7928b3e723ea7a57b7de97a83c2dd6f24b7d432b4b9c8cdb40d600f06b10055eee4935d1b0e4ca7510b65e26bfe5c45a2925e29b076
6
+ metadata.gz: d9f79c1961f90695d6e483adb9cd285e6b255172edf5cd11c5814425dffaec464a3a8bcccfef47ecd4ba8bdcdb61ead698cb91a247bc24c77b25f16e689dafb5
7
+ data.tar.gz: 4915cab5fe132a64664752a1d7bffe919658bcde63335b7994b88adbf1dacde05d687dd0cb2d7e8f798ffcd86d7f5043d67a4977b98132045c78ef8daeb05dda
data/README.md CHANGED
@@ -23,8 +23,17 @@ Or install it yourself as:
23
23
  ```ruby
24
24
  require 'samsung_wam_api'
25
25
  living_room_soundbar = SamsungWamApi::Device.new(ip: 192.168.0.1)
26
- living_room_soundbar.power_on
27
- living_room_soundbat.volume_up
26
+ living_room_soundbar.off? # => true
27
+ living_room_soundbar.on!
28
+ living_room_soundbar.volume # => 15
29
+ living_room_soundbar.increase_volume
30
+ living_room_soundbar.decrease_volume(5) # decrease by 5 instead of default 1
31
+ living_room_soundbar.set_volume(20)
32
+ living_room_soundbar.muted? # => false
33
+ living_room_soundbar.mute!
34
+ living_room_soundbar.unmute!
35
+ living_room_soundbar.toggle_mute!
36
+
28
37
  ```
29
38
 
30
39
  ## Development
@@ -0,0 +1,421 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: http://192.168.22.144:55001/UIC?cmd=UIC?cmd=%3Cname%3EGetMute%3C/name%3E
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ''
9
+ headers:
10
+ Accept-Encoding:
11
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
12
+ Accept:
13
+ - "*/*"
14
+ User-Agent:
15
+ - Ruby
16
+ Host:
17
+ - 192.168.22.144:55001
18
+ response:
19
+ status:
20
+ code: 200
21
+ message: OK
22
+ headers:
23
+ Date:
24
+ - Sun, 21 Jan 2018 18:19:29 GMT
25
+ Server:
26
+ - Samsung/1.0
27
+ Content-Type:
28
+ - text/html
29
+ Content-Length:
30
+ - '219'
31
+ Connection:
32
+ - close
33
+ Last-Modified:
34
+ - Sun, 21 Jan 2018 18:19:29 GMT
35
+ body:
36
+ encoding: UTF-8
37
+ string: <?xml version="1.0" encoding="UTF-8"?><UIC><method>MuteStatus</method><version>1.0</version><speakerip>192.168.22.144</speakerip><user_identifier></user_identifier><response
38
+ result="ok"><mute>off</mute></response></UIC>
39
+ http_version:
40
+ recorded_at: Sun, 21 Jan 2018 18:19:30 GMT
41
+ - request:
42
+ method: get
43
+ uri: http://192.168.22.144:55001/UIC?cmd=%3Cname%3ESetMute%3C/name%3E%3Cp%20type=%22str%22%20name=%22mute%22%20val=%22on%22/%3E
44
+ body:
45
+ encoding: US-ASCII
46
+ string: ''
47
+ headers:
48
+ Accept-Encoding:
49
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
50
+ Accept:
51
+ - "*/*"
52
+ User-Agent:
53
+ - Ruby
54
+ Host:
55
+ - 192.168.22.144:55001
56
+ response:
57
+ status:
58
+ code: 200
59
+ message: OK
60
+ headers:
61
+ Date:
62
+ - Sun, 21 Jan 2018 18:19:29 GMT
63
+ Server:
64
+ - Samsung/1.0
65
+ Content-Type:
66
+ - text/html
67
+ Content-Length:
68
+ - '218'
69
+ Connection:
70
+ - close
71
+ Last-Modified:
72
+ - Sun, 21 Jan 2018 18:19:29 GMT
73
+ body:
74
+ encoding: UTF-8
75
+ string: <?xml version="1.0" encoding="UTF-8"?><UIC><method>MuteStatus</method><version>1.0</version><speakerip>192.168.22.144</speakerip><user_identifier></user_identifier><response
76
+ result="ok"><mute>on</mute></response></UIC>
77
+ http_version:
78
+ recorded_at: Sun, 21 Jan 2018 18:19:30 GMT
79
+ - request:
80
+ method: get
81
+ uri: http://192.168.22.144:55001/UIC?cmd=UIC?cmd=%3Cname%3EGetMute%3C/name%3E
82
+ body:
83
+ encoding: US-ASCII
84
+ string: ''
85
+ headers:
86
+ Accept-Encoding:
87
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
88
+ Accept:
89
+ - "*/*"
90
+ User-Agent:
91
+ - Ruby
92
+ Host:
93
+ - 192.168.22.144:55001
94
+ response:
95
+ status:
96
+ code: 200
97
+ message: OK
98
+ headers:
99
+ Date:
100
+ - Sun, 21 Jan 2018 18:19:29 GMT
101
+ Server:
102
+ - Samsung/1.0
103
+ Content-Type:
104
+ - text/html
105
+ Content-Length:
106
+ - '218'
107
+ Connection:
108
+ - close
109
+ Last-Modified:
110
+ - Sun, 21 Jan 2018 18:19:29 GMT
111
+ body:
112
+ encoding: UTF-8
113
+ string: <?xml version="1.0" encoding="UTF-8"?><UIC><method>MuteStatus</method><version>1.0</version><speakerip>192.168.22.144</speakerip><user_identifier></user_identifier><response
114
+ result="ok"><mute>on</mute></response></UIC>
115
+ http_version:
116
+ recorded_at: Sun, 21 Jan 2018 18:19:30 GMT
117
+ - request:
118
+ method: get
119
+ uri: http://192.168.22.144:55001/UIC?cmd=%3Cname%3ESetMute%3C/name%3E%3Cp%20type=%22str%22%20name=%22mute%22%20val=%22off%22/%3E
120
+ body:
121
+ encoding: US-ASCII
122
+ string: ''
123
+ headers:
124
+ Accept-Encoding:
125
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
126
+ Accept:
127
+ - "*/*"
128
+ User-Agent:
129
+ - Ruby
130
+ Host:
131
+ - 192.168.22.144:55001
132
+ response:
133
+ status:
134
+ code: 200
135
+ message: OK
136
+ headers:
137
+ Date:
138
+ - Sun, 21 Jan 2018 18:19:29 GMT
139
+ Server:
140
+ - Samsung/1.0
141
+ Content-Type:
142
+ - text/html
143
+ Content-Length:
144
+ - '219'
145
+ Connection:
146
+ - close
147
+ Last-Modified:
148
+ - Sun, 21 Jan 2018 18:19:29 GMT
149
+ body:
150
+ encoding: UTF-8
151
+ string: <?xml version="1.0" encoding="UTF-8"?><UIC><method>MuteStatus</method><version>1.0</version><speakerip>192.168.22.144</speakerip><user_identifier></user_identifier><response
152
+ result="ok"><mute>off</mute></response></UIC>
153
+ http_version:
154
+ recorded_at: Sun, 21 Jan 2018 18:19:30 GMT
155
+ - request:
156
+ method: get
157
+ uri: http://192.168.22.144:55001/UIC?cmd=UIC?cmd=%3Cname%3EGetMute%3C/name%3E
158
+ body:
159
+ encoding: US-ASCII
160
+ string: ''
161
+ headers:
162
+ Accept-Encoding:
163
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
164
+ Accept:
165
+ - "*/*"
166
+ User-Agent:
167
+ - Ruby
168
+ Host:
169
+ - 192.168.22.144:55001
170
+ response:
171
+ status:
172
+ code: 200
173
+ message: OK
174
+ headers:
175
+ Date:
176
+ - Sun, 21 Jan 2018 18:19:29 GMT
177
+ Server:
178
+ - Samsung/1.0
179
+ Content-Type:
180
+ - text/html
181
+ Content-Length:
182
+ - '219'
183
+ Connection:
184
+ - close
185
+ Last-Modified:
186
+ - Sun, 21 Jan 2018 18:19:29 GMT
187
+ body:
188
+ encoding: UTF-8
189
+ string: <?xml version="1.0" encoding="UTF-8"?><UIC><method>MuteStatus</method><version>1.0</version><speakerip>192.168.22.144</speakerip><user_identifier></user_identifier><response
190
+ result="ok"><mute>off</mute></response></UIC>
191
+ http_version:
192
+ recorded_at: Sun, 21 Jan 2018 18:19:30 GMT
193
+ - request:
194
+ method: get
195
+ uri: http://192.168.22.144:55001/UIC?cmd=UIC?cmd=%3Cname%3EGetMute%3C/name%3E
196
+ body:
197
+ encoding: US-ASCII
198
+ string: ''
199
+ headers:
200
+ Accept-Encoding:
201
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
202
+ Accept:
203
+ - "*/*"
204
+ User-Agent:
205
+ - Ruby
206
+ Host:
207
+ - 192.168.22.144:55001
208
+ response:
209
+ status:
210
+ code: 200
211
+ message: OK
212
+ headers:
213
+ Date:
214
+ - Sun, 21 Jan 2018 18:19:29 GMT
215
+ Server:
216
+ - Samsung/1.0
217
+ Content-Type:
218
+ - text/html
219
+ Content-Length:
220
+ - '219'
221
+ Connection:
222
+ - close
223
+ Last-Modified:
224
+ - Sun, 21 Jan 2018 18:19:29 GMT
225
+ body:
226
+ encoding: UTF-8
227
+ string: <?xml version="1.0" encoding="UTF-8"?><UIC><method>MuteStatus</method><version>1.0</version><speakerip>192.168.22.144</speakerip><user_identifier></user_identifier><response
228
+ result="ok"><mute>off</mute></response></UIC>
229
+ http_version:
230
+ recorded_at: Sun, 21 Jan 2018 18:19:30 GMT
231
+ - request:
232
+ method: get
233
+ uri: http://192.168.22.144:55001/UIC?cmd=%3Cname%3ESetMute%3C/name%3E%3Cp%20type=%22str%22%20name=%22mute%22%20val=%22on%22/%3E
234
+ body:
235
+ encoding: US-ASCII
236
+ string: ''
237
+ headers:
238
+ Accept-Encoding:
239
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
240
+ Accept:
241
+ - "*/*"
242
+ User-Agent:
243
+ - Ruby
244
+ Host:
245
+ - 192.168.22.144:55001
246
+ response:
247
+ status:
248
+ code: 200
249
+ message: OK
250
+ headers:
251
+ Date:
252
+ - Sun, 21 Jan 2018 18:19:29 GMT
253
+ Server:
254
+ - Samsung/1.0
255
+ Content-Type:
256
+ - text/html
257
+ Content-Length:
258
+ - '218'
259
+ Connection:
260
+ - close
261
+ Last-Modified:
262
+ - Sun, 21 Jan 2018 18:19:29 GMT
263
+ body:
264
+ encoding: UTF-8
265
+ string: <?xml version="1.0" encoding="UTF-8"?><UIC><method>MuteStatus</method><version>1.0</version><speakerip>192.168.22.144</speakerip><user_identifier></user_identifier><response
266
+ result="ok"><mute>on</mute></response></UIC>
267
+ http_version:
268
+ recorded_at: Sun, 21 Jan 2018 18:19:30 GMT
269
+ - request:
270
+ method: get
271
+ uri: http://192.168.22.144:55001/UIC?cmd=UIC?cmd=%3Cname%3EGetMute%3C/name%3E
272
+ body:
273
+ encoding: US-ASCII
274
+ string: ''
275
+ headers:
276
+ Accept-Encoding:
277
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
278
+ Accept:
279
+ - "*/*"
280
+ User-Agent:
281
+ - Ruby
282
+ Host:
283
+ - 192.168.22.144:55001
284
+ response:
285
+ status:
286
+ code: 200
287
+ message: OK
288
+ headers:
289
+ Date:
290
+ - Sun, 21 Jan 2018 18:19:29 GMT
291
+ Server:
292
+ - Samsung/1.0
293
+ Content-Type:
294
+ - text/html
295
+ Content-Length:
296
+ - '218'
297
+ Connection:
298
+ - close
299
+ Last-Modified:
300
+ - Sun, 21 Jan 2018 18:19:29 GMT
301
+ body:
302
+ encoding: UTF-8
303
+ string: <?xml version="1.0" encoding="UTF-8"?><UIC><method>MuteStatus</method><version>1.0</version><speakerip>192.168.22.144</speakerip><user_identifier></user_identifier><response
304
+ result="ok"><mute>on</mute></response></UIC>
305
+ http_version:
306
+ recorded_at: Sun, 21 Jan 2018 18:19:30 GMT
307
+ - request:
308
+ method: get
309
+ uri: http://192.168.22.144:55001/UIC?cmd=UIC?cmd=%3Cname%3EGetMute%3C/name%3E
310
+ body:
311
+ encoding: US-ASCII
312
+ string: ''
313
+ headers:
314
+ Accept-Encoding:
315
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
316
+ Accept:
317
+ - "*/*"
318
+ User-Agent:
319
+ - Ruby
320
+ Host:
321
+ - 192.168.22.144:55001
322
+ response:
323
+ status:
324
+ code: 200
325
+ message: OK
326
+ headers:
327
+ Date:
328
+ - Sun, 21 Jan 2018 18:19:29 GMT
329
+ Server:
330
+ - Samsung/1.0
331
+ Content-Type:
332
+ - text/html
333
+ Content-Length:
334
+ - '218'
335
+ Connection:
336
+ - close
337
+ Last-Modified:
338
+ - Sun, 21 Jan 2018 18:19:29 GMT
339
+ body:
340
+ encoding: UTF-8
341
+ string: <?xml version="1.0" encoding="UTF-8"?><UIC><method>MuteStatus</method><version>1.0</version><speakerip>192.168.22.144</speakerip><user_identifier></user_identifier><response
342
+ result="ok"><mute>on</mute></response></UIC>
343
+ http_version:
344
+ recorded_at: Sun, 21 Jan 2018 18:19:30 GMT
345
+ - request:
346
+ method: get
347
+ uri: http://192.168.22.144:55001/UIC?cmd=%3Cname%3ESetMute%3C/name%3E%3Cp%20type=%22str%22%20name=%22mute%22%20val=%22off%22/%3E
348
+ body:
349
+ encoding: US-ASCII
350
+ string: ''
351
+ headers:
352
+ Accept-Encoding:
353
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
354
+ Accept:
355
+ - "*/*"
356
+ User-Agent:
357
+ - Ruby
358
+ Host:
359
+ - 192.168.22.144:55001
360
+ response:
361
+ status:
362
+ code: 200
363
+ message: OK
364
+ headers:
365
+ Date:
366
+ - Sun, 21 Jan 2018 18:19:30 GMT
367
+ Server:
368
+ - Samsung/1.0
369
+ Content-Type:
370
+ - text/html
371
+ Content-Length:
372
+ - '219'
373
+ Connection:
374
+ - close
375
+ Last-Modified:
376
+ - Sun, 21 Jan 2018 18:19:30 GMT
377
+ body:
378
+ encoding: UTF-8
379
+ string: <?xml version="1.0" encoding="UTF-8"?><UIC><method>MuteStatus</method><version>1.0</version><speakerip>192.168.22.144</speakerip><user_identifier></user_identifier><response
380
+ result="ok"><mute>off</mute></response></UIC>
381
+ http_version:
382
+ recorded_at: Sun, 21 Jan 2018 18:19:30 GMT
383
+ - request:
384
+ method: get
385
+ uri: http://192.168.22.144:55001/UIC?cmd=UIC?cmd=%3Cname%3EGetMute%3C/name%3E
386
+ body:
387
+ encoding: US-ASCII
388
+ string: ''
389
+ headers:
390
+ Accept-Encoding:
391
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
392
+ Accept:
393
+ - "*/*"
394
+ User-Agent:
395
+ - Ruby
396
+ Host:
397
+ - 192.168.22.144:55001
398
+ response:
399
+ status:
400
+ code: 200
401
+ message: OK
402
+ headers:
403
+ Date:
404
+ - Sun, 21 Jan 2018 18:19:30 GMT
405
+ Server:
406
+ - Samsung/1.0
407
+ Content-Type:
408
+ - text/html
409
+ Content-Length:
410
+ - '219'
411
+ Connection:
412
+ - close
413
+ Last-Modified:
414
+ - Sun, 21 Jan 2018 18:19:30 GMT
415
+ body:
416
+ encoding: UTF-8
417
+ string: <?xml version="1.0" encoding="UTF-8"?><UIC><method>MuteStatus</method><version>1.0</version><speakerip>192.168.22.144</speakerip><user_identifier></user_identifier><response
418
+ result="ok"><mute>off</mute></response></UIC>
419
+ http_version:
420
+ recorded_at: Sun, 21 Jan 2018 18:19:30 GMT
421
+ recorded_with: VCR 4.0.0
@@ -51,6 +51,26 @@ module SamsungWamApi
51
51
  set_volume(volume - step.to_i)
52
52
  end
53
53
 
54
+ def mute_status
55
+ command!('UIC?cmd=<name>GetMute</name>')['mute']
56
+ end
57
+
58
+ def muted?
59
+ mute_status == 'on'
60
+ end
61
+
62
+ def mute!
63
+ command!('<name>SetMute</name><p type="str" name="mute" val="on"/>')
64
+ end
65
+
66
+ def unmute!
67
+ command!('<name>SetMute</name><p type="str" name="mute" val="off"/>')
68
+ end
69
+
70
+ def toggle_mute!
71
+ muted? ? unmute! : mute!
72
+ end
73
+
54
74
  def command!(cmd)
55
75
  query = "http://#{@ip}:#{@port}/#{@endpoint}?cmd=#{URI.encode(cmd)}"
56
76
  @logger.debug { "Firing query '#{URI.decode(query)}'" }
@@ -1,3 +1,3 @@
1
1
  module SamsungWamApi
2
- VERSION = "0.1.0"
2
+ VERSION = "0.1.1"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: samsung_wam_api
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Marek Hulan
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-01-17 00:00:00.000000000 Z
11
+ date: 2018-01-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -117,6 +117,7 @@ files:
117
117
  - fixtures/vcr_cassettes/set_volume.yml
118
118
  - fixtures/vcr_cassettes/turn_off.yml
119
119
  - fixtures/vcr_cassettes/turn_on.yml
120
+ - fixtures/vcr_cassettes/unmuted.yml
120
121
  - lib/samsung_wam_api.rb
121
122
  - lib/samsung_wam_api/device.rb
122
123
  - lib/samsung_wam_api/version.rb