Module: Restio::Util::Url

Included in:
Connector::Generic
Defined in:
lib/restio/util/url.rb

Class Attribute Summary collapse

Instance Attribute Summary collapse

Instance Method Summary collapse

Class Attribute Details

.urlObject



9
10
11
# File 'lib/restio/util/url.rb', line 9

def url
  Pathname.new (@url || 'http://example.com')
end

Instance Attribute Details

#base_urlObject

Returns the value of attribute base_url.



13
14
15
# File 'lib/restio/util/url.rb', line 13

def base_url
  @base_url
end

Instance Method Details

#urlObject



14
15
16
17
18
19
20
21
22
23
# File 'lib/restio/util/url.rb', line 14

def url
  case type
  when :collection
    base_url ||= Restio.config.url
    base_url   = Pathname.new(base_url) if base_url
    base_url.join(@klass.rest.name).to_s
  when :resource
    Pathname.new(@klass.rest.url).join(identifier.to_s).to_s
  end
end