class Nuke::Client::Command

Public Class Methods

new(url) click to toggle source
# File lib/nuke/client/command.rb, line 7
def initialize url
  @url = url
end

Public Instance Methods

destroy() click to toggle source
# File lib/nuke/client/command.rb, line 15
def destroy
  RestClient.delete url
end
push(features) click to toggle source
# File lib/nuke/client/command.rb, line 11
def push features
  RestClient.put url("/features/"), jsonify(features), json_headers
end

Private Instance Methods

code() click to toggle source
# File lib/nuke/client/command.rb, line 21
def code
  if File.exist?('.nuker')
    '?authentication_code=' + File.read(".nuker").strip
  else
    ''
  end
end
json_headers() click to toggle source
# File lib/nuke/client/command.rb, line 38
def json_headers
  { :content_type => :json, :accept => :json }
end
jsonify(features) click to toggle source
# File lib/nuke/client/command.rb, line 33
def jsonify features
  require "json"
  features.to_json
end
url(part = "") click to toggle source
# File lib/nuke/client/command.rb, line 29
def url part = ""
  [@url, part, code].join
end