Class: PortaText::Command::Api::Acl

Inherits:
Base
  • Object
show all
Defined in:
lib/portatext/command/api/acl.rb

Overview

The acl endpoint. github.com/PortaText/docs/wiki/REST-API#api_acl

Author

Marcelo Gornstein ([email protected])

Copyright

Copyright © 2015 PortaText

License

Apache-2.0

Instance Attribute Summary

Attributes inherited from Base

#client

Instance Method Summary collapse

Methods inherited from Base

#accept_content_type, #content_type, #delete, #get, #initialize, #patch, #post, #put, #set

Constructor Details

This class inherits a constructor from PortaText::Command::Base

Instance Method Details

#add(ip, netmask = 32, description = '') ⇒ Object



11
12
13
14
# File 'lib/portatext/command/api/acl.rb', line 11

def add(ip, netmask = 32, description = '')
  key = "#{ip}#{netmask}"
  set key, ip: ip, netmask: netmask, description: description
end

#body(method) ⇒ Object



16
17
18
19
# File 'lib/portatext/command/api/acl.rb', line 16

def body(method)
  return super if method.eql? :get
  { acl: @args.values }.to_json
end

#endpoint(_method) ⇒ Object



21
22
23
# File 'lib/portatext/command/api/acl.rb', line 21

def endpoint(_method)
  'acl'
end