Sha256: 8ccfc9c11698c9de46aa49d9ef3b7a3799c4cec1e95c29def258a2cc54829689

Contents?: true

Size: 778 Bytes

Versions: 4

Compression:

Stored size: 778 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.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

4 entries across 4 versions & 1 rubygems

Version Path
loquor-0.5.3 lib/loquor/resource.rb
loquor-0.5.2 lib/loquor/resource.rb
loquor-0.5.1 lib/loquor/resource.rb
loquor-0.5.0 lib/loquor/resource.rb