Sha256: 8d5a573e7d026dd8658330a722010bddac620bd1a970fadb04d467ba381294db

Contents?: true

Size: 645 Bytes

Versions: 1

Compression:

Stored size: 645 Bytes

Contents

module FmRest
  module Spyke
    module Model
      module Uri
        extend ::ActiveSupport::Concern

        class_methods do
          # Accessor for FM layout (helps with building the URI)
          #
          def layout(layout = nil)
            @layout = layout if layout
            @layout ||= model_name.name
          end

          # Extend uri acccessor to default to FM Data schema
          #
          def uri(uri_template = nil)
            if @uri.nil? && uri_template.nil?
              return FmRest::V1.record_path(layout) + "(/:id)"
            end

            super
          end
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
fmrest-0.1.0 lib/fmrest/spyke/model/uri.rb