Class: JsonShim

Inherits:
HasOutAndLog show all
Defined in:
lib/nu/json_shim.rb

Instance Method Summary collapse

Methods inherited from HasOutAndLog

#initialize

Constructor Details

This class inherits a constructor from HasOutAndLog

Instance Method Details

#get_setting(name) ⇒ Object



20
21
22
# File 'lib/nu/json_shim.rb', line 20

def get_setting(name)
	json_out ({:name => name, :value => Nu::Api.get_setting(name) })
end

#install_package(package, package_version) ⇒ Object



16
17
18
# File 'lib/nu/json_shim.rb', line 16

def install_package(package, package_version)
	json_out Nu::Api.install_package(package, package_version)
end

#json_out(object) ⇒ Object



12
13
14
# File 'lib/nu/json_shim.rb', line 12

def json_out(object)
	out object.to_json
end

#propose(name, version) ⇒ Object



33
34
35
36
# File 'lib/nu/json_shim.rb', line 33

def propose(name, version)
	log "Json Shim Propose called. name: #{name} version: #{version}"
	json_out Nu::Api.propose_package(name, version)
end

#reportObject



8
9
10
# File 'lib/nu/json_shim.rb', line 8

def report
	json_out Nu::Api.report
end

#specification(name, version, source) ⇒ Object



24
25
26
27
28
29
30
31
# File 'lib/nu/json_shim.rb', line 24

def specification(name, version, source)
	log "Json Shim Specification called. name: #{name} version: #{version} source:#{source}"
	if version == nil
		json_out Nu::Api.retrieve_specification(name, :from => source)
	else
		json_out Nu::Api.retrieve_specification_with_version(name, version, :from => source)
	end
end