Module: FmRest::Spyke::Model::URI

Extended by:
ActiveSupport::Concern
Included in:
FmRest::Spyke::Model
Defined in:
lib/fmrest/spyke/model/uri.rb

Class Method Summary collapse

Class Method Details

.layout(layout = nil) ⇒ String

Accessor for FM layout (user for building request URIs).

Parameters:

  • layout (String) (defaults to: nil)

    The FM layout to connect this class to

Returns:

  • (String)

    The current layout if manually set, or the name of the class otherwise



26
27
28
29
# File 'lib/fmrest/spyke/model/uri.rb', line 26

def layout(layout = nil)
  self._layout = layout.dup.to_s.freeze if layout
  self._layout || model_name.name
end

.uri(uri_template = nil) ⇒ Object

Spyke override -- Extends uri to default to FM Data's URI schema



33
34
35
36
37
38
# File 'lib/fmrest/spyke/model/uri.rb', line 33

def uri(uri_template = nil)
  if @uri.nil? && uri_template.nil?
    return FmRest::V1.record_path(layout) + "(/:#{primary_key})"
  end
  super
end