Class: Restful::ApiModel::Resource

Inherits:
Map
  • Object
show all
Defined in:
lib/restful/apimodel/resource.rb

Instance Attribute Summary collapse

Attributes inherited from Map

#name, #type, #values

Instance Method Summary collapse

Methods inherited from Map

#collections, #deserialize_from, #links, #serialize, #simple_attributes

Constructor Details

#initialize(name, url) ⇒ Resource

Returns a new instance of Resource.



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

def initialize(name, url)
  super(name)
  
  self.url = url[:url]
  self.path = url[:path]
  self.base = url[:base]                
  self.type = :resource
end

Instance Attribute Details

#baseObject

Returns the value of attribute base.



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

def base
  @base
end

#pathObject

Returns the value of attribute path.



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

def path
  @path
end

#urlObject

Returns the value of attribute url.



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

def url
  @url
end

Instance Method Details

#full_urlObject



18
19
20
# File 'lib/restful/apimodel/resource.rb', line 18

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