Class: FidorApi::Connectivity::Endpoint
- Inherits:
-
Object
- Object
- FidorApi::Connectivity::Endpoint
- Defined in:
- lib/fidor_api/connectivity/endpoint.rb
Defined Under Namespace
Classes: Context
Instance Attribute Summary collapse
-
#collection ⇒ Object
readonly
Returns the value of attribute collection.
-
#resource ⇒ Object
readonly
Returns the value of attribute resource.
-
#tokenless ⇒ Object
readonly
Returns the value of attribute tokenless.
-
#version ⇒ Object
readonly
Returns the value of attribute version.
Instance Method Summary collapse
- #for(object) ⇒ Object
-
#initialize(path, mode, version: '1', tokenless: false) ⇒ Endpoint
constructor
A new instance of Endpoint.
Constructor Details
#initialize(path, mode, version: '1', tokenless: false) ⇒ Endpoint
Returns a new instance of Endpoint.
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/fidor_api/connectivity/endpoint.rb', line 6 def initialize(path, mode, version: '1', tokenless: false) @path = path @version = version @tokenless = tokenless case mode when :collection @collection = path @resource = "#{path}/:id" when :resource @resource = path else fail ArgumentError, "mode #{mode.inspect} must be resource or collection" end end |
Instance Attribute Details
#collection ⇒ Object (readonly)
Returns the value of attribute collection.
4 5 6 |
# File 'lib/fidor_api/connectivity/endpoint.rb', line 4 def collection @collection end |
#resource ⇒ Object (readonly)
Returns the value of attribute resource.
4 5 6 |
# File 'lib/fidor_api/connectivity/endpoint.rb', line 4 def resource @resource end |
#tokenless ⇒ Object (readonly)
Returns the value of attribute tokenless.
4 5 6 |
# File 'lib/fidor_api/connectivity/endpoint.rb', line 4 def tokenless @tokenless end |
#version ⇒ Object (readonly)
Returns the value of attribute version.
4 5 6 |
# File 'lib/fidor_api/connectivity/endpoint.rb', line 4 def version @version end |