Class: Axel::Configurations::Resource
- Inherits:
-
Object
- Object
- Axel::Configurations::Resource
- Defined in:
- lib/axel/configurations/resource.rb
Instance Attribute Summary collapse
-
#attributes ⇒ Object
Returns the value of attribute attributes.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
- #path ⇒ Object
-
#service ⇒ Object
readonly
Returns the value of attribute service.
Instance Method Summary collapse
- #base_url ⇒ Object
- #full_url ⇒ Object
-
#initialize(name, service, options = {}) ⇒ Resource
constructor
A new instance of Resource.
Constructor Details
#initialize(name, service, options = {}) ⇒ Resource
Returns a new instance of Resource.
9 10 11 12 13 14 |
# File 'lib/axel/configurations/resource.rb', line 9 def initialize(name, service, = {}) @name = name.to_s.singularize @service = service @attributes = [:attributes] || [] @path = [:path] # If nil it will try to build URL from name and service end |
Instance Attribute Details
#attributes ⇒ Object
Returns the value of attribute attributes.
6 7 8 |
# File 'lib/axel/configurations/resource.rb', line 6 def attributes @attributes end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
4 5 6 |
# File 'lib/axel/configurations/resource.rb', line 4 def name @name end |
#path ⇒ Object
24 25 26 |
# File 'lib/axel/configurations/resource.rb', line 24 def path @path || name.pluralize end |
#service ⇒ Object (readonly)
Returns the value of attribute service.
5 6 7 |
# File 'lib/axel/configurations/resource.rb', line 5 def service @service end |
Instance Method Details
#base_url ⇒ Object
20 21 22 |
# File 'lib/axel/configurations/resource.rb', line 20 def base_url service.url end |
#full_url ⇒ Object
16 17 18 |
# File 'lib/axel/configurations/resource.rb', line 16 def full_url URI.join(base_url, path).to_s end |