Sha256: aef8a285aaa0faa487a4127fc742d057f2428e16756e2f578aaa4c121754d4fe
Contents?: true
Size: 1.06 KB
Versions: 1
Compression:
Stored size: 1.06 KB
Contents
require 'sauce_whisk/rest_request_builder' module SauceWhisk class Tunnels extend RestRequestBuilder def self.resource "#{SauceWhisk.username}/tunnels" end def self.all(opts = {:fetch_each => true}) all_tunnels = JSON.parse get fetch_each = opts[:fetch_each] unless fetch_each return all_tunnels end tunnels = all_tunnels.map do |tunnel| fetch tunnel end return tunnels end def self.open(opts) #opts[:tunnel_identifier] = opts.delete :tunnel_id new_tunnel_parameters = JSON.parse post opts.to_json end def self.stop tunnel_id delete tunnel_id end def self.fetch tunnel_id tunnel_parameters = JSON.parse get tunnel_id Tunnel.new tunnel_parameters end end class Tunnel attr_reader :id, :owner, :status, :host, :creation_time def initialize(params) params.each do |param, val| self.instance_variable_set("@#{param}", val) end end def stop SauceWhisk::Tunnels.stop self.id end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
sauce_whisk-0.0.9 | lib/sauce_whisk/tunnels.rb |