Class: Restful::ApiModel::Resource
- Defined in:
- lib/restful/apimodel/resource.rb
Instance Attribute Summary collapse
-
#base ⇒ Object
Returns the value of attribute base.
-
#path ⇒ Object
Returns the value of attribute path.
-
#url ⇒ Object
Returns the value of attribute url.
Attributes inherited from Map
Instance Method Summary collapse
- #full_url ⇒ Object
-
#initialize(name, url) ⇒ Resource
constructor
A new instance of Resource.
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
#base ⇒ Object
Returns the value of attribute base.
7 8 9 |
# File 'lib/restful/apimodel/resource.rb', line 7 def base @base end |
#path ⇒ Object
Returns the value of attribute path.
7 8 9 |
# File 'lib/restful/apimodel/resource.rb', line 7 def path @path end |
#url ⇒ Object
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_url ⇒ Object
18 19 20 |
# File 'lib/restful/apimodel/resource.rb', line 18 def full_url base.blank? ? url : "#{ base }#{ path }" end |