Class: Screens

Inherits:
Base
  • Object
show all
Defined in:
lib/zapix/proxies/screens.rb

Instance Attribute Summary

Attributes inherited from Base

#client

Instance Method Summary collapse

Methods inherited from Base

#initialize

Constructor Details

This class inherits a constructor from Base

Instance Method Details

#create(options) ⇒ Object



10
11
12
# File 'lib/zapix/proxies/screens.rb', line 10

def create(options)
  client.screen_create(options) unless exists?(options)
end

#delete(*screen_ids) ⇒ Object



14
15
16
# File 'lib/zapix/proxies/screens.rb', line 14

def delete(*screen_ids)
  client.screen_delete(screen_ids)
end

#exists?(options) ⇒ Boolean

Returns:

  • (Boolean)


18
19
20
21
22
23
24
25
# File 'lib/zapix/proxies/screens.rb', line 18

def exists?(options)
  result = client.screen_get('filter' => { 'name' => options['name'] })
  if result.nil? || result.empty?
    false
  else
    true
  end
end

#get_id(options) ⇒ Object



4
5
6
7
8
# File 'lib/zapix/proxies/screens.rb', line 4

def get_id(options)
  result = client.screen_get('filter' => { 'name' => options['name'] })

  result.first['screenid']
end