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



12
13
14
# File 'lib/zapix/proxies/screens.rb', line 12

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

#delete(*screen_ids) ⇒ Object



16
17
18
# File 'lib/zapix/proxies/screens.rb', line 16

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

#exists?(options) ⇒ Boolean



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

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
9
10
# File 'lib/zapix/proxies/screens.rb', line 4

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

  result.first['screenid']
end