Sha256: 8cf9e9088cf66a4b366fdc5de9b6ca1ebefb916fcb881e4771b4a2fcde9111bf

Contents?: true

Size: 605 Bytes

Versions: 3

Compression:

Stored size: 605 Bytes

Contents

module Arrest
  class RootResource < AbstractResource

    class << self

      def resource_path
        "#{self.resource_name}"
      end

      def all
        body = body_root(source().get self.resource_path)
        body ||= []
        body.map do |h|
          self.build h
        end
      end

      def find id
        r = source().get "#{self.resource_path}/#{id}"
        body = body_root(r)
        self.build body
      end

    end

    def resource_path
      "#{self.class.resource_name}"
    end

    def location
      self.class.resource_path + '/' + self.id.to_s 
    end

  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
arrest-0.0.4 lib/arrest/root_resource.rb
arrest-0.0.3 lib/arrest/root_resource.rb
arrest-0.0.2 lib/arrest/root_resource.rb