class JsonClient::UriBuilder
Attributes
ext[R]
host[R]
name[R]
port[R]
ssl[R]
Public Class Methods
new(host, ext, name, port = '80', ssl = false)
click to toggle source
# File lib/json_client/uri_builder.rb, line 5 def initialize(host, ext, name, port = '80', ssl = false) @host = host @ext = ext @name = name @port = port @ssl = ssl end
Public Instance Methods
path(id = nil)
click to toggle source
# File lib/json_client/uri_builder.rb, line 13 def path(id = nil) base = "#{host}:#{port}" if id.nil? base + "/#{ext}/#{name}" else base + "/#{ext}/#{name}/#{id}" end end
uri(id = nil)
click to toggle source
# File lib/json_client/uri_builder.rb, line 22 def uri(id = nil) p = path(id) if ssl p = "https://#{p}" else p = "http://#{p}" end URI(p) end