Class: JsonClient::Pather

Inherits:
Object
  • Object
show all
Defined in:
lib/json_client/pather.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(host, ext, name) ⇒ Pather

Returns a new instance of Pather.



6
7
8
9
10
# File 'lib/json_client/pather.rb', line 6

def initialize(host, ext, name)
  @host = host
  @ext = ext
  @name = name
end

Instance Attribute Details

#extObject (readonly)

Returns the value of attribute ext.



4
5
6
# File 'lib/json_client/pather.rb', line 4

def ext
  @ext
end

#hostObject (readonly)

Returns the value of attribute host.



4
5
6
# File 'lib/json_client/pather.rb', line 4

def host
  @host
end

#nameObject (readonly)

Returns the value of attribute name.



4
5
6
# File 'lib/json_client/pather.rb', line 4

def name
  @name
end

Instance Method Details

#path(id = nil) ⇒ Object



12
13
14
15
16
17
18
# File 'lib/json_client/pather.rb', line 12

def path(id = nil)
  if id.nil?
    "#{host}/#{ext}/#{name}"
  else
    "#{host}/#{ext}/#{name}/#{id}"
  end
end