Sha256: 08498d80d38e72a8bf8bee0a37527f93333d887303289dc9f08fd2bdc23215af

Contents?: true

Size: 876 Bytes

Versions: 1

Compression:

Stored size: 876 Bytes

Contents

module Loquor
  class Resource

    def initialize(data)
      @data = ObjectHash.new(data)
    end

    def method_missing(name, *args)
      @data[name]
    end

    def self.path=(path)
      @path = path
    end

    def self.path
      @path
    end

    def self.cache=(value)
      @value = value
    end

    def self.cache
      @value
    end

    def self.find(id)
      ApiCall::Show.new(self, id).execute
    end

    def self.find_each(&block)
      ApiCall::Index.new(self).find_each(&block)
    end

    def self.select(*args)
      ApiCall::Index.new(self).select(*args)
    end

    def self.where(*args)
      ApiCall::Index.new(self).where(*args)
    end

    def self.create(payload)
      ApiCall::Create.new(self, payload).execute
    end

    def self.update(id, payload)
      ApiCall::Update.new(self, id, payload: payload).execute
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
loquor-0.5.4 lib/loquor/resource.rb