Class: Restful::ApiModel::Link

Inherits:
Attribute show all
Defined in:
lib/restful/apimodel/link.rb

Instance Attribute Summary collapse

Attributes inherited from Attribute

#extended_type, #name, #type, #value

Instance Method Summary collapse

Constructor Details

#initialize(name, base, path, extended_type) ⇒ Link

Returns a new instance of Link.



9
10
11
12
13
14
# File 'lib/restful/apimodel/link.rb', line 9

def initialize(name, base, path, extended_type)        
  self.base = base
  self.path = path
  super(name, self.full_url, extended_type)
  self.type = :link
end

Instance Attribute Details

#baseObject

Returns the value of attribute base.



7
8
9
# File 'lib/restful/apimodel/link.rb', line 7

def base
  @base
end

#pathObject

Returns the value of attribute path.



7
8
9
# File 'lib/restful/apimodel/link.rb', line 7

def path
  @path
end

Instance Method Details

#full_urlObject



16
17
18
# File 'lib/restful/apimodel/link.rb', line 16

def full_url
  base.blank? ? path : "#{ base }#{ path }"
end