Sha256: 015752b9e8d32d4a614fd881e3e90f9310ea94886d0463e8b3dcf9a36ebd3438
Contents?: true
Size: 1.22 KB
Versions: 3
Compression:
Stored size: 1.22 KB
Contents
module Squall # OnApp Network class Network < Base # Returns a list of Networks def list response = request(:get, '/settings/networks.json') response.collect { |network| network['network'] } end # Edit a Network # # ==== Options # # * +options+ - Params for editing the Network # ==== Example # # edit :label => 'mynetwork', :network_group_id => 1, :vlan => 2, :identifier => 'something' def edit(id, options = {}) params.accepts(:label, :network_group_id, :vlan, :identifier).validate!(options) response = request(:put, "/settings/networks/#{id}.json", default_params(options)) end # Create a Network # # ==== Options # # * +options+ - Params for creating the Network # ==== Example # # create :label => 'mynetwork', :network_group_id => 1, :vlan => 2, :identifier => 'something' def create(options = {}) params.accepts(:label, :vlan, :identifier).required(:label).validate!(options) response = request(:post, '/settings/networks.json', default_params(options)) response.first[1] end # Delete a network def delete(id) request(:delete, "/settings/networks/#{id}.json") end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
squall-1.0.2 | lib/squall/network.rb |
squall-1.0.1 | lib/squall/network.rb |
squall-1.0.0 | lib/squall/network.rb |